[
  {
    "path": ".editorconfig",
    "content": "root = true\n\n[*]\nend_of_line = crlf\ninsert_final_newline = true\ncharset = utf-8\nindent_style = tab\nindent_size = 4\ntrim_trailing_whitespace = true\n\n[*.md]\ntrim_trailing_whitespace = false"
  },
  {
    "path": ".github/FUNDING.yml",
    "content": "custom: https://www.paypal.com/donate/?business=LVAYFCMQYN8F4&no_recurring=0&item_name=BBSHD-FW&currency_code=USD\n"
  },
  {
    "path": "LICENSE",
    "content": "                    GNU GENERAL PUBLIC LICENSE\n                       Version 3, 29 June 2007\n\n Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>\n Everyone is permitted to copy and distribute verbatim copies\n of this license document, but changing it is not allowed.\n\n                            Preamble\n\n  The GNU General Public License is a free, copyleft license for\nsoftware and other kinds of works.\n\n  The licenses for most software and other practical works are designed\nto take away your freedom to share and change the works.  By contrast,\nthe GNU General Public License is intended to guarantee your freedom to\nshare and change all versions of a program--to make sure it remains free\nsoftware for all its users.  We, the Free Software Foundation, use the\nGNU General Public License for most of our software; it applies also to\nany other work released this way by its authors.  You can apply it to\nyour programs, too.\n\n  When we speak of free software, we are referring to freedom, not\nprice.  Our General Public Licenses are designed to make sure that you\nhave the freedom to distribute copies of free software (and charge for\nthem if you wish), that you receive source code or can get it if you\nwant it, that you can change the software or use pieces of it in new\nfree programs, and that you know you can do these things.\n\n  To protect your rights, we need to prevent others from denying you\nthese rights or asking you to surrender the rights.  Therefore, you have\ncertain responsibilities if you distribute copies of the software, or if\nyou modify it: responsibilities to respect the freedom of others.\n\n  For example, if you distribute copies of such a program, whether\ngratis or for a fee, you must pass on to the recipients the same\nfreedoms that you received.  You must make sure that they, too, receive\nor can get the source code.  And you must show them these terms so they\nknow their rights.\n\n  Developers that use the GNU GPL protect your rights with two steps:\n(1) assert copyright on the software, and (2) offer you this License\ngiving you legal permission to copy, distribute and/or modify it.\n\n  For the developers' and authors' protection, the GPL clearly explains\nthat there is no warranty for this free software.  For both users' and\nauthors' sake, the GPL requires that modified versions be marked as\nchanged, so that their problems will not be attributed erroneously to\nauthors of previous versions.\n\n  Some devices are designed to deny users access to install or run\nmodified versions of the software inside them, although the manufacturer\ncan do so.  This is fundamentally incompatible with the aim of\nprotecting users' freedom to change the software.  The systematic\npattern of such abuse occurs in the area of products for individuals to\nuse, which is precisely where it is most unacceptable.  Therefore, we\nhave designed this version of the GPL to prohibit the practice for those\nproducts.  If such problems arise substantially in other domains, we\nstand ready to extend this provision to those domains in future versions\nof the GPL, as needed to protect the freedom of users.\n\n  Finally, every program is threatened constantly by software patents.\nStates should not allow patents to restrict development and use of\nsoftware on general-purpose computers, but in those that do, we wish to\navoid the special danger that patents applied to a free program could\nmake it effectively proprietary.  To prevent this, the GPL assures that\npatents cannot be used to render the program non-free.\n\n  The precise terms and conditions for copying, distribution and\nmodification follow.\n\n                       TERMS AND CONDITIONS\n\n  0. Definitions.\n\n  \"This License\" refers to version 3 of the GNU General Public License.\n\n  \"Copyright\" also means copyright-like laws that apply to other kinds of\nworks, such as semiconductor masks.\n\n  \"The Program\" refers to any copyrightable work licensed under this\nLicense.  Each licensee is addressed as \"you\".  \"Licensees\" and\n\"recipients\" may be individuals or organizations.\n\n  To \"modify\" a work means to copy from or adapt all or part of the work\nin a fashion requiring copyright permission, other than the making of an\nexact copy.  The resulting work is called a \"modified version\" of the\nearlier work or a work \"based on\" the earlier work.\n\n  A \"covered work\" means either the unmodified Program or a work based\non the Program.\n\n  To \"propagate\" a work means to do anything with it that, without\npermission, would make you directly or secondarily liable for\ninfringement under applicable copyright law, except executing it on a\ncomputer or modifying a private copy.  Propagation includes copying,\ndistribution (with or without modification), making available to the\npublic, and in some countries other activities as well.\n\n  To \"convey\" a work means any kind of propagation that enables other\nparties to make or receive copies.  Mere interaction with a user through\na computer network, with no transfer of a copy, is not conveying.\n\n  An interactive user interface displays \"Appropriate Legal Notices\"\nto the extent that it includes a convenient and prominently visible\nfeature that (1) displays an appropriate copyright notice, and (2)\ntells the user that there is no warranty for the work (except to the\nextent that warranties are provided), that licensees may convey the\nwork under this License, and how to view a copy of this License.  If\nthe interface presents a list of user commands or options, such as a\nmenu, a prominent item in the list meets this criterion.\n\n  1. Source Code.\n\n  The \"source code\" for a work means the preferred form of the work\nfor making modifications to it.  \"Object code\" means any non-source\nform of a work.\n\n  A \"Standard Interface\" means an interface that either is an official\nstandard defined by a recognized standards body, or, in the case of\ninterfaces specified for a particular programming language, one that\nis widely used among developers working in that language.\n\n  The \"System Libraries\" of an executable work include anything, other\nthan the work as a whole, that (a) is included in the normal form of\npackaging a Major Component, but which is not part of that Major\nComponent, and (b) serves only to enable use of the work with that\nMajor Component, or to implement a Standard Interface for which an\nimplementation is available to the public in source code form.  A\n\"Major Component\", in this context, means a major essential component\n(kernel, window system, and so on) of the specific operating system\n(if any) on which the executable work runs, or a compiler used to\nproduce the work, or an object code interpreter used to run it.\n\n  The \"Corresponding Source\" for a work in object code form means all\nthe source code needed to generate, install, and (for an executable\nwork) run the object code and to modify the work, including scripts to\ncontrol those activities.  However, it does not include the work's\nSystem Libraries, or general-purpose tools or generally available free\nprograms which are used unmodified in performing those activities but\nwhich are not part of the work.  For example, Corresponding Source\nincludes interface definition files associated with source files for\nthe work, and the source code for shared libraries and dynamically\nlinked subprograms that the work is specifically designed to require,\nsuch as by intimate data communication or control flow between those\nsubprograms and other parts of the work.\n\n  The Corresponding Source need not include anything that users\ncan regenerate automatically from other parts of the Corresponding\nSource.\n\n  The Corresponding Source for a work in source code form is that\nsame work.\n\n  2. Basic Permissions.\n\n  All rights granted under this License are granted for the term of\ncopyright on the Program, and are irrevocable provided the stated\nconditions are met.  This License explicitly affirms your unlimited\npermission to run the unmodified Program.  The output from running a\ncovered work is covered by this License only if the output, given its\ncontent, constitutes a covered work.  This License acknowledges your\nrights of fair use or other equivalent, as provided by copyright law.\n\n  You may make, run and propagate covered works that you do not\nconvey, without conditions so long as your license otherwise remains\nin force.  You may convey covered works to others for the sole purpose\nof having them make modifications exclusively for you, or provide you\nwith facilities for running those works, provided that you comply with\nthe terms of this License in conveying all material for which you do\nnot control copyright.  Those thus making or running the covered works\nfor you must do so exclusively on your behalf, under your direction\nand control, on terms that prohibit them from making any copies of\nyour copyrighted material outside their relationship with you.\n\n  Conveying under any other circumstances is permitted solely under\nthe conditions stated below.  Sublicensing is not allowed; section 10\nmakes it unnecessary.\n\n  3. Protecting Users' Legal Rights From Anti-Circumvention Law.\n\n  No covered work shall be deemed part of an effective technological\nmeasure under any applicable law fulfilling obligations under article\n11 of the WIPO copyright treaty adopted on 20 December 1996, or\nsimilar laws prohibiting or restricting circumvention of such\nmeasures.\n\n  When you convey a covered work, you waive any legal power to forbid\ncircumvention of technological measures to the extent such circumvention\nis effected by exercising rights under this License with respect to\nthe covered work, and you disclaim any intention to limit operation or\nmodification of the work as a means of enforcing, against the work's\nusers, your or third parties' legal rights to forbid circumvention of\ntechnological measures.\n\n  4. Conveying Verbatim Copies.\n\n  You may convey verbatim copies of the Program's source code as you\nreceive it, in any medium, provided that you conspicuously and\nappropriately publish on each copy an appropriate copyright notice;\nkeep intact all notices stating that this License and any\nnon-permissive terms added in accord with section 7 apply to the code;\nkeep intact all notices of the absence of any warranty; and give all\nrecipients a copy of this License along with the Program.\n\n  You may charge any price or no price for each copy that you convey,\nand you may offer support or warranty protection for a fee.\n\n  5. Conveying Modified Source Versions.\n\n  You may convey a work based on the Program, or the modifications to\nproduce it from the Program, in the form of source code under the\nterms of section 4, provided that you also meet all of these conditions:\n\n    a) The work must carry prominent notices stating that you modified\n    it, and giving a relevant date.\n\n    b) The work must carry prominent notices stating that it is\n    released under this License and any conditions added under section\n    7.  This requirement modifies the requirement in section 4 to\n    \"keep intact all notices\".\n\n    c) You must license the entire work, as a whole, under this\n    License to anyone who comes into possession of a copy.  This\n    License will therefore apply, along with any applicable section 7\n    additional terms, to the whole of the work, and all its parts,\n    regardless of how they are packaged.  This License gives no\n    permission to license the work in any other way, but it does not\n    invalidate such permission if you have separately received it.\n\n    d) If the work has interactive user interfaces, each must display\n    Appropriate Legal Notices; however, if the Program has interactive\n    interfaces that do not display Appropriate Legal Notices, your\n    work need not make them do so.\n\n  A compilation of a covered work with other separate and independent\nworks, which are not by their nature extensions of the covered work,\nand which are not combined with it such as to form a larger program,\nin or on a volume of a storage or distribution medium, is called an\n\"aggregate\" if the compilation and its resulting copyright are not\nused to limit the access or legal rights of the compilation's users\nbeyond what the individual works permit.  Inclusion of a covered work\nin an aggregate does not cause this License to apply to the other\nparts of the aggregate.\n\n  6. Conveying Non-Source Forms.\n\n  You may convey a covered work in object code form under the terms\nof sections 4 and 5, provided that you also convey the\nmachine-readable Corresponding Source under the terms of this License,\nin one of these ways:\n\n    a) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by the\n    Corresponding Source fixed on a durable physical medium\n    customarily used for software interchange.\n\n    b) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by a\n    written offer, valid for at least three years and valid for as\n    long as you offer spare parts or customer support for that product\n    model, to give anyone who possesses the object code either (1) a\n    copy of the Corresponding Source for all the software in the\n    product that is covered by this License, on a durable physical\n    medium customarily used for software interchange, for a price no\n    more than your reasonable cost of physically performing this\n    conveying of source, or (2) access to copy the\n    Corresponding Source from a network server at no charge.\n\n    c) Convey individual copies of the object code with a copy of the\n    written offer to provide the Corresponding Source.  This\n    alternative is allowed only occasionally and noncommercially, and\n    only if you received the object code with such an offer, in accord\n    with subsection 6b.\n\n    d) Convey the object code by offering access from a designated\n    place (gratis or for a charge), and offer equivalent access to the\n    Corresponding Source in the same way through the same place at no\n    further charge.  You need not require recipients to copy the\n    Corresponding Source along with the object code.  If the place to\n    copy the object code is a network server, the Corresponding Source\n    may be on a different server (operated by you or a third party)\n    that supports equivalent copying facilities, provided you maintain\n    clear directions next to the object code saying where to find the\n    Corresponding Source.  Regardless of what server hosts the\n    Corresponding Source, you remain obligated to ensure that it is\n    available for as long as needed to satisfy these requirements.\n\n    e) Convey the object code using peer-to-peer transmission, provided\n    you inform other peers where the object code and Corresponding\n    Source of the work are being offered to the general public at no\n    charge under subsection 6d.\n\n  A separable portion of the object code, whose source code is excluded\nfrom the Corresponding Source as a System Library, need not be\nincluded in conveying the object code work.\n\n  A \"User Product\" is either (1) a \"consumer product\", which means any\ntangible personal property which is normally used for personal, family,\nor household purposes, or (2) anything designed or sold for incorporation\ninto a dwelling.  In determining whether a product is a consumer product,\ndoubtful cases shall be resolved in favor of coverage.  For a particular\nproduct received by a particular user, \"normally used\" refers to a\ntypical or common use of that class of product, regardless of the status\nof the particular user or of the way in which the particular user\nactually uses, or expects or is expected to use, the product.  A product\nis a consumer product regardless of whether the product has substantial\ncommercial, industrial or non-consumer uses, unless such uses represent\nthe only significant mode of use of the product.\n\n  \"Installation Information\" for a User Product means any methods,\nprocedures, authorization keys, or other information required to install\nand execute modified versions of a covered work in that User Product from\na modified version of its Corresponding Source.  The information must\nsuffice to ensure that the continued functioning of the modified object\ncode is in no case prevented or interfered with solely because\nmodification has been made.\n\n  If you convey an object code work under this section in, or with, or\nspecifically for use in, a User Product, and the conveying occurs as\npart of a transaction in which the right of possession and use of the\nUser Product is transferred to the recipient in perpetuity or for a\nfixed term (regardless of how the transaction is characterized), the\nCorresponding Source conveyed under this section must be accompanied\nby the Installation Information.  But this requirement does not apply\nif neither you nor any third party retains the ability to install\nmodified object code on the User Product (for example, the work has\nbeen installed in ROM).\n\n  The requirement to provide Installation Information does not include a\nrequirement to continue to provide support service, warranty, or updates\nfor a work that has been modified or installed by the recipient, or for\nthe User Product in which it has been modified or installed.  Access to a\nnetwork may be denied when the modification itself materially and\nadversely affects the operation of the network or violates the rules and\nprotocols for communication across the network.\n\n  Corresponding Source conveyed, and Installation Information provided,\nin accord with this section must be in a format that is publicly\ndocumented (and with an implementation available to the public in\nsource code form), and must require no special password or key for\nunpacking, reading or copying.\n\n  7. Additional Terms.\n\n  \"Additional permissions\" are terms that supplement the terms of this\nLicense by making exceptions from one or more of its conditions.\nAdditional permissions that are applicable to the entire Program shall\nbe treated as though they were included in this License, to the extent\nthat they are valid under applicable law.  If additional permissions\napply only to part of the Program, that part may be used separately\nunder those permissions, but the entire Program remains governed by\nthis License without regard to the additional permissions.\n\n  When you convey a copy of a covered work, you may at your option\nremove any additional permissions from that copy, or from any part of\nit.  (Additional permissions may be written to require their own\nremoval in certain cases when you modify the work.)  You may place\nadditional permissions on material, added by you to a covered work,\nfor which you have or can give appropriate copyright permission.\n\n  Notwithstanding any other provision of this License, for material you\nadd to a covered work, you may (if authorized by the copyright holders of\nthat material) supplement the terms of this License with terms:\n\n    a) Disclaiming warranty or limiting liability differently from the\n    terms of sections 15 and 16 of this License; or\n\n    b) Requiring preservation of specified reasonable legal notices or\n    author attributions in that material or in the Appropriate Legal\n    Notices displayed by works containing it; or\n\n    c) Prohibiting misrepresentation of the origin of that material, or\n    requiring that modified versions of such material be marked in\n    reasonable ways as different from the original version; or\n\n    d) Limiting the use for publicity purposes of names of licensors or\n    authors of the material; or\n\n    e) Declining to grant rights under trademark law for use of some\n    trade names, trademarks, or service marks; or\n\n    f) Requiring indemnification of licensors and authors of that\n    material by anyone who conveys the material (or modified versions of\n    it) with contractual assumptions of liability to the recipient, for\n    any liability that these contractual assumptions directly impose on\n    those licensors and authors.\n\n  All other non-permissive additional terms are considered \"further\nrestrictions\" within the meaning of section 10.  If the Program as you\nreceived it, or any part of it, contains a notice stating that it is\ngoverned by this License along with a term that is a further\nrestriction, you may remove that term.  If a license document contains\na further restriction but permits relicensing or conveying under this\nLicense, you may add to a covered work material governed by the terms\nof that license document, provided that the further restriction does\nnot survive such relicensing or conveying.\n\n  If you add terms to a covered work in accord with this section, you\nmust place, in the relevant source files, a statement of the\nadditional terms that apply to those files, or a notice indicating\nwhere to find the applicable terms.\n\n  Additional terms, permissive or non-permissive, may be stated in the\nform of a separately written license, or stated as exceptions;\nthe above requirements apply either way.\n\n  8. Termination.\n\n  You may not propagate or modify a covered work except as expressly\nprovided under this License.  Any attempt otherwise to propagate or\nmodify it is void, and will automatically terminate your rights under\nthis License (including any patent licenses granted under the third\nparagraph of section 11).\n\n  However, if you cease all violation of this License, then your\nlicense from a particular copyright holder is reinstated (a)\nprovisionally, unless and until the copyright holder explicitly and\nfinally terminates your license, and (b) permanently, if the copyright\nholder fails to notify you of the violation by some reasonable means\nprior to 60 days after the cessation.\n\n  Moreover, your license from a particular copyright holder is\nreinstated permanently if the copyright holder notifies you of the\nviolation by some reasonable means, this is the first time you have\nreceived notice of violation of this License (for any work) from that\ncopyright holder, and you cure the violation prior to 30 days after\nyour receipt of the notice.\n\n  Termination of your rights under this section does not terminate the\nlicenses of parties who have received copies or rights from you under\nthis License.  If your rights have been terminated and not permanently\nreinstated, you do not qualify to receive new licenses for the same\nmaterial under section 10.\n\n  9. Acceptance Not Required for Having Copies.\n\n  You are not required to accept this License in order to receive or\nrun a copy of the Program.  Ancillary propagation of a covered work\noccurring solely as a consequence of using peer-to-peer transmission\nto receive a copy likewise does not require acceptance.  However,\nnothing other than this License grants you permission to propagate or\nmodify any covered work.  These actions infringe copyright if you do\nnot accept this License.  Therefore, by modifying or propagating a\ncovered work, you indicate your acceptance of this License to do so.\n\n  10. Automatic Licensing of Downstream Recipients.\n\n  Each time you convey a covered work, the recipient automatically\nreceives a license from the original licensors, to run, modify and\npropagate that work, subject to this License.  You are not responsible\nfor enforcing compliance by third parties with this License.\n\n  An \"entity transaction\" is a transaction transferring control of an\norganization, or substantially all assets of one, or subdividing an\norganization, or merging organizations.  If propagation of a covered\nwork results from an entity transaction, each party to that\ntransaction who receives a copy of the work also receives whatever\nlicenses to the work the party's predecessor in interest had or could\ngive under the previous paragraph, plus a right to possession of the\nCorresponding Source of the work from the predecessor in interest, if\nthe predecessor has it or can get it with reasonable efforts.\n\n  You may not impose any further restrictions on the exercise of the\nrights granted or affirmed under this License.  For example, you may\nnot impose a license fee, royalty, or other charge for exercise of\nrights granted under this License, and you may not initiate litigation\n(including a cross-claim or counterclaim in a lawsuit) alleging that\nany patent claim is infringed by making, using, selling, offering for\nsale, or importing the Program or any portion of it.\n\n  11. Patents.\n\n  A \"contributor\" is a copyright holder who authorizes use under this\nLicense of the Program or a work on which the Program is based.  The\nwork thus licensed is called the contributor's \"contributor version\".\n\n  A contributor's \"essential patent claims\" are all patent claims\nowned or controlled by the contributor, whether already acquired or\nhereafter acquired, that would be infringed by some manner, permitted\nby this License, of making, using, or selling its contributor version,\nbut do not include claims that would be infringed only as a\nconsequence of further modification of the contributor version.  For\npurposes of this definition, \"control\" includes the right to grant\npatent sublicenses in a manner consistent with the requirements of\nthis License.\n\n  Each contributor grants you a non-exclusive, worldwide, royalty-free\npatent license under the contributor's essential patent claims, to\nmake, use, sell, offer for sale, import and otherwise run, modify and\npropagate the contents of its contributor version.\n\n  In the following three paragraphs, a \"patent license\" is any express\nagreement or commitment, however denominated, not to enforce a patent\n(such as an express permission to practice a patent or covenant not to\nsue for patent infringement).  To \"grant\" such a patent license to a\nparty means to make such an agreement or commitment not to enforce a\npatent against the party.\n\n  If you convey a covered work, knowingly relying on a patent license,\nand the Corresponding Source of the work is not available for anyone\nto copy, free of charge and under the terms of this License, through a\npublicly available network server or other readily accessible means,\nthen you must either (1) cause the Corresponding Source to be so\navailable, or (2) arrange to deprive yourself of the benefit of the\npatent license for this particular work, or (3) arrange, in a manner\nconsistent with the requirements of this License, to extend the patent\nlicense to downstream recipients.  \"Knowingly relying\" means you have\nactual knowledge that, but for the patent license, your conveying the\ncovered work in a country, or your recipient's use of the covered work\nin a country, would infringe one or more identifiable patents in that\ncountry that you have reason to believe are valid.\n\n  If, pursuant to or in connection with a single transaction or\narrangement, you convey, or propagate by procuring conveyance of, a\ncovered work, and grant a patent license to some of the parties\nreceiving the covered work authorizing them to use, propagate, modify\nor convey a specific copy of the covered work, then the patent license\nyou grant is automatically extended to all recipients of the covered\nwork and works based on it.\n\n  A patent license is \"discriminatory\" if it does not include within\nthe scope of its coverage, prohibits the exercise of, or is\nconditioned on the non-exercise of one or more of the rights that are\nspecifically granted under this License.  You may not convey a covered\nwork if you are a party to an arrangement with a third party that is\nin the business of distributing software, under which you make payment\nto the third party based on the extent of your activity of conveying\nthe work, and under which the third party grants, to any of the\nparties who would receive the covered work from you, a discriminatory\npatent license (a) in connection with copies of the covered work\nconveyed by you (or copies made from those copies), or (b) primarily\nfor and in connection with specific products or compilations that\ncontain the covered work, unless you entered into that arrangement,\nor that patent license was granted, prior to 28 March 2007.\n\n  Nothing in this License shall be construed as excluding or limiting\nany implied license or other defenses to infringement that may\notherwise be available to you under applicable patent law.\n\n  12. No Surrender of Others' Freedom.\n\n  If conditions are imposed on you (whether by court order, agreement or\notherwise) that contradict the conditions of this License, they do not\nexcuse you from the conditions of this License.  If you cannot convey a\ncovered work so as to satisfy simultaneously your obligations under this\nLicense and any other pertinent obligations, then as a consequence you may\nnot convey it at all.  For example, if you agree to terms that obligate you\nto collect a royalty for further conveying from those to whom you convey\nthe Program, the only way you could satisfy both those terms and this\nLicense would be to refrain entirely from conveying the Program.\n\n  13. Use with the GNU Affero General Public License.\n\n  Notwithstanding any other provision of this License, you have\npermission to link or combine any covered work with a work licensed\nunder version 3 of the GNU Affero General Public License into a single\ncombined work, and to convey the resulting work.  The terms of this\nLicense will continue to apply to the part which is the covered work,\nbut the special requirements of the GNU Affero General Public License,\nsection 13, concerning interaction through a network will apply to the\ncombination as such.\n\n  14. Revised Versions of this License.\n\n  The Free Software Foundation may publish revised and/or new versions of\nthe GNU General Public License from time to time.  Such new versions will\nbe similar in spirit to the present version, but may differ in detail to\naddress new problems or concerns.\n\n  Each version is given a distinguishing version number.  If the\nProgram specifies that a certain numbered version of the GNU General\nPublic License \"or any later version\" applies to it, you have the\noption of following the terms and conditions either of that numbered\nversion or of any later version published by the Free Software\nFoundation.  If the Program does not specify a version number of the\nGNU General Public License, you may choose any version ever published\nby the Free Software Foundation.\n\n  If the Program specifies that a proxy can decide which future\nversions of the GNU General Public License can be used, that proxy's\npublic statement of acceptance of a version permanently authorizes you\nto choose that version for the Program.\n\n  Later license versions may give you additional or different\npermissions.  However, no additional obligations are imposed on any\nauthor or copyright holder as a result of your choosing to follow a\nlater version.\n\n  15. Disclaimer of Warranty.\n\n  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY\nAPPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT\nHOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY\nOF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,\nTHE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\nPURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM\nIS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF\nALL NECESSARY SERVICING, REPAIR OR CORRECTION.\n\n  16. Limitation of Liability.\n\n  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\nWILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS\nTHE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY\nGENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE\nUSE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF\nDATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD\nPARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),\nEVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF\nSUCH DAMAGES.\n\n  17. Interpretation of Sections 15 and 16.\n\n  If the disclaimer of warranty and limitation of liability provided\nabove cannot be given local legal effect according to their terms,\nreviewing courts shall apply local law that most closely approximates\nan absolute waiver of all civil liability in connection with the\nProgram, unless a warranty or assumption of liability accompanies a\ncopy of the Program in return for a fee.\n\n                     END OF TERMS AND CONDITIONS\n\n            How to Apply These Terms to Your New Programs\n\n  If you develop a new program, and you want it to be of the greatest\npossible use to the public, the best way to achieve this is to make it\nfree software which everyone can redistribute and change under these terms.\n\n  To do so, attach the following notices to the program.  It is safest\nto attach them to the start of each source file to most effectively\nstate the exclusion of warranty; and each file should have at least\nthe \"copyright\" line and a pointer to where the full notice is found.\n\n    <one line to give the program's name and a brief idea of what it does.>\n    Copyright (C) <year>  <name of author>\n\n    This program is free software: you can redistribute it and/or modify\n    it under the terms of the GNU General Public License as published by\n    the Free Software Foundation, either version 3 of the License, or\n    (at your option) any later version.\n\n    This program is distributed in the hope that it will be useful,\n    but WITHOUT ANY WARRANTY; without even the implied warranty of\n    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n    GNU General Public License for more details.\n\n    You should have received a copy of the GNU General Public License\n    along with this program.  If not, see <https://www.gnu.org/licenses/>.\n\nAlso add information on how to contact you by electronic and paper mail.\n\n  If the program does terminal interaction, make it output a short\nnotice like this when it starts in an interactive mode:\n\n    <program>  Copyright (C) <year>  <name of author>\n    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.\n    This is free software, and you are welcome to redistribute it\n    under certain conditions; type `show c' for details.\n\nThe hypothetical commands `show w' and `show c' should show the appropriate\nparts of the General Public License.  Of course, your program's commands\nmight be different; for a GUI interface, you would use an \"about box\".\n\n  You should also get your employer (if you work as a programmer) or school,\nif any, to sign a \"copyright disclaimer\" for the program, if necessary.\nFor more information on this, and how to apply and follow the GNU GPL, see\n<https://www.gnu.org/licenses/>.\n\n  The GNU General Public License does not permit incorporating your program\ninto proprietary programs.  If your program is a subroutine library, you\nmay consider it more useful to permit linking proprietary applications with\nthe library.  If this is what you want to do, use the GNU Lesser General\nPublic License instead of this License.  But first, please read\n<https://www.gnu.org/licenses/why-not-lgpl.html>.\n"
  },
  {
    "path": "README.md",
    "content": "# BBSHD/BBS02/TSDZ2 Open Source Firmware\n\n![GitHub all releases](https://img.shields.io/github/downloads/danielnilsson9/bbs-fw/total?style=for-the-badge)\n![GitHub release (latest by date including pre-releases)](https://img.shields.io/github/v/release/danielnilsson9/bbs-fw?include_prereleases&style=for-the-badge)\n![GitHub](https://img.shields.io/github/license/danielnilsson9/bbs-fw?style=for-the-badge)\n\nThis firmware is intended to replace the original Bafang firmware on the BBSHD/BBS02 motor controller. Almost all functionality of original firmware has been implemented and additional features have been added.\n\nThis firmware is compatible with all displays that works with the original Bafang firmware. A custom configuration tool is provided since BafangConfigTool is not compatible due to a different set of supported parameters.\n\nThe firmware is also compatible with the TongSheng TSDZ2 controller but requires a custom made cable in order to interface with Bafang compatible displays.\n\n⚠️ Warning: The firmware should NOT be flashed or configured while the eBike battery is charging!\n\n**Download**  \nhttps://github.com/danielnilsson9/bbshd-fw/releases\n\n**Install**  \nhttps://github.com/danielnilsson9/bbs-fw/wiki/Flash-Firmware-(BBS02-&-BBSHD)\n\n**Configure**  \nhttps://github.com/danielnilsson9/bbshd-fw/wiki/Configuration-Tool\n\n\nIf you find this project useful, consider sending a small [donation](https://www.paypal.com/donate/?business=LVAYFCMQYN8F4&no_recurring=0&item_name=BBSHD-FW&currency_code=USD) to fund further development.\n\n## Known Issues\n* ⚠️ Unstable on BBS02 controllers!\n\n## Highlights\n* ✅ A bit more power without hardware modifications! (max 33A). \n* ✅ No upper voltage limit in software, can by default run up to 63V (maximum rating of components).\n* ✅ Support lower voltage cutoff for use with e.g. 36V battery.\n* ✅ Smooth Throttle/PAS override.\n* ✅ Optional separate set of street legal & offroad assist levels which can be toggled by a key combination.\n* ✅ Support setting road speed limit per assist level.\n* ✅ Support setting cadence limit per assist level.\n* ✅ Support cruise assist levels (i.e. motor power without pedal or throttle input).\n* ✅ Thermal limiting gradual ramp down.\n* ✅ Low voltage gradual ramp down.\n* ✅ Voltage calibration for accurate LVC and low voltage ramp down.\n* ✅ Display motor/controller temperature on standard display.\n* ✅ Use of speed sensor is optional.\n\n![Config Tool](https://github.com/user-attachments/assets/1534c303-b25f-4fa4-8b37-5b74ade4a800)\n\n## Supported Hardware\n\n### BBSHD\n\nRevision | MCU          | Released    | Comment\n-------- | ------------ | ----------- | --------------------\nV1.4     | STC15W4K56S4 | ~2017       | V1.3 printed on PCB, sticker with 1.4.\nV1.5     | IAP15W4K61S4 | ~2019       | V1.4 printed on PCB, sticker with 1.5.\n\n### BBS02B\nThere are compatibility issues reported, this firmware is suspected to be incompatible with older BBS02 controllers.\nIf you have a newer BBS02B you are probably fine, if you have an older controller it might not be a good idea to flash this firmware.\n\nRevision | MCU          | Released    | Comment\n-------- | ------------ | ----------- | --------------------\nV1.?     | STC15F2K60S2 |             | Supported from BBS-FW version 1.1\nV1.?     | IAP15F2K61S2 |             | Supported from BBS-FW version 1.1\n\nBBS02A - No idea, not tested, not recommended to try unless you have an already bricked controller.\n\n### TSDZ2\nCompatible with TSDZ2A/B using the STM microcontroller (which is nearly all off them).\n\n### Displays and Controller \n\nOnly displays with the Bafang display protocol can work. \n\nAlso the controllers need to be those, that are officially designed by Bafang, respectively Tongshen. \n\nSome shops sell kits with their own controller.\n\n## Legal\n* Installing this firmware will void your warranty.\n* I cannot be held responsible for any injuries caused by the use of this firmware, use at your own risk.\n"
  },
  {
    "path": "drawings/pcb/bbshd.sch",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!DOCTYPE eagle SYSTEM \"eagle.dtd\">\n<eagle version=\"7.5.0\">\n<drawing>\n<settings>\n<setting alwaysvectorfont=\"no\"/>\n<setting verticaltext=\"up\"/>\n</settings>\n<grid distance=\"0.1\" unitdist=\"inch\" unit=\"inch\" style=\"lines\" multiple=\"1\" display=\"no\" altdistance=\"0.01\" altunitdist=\"inch\" altunit=\"inch\"/>\n<layers>\n<layer number=\"1\" name=\"Top\" color=\"4\" fill=\"1\" visible=\"no\" active=\"no\"/>\n<layer number=\"2\" name=\"Route2\" color=\"1\" fill=\"3\" visible=\"no\" active=\"no\"/>\n<layer number=\"3\" name=\"Route3\" color=\"4\" fill=\"3\" visible=\"no\" active=\"no\"/>\n<layer number=\"4\" name=\"Route4\" color=\"1\" fill=\"4\" visible=\"no\" active=\"no\"/>\n<layer number=\"5\" name=\"Route5\" color=\"4\" fill=\"4\" visible=\"no\" active=\"no\"/>\n<layer number=\"6\" name=\"Route6\" color=\"1\" fill=\"8\" visible=\"no\" active=\"no\"/>\n<layer number=\"7\" name=\"Route7\" color=\"4\" fill=\"8\" visible=\"no\" active=\"no\"/>\n<layer number=\"8\" name=\"Route8\" color=\"1\" fill=\"2\" visible=\"no\" active=\"no\"/>\n<layer number=\"9\" name=\"Route9\" color=\"4\" fill=\"2\" visible=\"no\" active=\"no\"/>\n<layer number=\"10\" name=\"Route10\" color=\"1\" fill=\"7\" visible=\"no\" active=\"no\"/>\n<layer number=\"11\" name=\"Route11\" color=\"4\" fill=\"7\" visible=\"no\" active=\"no\"/>\n<layer number=\"12\" name=\"Route12\" color=\"1\" fill=\"5\" visible=\"no\" active=\"no\"/>\n<layer number=\"13\" name=\"Route13\" color=\"4\" fill=\"5\" visible=\"no\" active=\"no\"/>\n<layer number=\"14\" name=\"Route14\" color=\"1\" fill=\"6\" visible=\"no\" active=\"no\"/>\n<layer number=\"15\" name=\"Route15\" color=\"4\" fill=\"6\" visible=\"no\" active=\"no\"/>\n<layer number=\"16\" name=\"Bottom\" color=\"1\" fill=\"1\" visible=\"no\" active=\"no\"/>\n<layer number=\"17\" name=\"Pads\" color=\"2\" fill=\"1\" visible=\"no\" active=\"no\"/>\n<layer number=\"18\" name=\"Vias\" color=\"2\" fill=\"1\" visible=\"no\" active=\"no\"/>\n<layer number=\"19\" name=\"Unrouted\" color=\"6\" fill=\"1\" visible=\"no\" active=\"no\"/>\n<layer number=\"20\" name=\"Dimension\" color=\"15\" fill=\"1\" visible=\"no\" active=\"no\"/>\n<layer number=\"21\" name=\"tPlace\" color=\"7\" fill=\"1\" visible=\"no\" active=\"no\"/>\n<layer number=\"22\" name=\"bPlace\" color=\"7\" fill=\"1\" visible=\"no\" active=\"no\"/>\n<layer number=\"23\" name=\"tOrigins\" color=\"15\" fill=\"1\" visible=\"no\" active=\"no\"/>\n<layer number=\"24\" name=\"bOrigins\" color=\"15\" fill=\"1\" visible=\"no\" active=\"no\"/>\n<layer number=\"25\" name=\"tNames\" color=\"7\" fill=\"1\" visible=\"no\" active=\"no\"/>\n<layer number=\"26\" name=\"bNames\" color=\"7\" fill=\"1\" visible=\"no\" active=\"no\"/>\n<layer number=\"27\" name=\"tValues\" color=\"7\" fill=\"1\" visible=\"no\" active=\"no\"/>\n<layer number=\"28\" name=\"bValues\" color=\"7\" fill=\"1\" visible=\"no\" active=\"no\"/>\n<layer number=\"29\" name=\"tStop\" color=\"7\" fill=\"3\" visible=\"no\" active=\"no\"/>\n<layer number=\"30\" name=\"bStop\" color=\"7\" fill=\"6\" visible=\"no\" active=\"no\"/>\n<layer number=\"31\" name=\"tCream\" color=\"7\" fill=\"4\" visible=\"no\" active=\"no\"/>\n<layer number=\"32\" name=\"bCream\" color=\"7\" fill=\"5\" visible=\"no\" active=\"no\"/>\n<layer number=\"33\" name=\"tFinish\" color=\"6\" fill=\"3\" visible=\"no\" active=\"no\"/>\n<layer number=\"34\" name=\"bFinish\" color=\"6\" fill=\"6\" visible=\"no\" active=\"no\"/>\n<layer number=\"35\" name=\"tGlue\" color=\"7\" fill=\"4\" visible=\"no\" active=\"no\"/>\n<layer number=\"36\" name=\"bGlue\" color=\"7\" fill=\"5\" visible=\"no\" active=\"no\"/>\n<layer number=\"37\" name=\"tTest\" color=\"7\" fill=\"1\" visible=\"no\" active=\"no\"/>\n<layer number=\"38\" name=\"bTest\" color=\"7\" fill=\"1\" visible=\"no\" active=\"no\"/>\n<layer number=\"39\" name=\"tKeepout\" color=\"4\" fill=\"11\" visible=\"no\" active=\"no\"/>\n<layer number=\"40\" name=\"bKeepout\" color=\"1\" fill=\"11\" visible=\"no\" active=\"no\"/>\n<layer number=\"41\" name=\"tRestrict\" color=\"4\" fill=\"10\" visible=\"no\" active=\"no\"/>\n<layer number=\"42\" name=\"bRestrict\" color=\"1\" fill=\"10\" visible=\"no\" active=\"no\"/>\n<layer number=\"43\" name=\"vRestrict\" color=\"2\" fill=\"10\" visible=\"no\" active=\"no\"/>\n<layer number=\"44\" name=\"Drills\" color=\"7\" fill=\"1\" visible=\"no\" active=\"no\"/>\n<layer number=\"45\" name=\"Holes\" color=\"7\" fill=\"1\" visible=\"no\" active=\"no\"/>\n<layer number=\"46\" name=\"Milling\" color=\"3\" fill=\"1\" visible=\"no\" active=\"no\"/>\n<layer number=\"47\" name=\"Measures\" color=\"7\" fill=\"1\" visible=\"no\" active=\"no\"/>\n<layer number=\"48\" name=\"Document\" color=\"7\" fill=\"1\" visible=\"no\" active=\"no\"/>\n<layer number=\"49\" name=\"Reference\" color=\"7\" fill=\"1\" visible=\"no\" active=\"no\"/>\n<layer number=\"51\" name=\"tDocu\" color=\"7\" fill=\"1\" visible=\"no\" active=\"no\"/>\n<layer number=\"52\" name=\"bDocu\" color=\"7\" fill=\"1\" visible=\"no\" active=\"no\"/>\n<layer number=\"90\" name=\"Modules\" color=\"5\" fill=\"1\" visible=\"yes\" active=\"yes\"/>\n<layer number=\"91\" name=\"Nets\" color=\"2\" fill=\"1\" visible=\"yes\" active=\"yes\"/>\n<layer number=\"92\" name=\"Busses\" color=\"1\" fill=\"1\" visible=\"yes\" active=\"yes\"/>\n<layer number=\"93\" name=\"Pins\" color=\"2\" fill=\"1\" visible=\"no\" active=\"yes\"/>\n<layer number=\"94\" name=\"Symbols\" color=\"4\" fill=\"1\" visible=\"yes\" active=\"yes\"/>\n<layer number=\"95\" name=\"Names\" color=\"7\" fill=\"1\" visible=\"yes\" active=\"yes\"/>\n<layer number=\"96\" name=\"Values\" color=\"7\" fill=\"1\" visible=\"yes\" active=\"yes\"/>\n<layer number=\"97\" name=\"Info\" color=\"7\" fill=\"1\" visible=\"yes\" active=\"yes\"/>\n<layer number=\"98\" name=\"Guide\" color=\"6\" fill=\"1\" visible=\"yes\" active=\"yes\"/>\n<layer number=\"99\" name=\"SpiceOrder\" color=\"5\" fill=\"1\" visible=\"yes\" active=\"yes\"/>\n</layers>\n<schematic xreflabel=\"%F%N/%S.%C%R\" xrefpart=\"/%S.%C%R\">\n<libraries>\n<library name=\"frames\">\n<description>&lt;b&gt;Frames for Sheet and Layout&lt;/b&gt;</description>\n<packages>\n</packages>\n<symbols>\n<symbol name=\"A4L-LOC\">\n<wire x1=\"256.54\" y1=\"3.81\" x2=\"256.54\" y2=\"8.89\" width=\"0.1016\" layer=\"94\"/>\n<wire x1=\"256.54\" y1=\"8.89\" x2=\"256.54\" y2=\"13.97\" width=\"0.1016\" layer=\"94\"/>\n<wire x1=\"256.54\" y1=\"13.97\" x2=\"256.54\" y2=\"19.05\" width=\"0.1016\" layer=\"94\"/>\n<wire x1=\"256.54\" y1=\"19.05\" x2=\"256.54\" y2=\"24.13\" width=\"0.1016\" layer=\"94\"/>\n<wire x1=\"161.29\" y1=\"3.81\" x2=\"161.29\" y2=\"24.13\" width=\"0.1016\" layer=\"94\"/>\n<wire x1=\"161.29\" y1=\"24.13\" x2=\"215.265\" y2=\"24.13\" width=\"0.1016\" layer=\"94\"/>\n<wire x1=\"215.265\" y1=\"24.13\" x2=\"256.54\" y2=\"24.13\" width=\"0.1016\" layer=\"94\"/>\n<wire x1=\"246.38\" y1=\"3.81\" x2=\"246.38\" y2=\"8.89\" width=\"0.1016\" layer=\"94\"/>\n<wire x1=\"246.38\" y1=\"8.89\" x2=\"256.54\" y2=\"8.89\" width=\"0.1016\" layer=\"94\"/>\n<wire x1=\"246.38\" y1=\"8.89\" x2=\"215.265\" y2=\"8.89\" width=\"0.1016\" layer=\"94\"/>\n<wire x1=\"215.265\" y1=\"8.89\" x2=\"215.265\" y2=\"3.81\" width=\"0.1016\" layer=\"94\"/>\n<wire x1=\"215.265\" y1=\"8.89\" x2=\"215.265\" y2=\"13.97\" width=\"0.1016\" layer=\"94\"/>\n<wire x1=\"215.265\" y1=\"13.97\" x2=\"256.54\" y2=\"13.97\" width=\"0.1016\" layer=\"94\"/>\n<wire x1=\"215.265\" y1=\"13.97\" x2=\"215.265\" y2=\"19.05\" width=\"0.1016\" layer=\"94\"/>\n<wire x1=\"215.265\" y1=\"19.05\" x2=\"256.54\" y2=\"19.05\" width=\"0.1016\" layer=\"94\"/>\n<wire x1=\"215.265\" y1=\"19.05\" x2=\"215.265\" y2=\"24.13\" width=\"0.1016\" layer=\"94\"/>\n<text x=\"217.17\" y=\"15.24\" size=\"2.54\" layer=\"94\">&gt;DRAWING_NAME</text>\n<text x=\"217.17\" y=\"10.16\" size=\"2.286\" layer=\"94\">&gt;LAST_DATE_TIME</text>\n<text x=\"230.505\" y=\"5.08\" size=\"2.54\" layer=\"94\">&gt;SHEET</text>\n<text x=\"216.916\" y=\"4.953\" size=\"2.54\" layer=\"94\">Sheet:</text>\n<frame x1=\"0\" y1=\"0\" x2=\"260.35\" y2=\"179.07\" columns=\"6\" rows=\"4\" layer=\"94\"/>\n</symbol>\n</symbols>\n<devicesets>\n<deviceset name=\"A4L-LOC\" prefix=\"FRAME\" uservalue=\"yes\">\n<description>&lt;b&gt;FRAME&lt;/b&gt;&lt;p&gt;\nDIN A4, landscape with location and doc. field</description>\n<gates>\n<gate name=\"G$1\" symbol=\"A4L-LOC\" x=\"0\" y=\"0\"/>\n</gates>\n<devices>\n<device name=\"\">\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n</devices>\n</deviceset>\n</devicesets>\n</library>\n<library name=\"pinhead\">\n<description>&lt;b&gt;Pin Header Connectors&lt;/b&gt;&lt;p&gt;\n&lt;author&gt;Created by librarian@cadsoft.de&lt;/author&gt;</description>\n<packages>\n<package name=\"1X06\">\n<description>&lt;b&gt;PIN HEADER&lt;/b&gt;</description>\n<wire x1=\"0.635\" y1=\"1.27\" x2=\"1.905\" y2=\"1.27\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"1.905\" y1=\"1.27\" x2=\"2.54\" y2=\"0.635\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.54\" y1=\"0.635\" x2=\"2.54\" y2=\"-0.635\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.54\" y1=\"-0.635\" x2=\"1.905\" y2=\"-1.27\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.54\" y1=\"0.635\" x2=\"3.175\" y2=\"1.27\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"3.175\" y1=\"1.27\" x2=\"4.445\" y2=\"1.27\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"4.445\" y1=\"1.27\" x2=\"5.08\" y2=\"0.635\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"5.08\" y1=\"0.635\" x2=\"5.08\" y2=\"-0.635\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"5.08\" y1=\"-0.635\" x2=\"4.445\" y2=\"-1.27\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"4.445\" y1=\"-1.27\" x2=\"3.175\" y2=\"-1.27\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"3.175\" y1=\"-1.27\" x2=\"2.54\" y2=\"-0.635\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-2.54\" y1=\"0.635\" x2=\"-1.905\" y2=\"1.27\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-1.905\" y1=\"1.27\" x2=\"-0.635\" y2=\"1.27\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-0.635\" y1=\"1.27\" x2=\"0\" y2=\"0.635\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"0\" y1=\"0.635\" x2=\"0\" y2=\"-0.635\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"0\" y1=\"-0.635\" x2=\"-0.635\" y2=\"-1.27\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-0.635\" y1=\"-1.27\" x2=\"-1.905\" y2=\"-1.27\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-1.905\" y1=\"-1.27\" x2=\"-2.54\" y2=\"-0.635\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"0.635\" y1=\"1.27\" x2=\"0\" y2=\"0.635\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"0\" y1=\"-0.635\" x2=\"0.635\" y2=\"-1.27\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"1.905\" y1=\"-1.27\" x2=\"0.635\" y2=\"-1.27\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-6.985\" y1=\"1.27\" x2=\"-5.715\" y2=\"1.27\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-5.715\" y1=\"1.27\" x2=\"-5.08\" y2=\"0.635\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-5.08\" y1=\"0.635\" x2=\"-5.08\" y2=\"-0.635\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-5.08\" y1=\"-0.635\" x2=\"-5.715\" y2=\"-1.27\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-5.08\" y1=\"0.635\" x2=\"-4.445\" y2=\"1.27\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-4.445\" y1=\"1.27\" x2=\"-3.175\" y2=\"1.27\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-3.175\" y1=\"1.27\" x2=\"-2.54\" y2=\"0.635\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-2.54\" y1=\"0.635\" x2=\"-2.54\" y2=\"-0.635\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-2.54\" y1=\"-0.635\" x2=\"-3.175\" y2=\"-1.27\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-3.175\" y1=\"-1.27\" x2=\"-4.445\" y2=\"-1.27\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-4.445\" y1=\"-1.27\" x2=\"-5.08\" y2=\"-0.635\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-7.62\" y1=\"0.635\" x2=\"-7.62\" y2=\"-0.635\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-6.985\" y1=\"1.27\" x2=\"-7.62\" y2=\"0.635\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-7.62\" y1=\"-0.635\" x2=\"-6.985\" y2=\"-1.27\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-5.715\" y1=\"-1.27\" x2=\"-6.985\" y2=\"-1.27\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"5.715\" y1=\"1.27\" x2=\"6.985\" y2=\"1.27\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"6.985\" y1=\"1.27\" x2=\"7.62\" y2=\"0.635\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"7.62\" y1=\"0.635\" x2=\"7.62\" y2=\"-0.635\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"7.62\" y1=\"-0.635\" x2=\"6.985\" y2=\"-1.27\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"5.715\" y1=\"1.27\" x2=\"5.08\" y2=\"0.635\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"5.08\" y1=\"-0.635\" x2=\"5.715\" y2=\"-1.27\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"6.985\" y1=\"-1.27\" x2=\"5.715\" y2=\"-1.27\" width=\"0.1524\" layer=\"21\"/>\n<pad name=\"1\" x=\"-6.35\" y=\"0\" drill=\"1.016\" shape=\"long\" rot=\"R90\"/>\n<pad name=\"2\" x=\"-3.81\" y=\"0\" drill=\"1.016\" shape=\"long\" rot=\"R90\"/>\n<pad name=\"3\" x=\"-1.27\" y=\"0\" drill=\"1.016\" shape=\"long\" rot=\"R90\"/>\n<pad name=\"4\" x=\"1.27\" y=\"0\" drill=\"1.016\" shape=\"long\" rot=\"R90\"/>\n<pad name=\"5\" x=\"3.81\" y=\"0\" drill=\"1.016\" shape=\"long\" rot=\"R90\"/>\n<pad name=\"6\" x=\"6.35\" y=\"0\" drill=\"1.016\" shape=\"long\" rot=\"R90\"/>\n<text x=\"-7.6962\" y=\"1.8288\" size=\"1.27\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-7.62\" y=\"-3.175\" size=\"1.27\" layer=\"27\">&gt;VALUE</text>\n<rectangle x1=\"3.556\" y1=\"-0.254\" x2=\"4.064\" y2=\"0.254\" layer=\"51\"/>\n<rectangle x1=\"1.016\" y1=\"-0.254\" x2=\"1.524\" y2=\"0.254\" layer=\"51\"/>\n<rectangle x1=\"-1.524\" y1=\"-0.254\" x2=\"-1.016\" y2=\"0.254\" layer=\"51\"/>\n<rectangle x1=\"-4.064\" y1=\"-0.254\" x2=\"-3.556\" y2=\"0.254\" layer=\"51\"/>\n<rectangle x1=\"-6.604\" y1=\"-0.254\" x2=\"-6.096\" y2=\"0.254\" layer=\"51\"/>\n<rectangle x1=\"6.096\" y1=\"-0.254\" x2=\"6.604\" y2=\"0.254\" layer=\"51\"/>\n</package>\n<package name=\"1X06/90\">\n<description>&lt;b&gt;PIN HEADER&lt;/b&gt;</description>\n<wire x1=\"-7.62\" y1=\"-1.905\" x2=\"-5.08\" y2=\"-1.905\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-5.08\" y1=\"-1.905\" x2=\"-5.08\" y2=\"0.635\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-5.08\" y1=\"0.635\" x2=\"-7.62\" y2=\"0.635\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-7.62\" y1=\"0.635\" x2=\"-7.62\" y2=\"-1.905\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-6.35\" y1=\"6.985\" x2=\"-6.35\" y2=\"1.27\" width=\"0.762\" layer=\"21\"/>\n<wire x1=\"-5.08\" y1=\"-1.905\" x2=\"-2.54\" y2=\"-1.905\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-2.54\" y1=\"-1.905\" x2=\"-2.54\" y2=\"0.635\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-2.54\" y1=\"0.635\" x2=\"-5.08\" y2=\"0.635\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-3.81\" y1=\"6.985\" x2=\"-3.81\" y2=\"1.27\" width=\"0.762\" layer=\"21\"/>\n<wire x1=\"-2.54\" y1=\"-1.905\" x2=\"0\" y2=\"-1.905\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"0\" y1=\"-1.905\" x2=\"0\" y2=\"0.635\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"0\" y1=\"0.635\" x2=\"-2.54\" y2=\"0.635\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-1.27\" y1=\"6.985\" x2=\"-1.27\" y2=\"1.27\" width=\"0.762\" layer=\"21\"/>\n<wire x1=\"0\" y1=\"-1.905\" x2=\"2.54\" y2=\"-1.905\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.54\" y1=\"-1.905\" x2=\"2.54\" y2=\"0.635\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.54\" y1=\"0.635\" x2=\"0\" y2=\"0.635\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"1.27\" y1=\"6.985\" x2=\"1.27\" y2=\"1.27\" width=\"0.762\" layer=\"21\"/>\n<wire x1=\"2.54\" y1=\"-1.905\" x2=\"5.08\" y2=\"-1.905\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"5.08\" y1=\"-1.905\" x2=\"5.08\" y2=\"0.635\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"5.08\" y1=\"0.635\" x2=\"2.54\" y2=\"0.635\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"3.81\" y1=\"6.985\" x2=\"3.81\" y2=\"1.27\" width=\"0.762\" layer=\"21\"/>\n<wire x1=\"5.08\" y1=\"-1.905\" x2=\"7.62\" y2=\"-1.905\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"7.62\" y1=\"-1.905\" x2=\"7.62\" y2=\"0.635\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"7.62\" y1=\"0.635\" x2=\"5.08\" y2=\"0.635\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"6.35\" y1=\"6.985\" x2=\"6.35\" y2=\"1.27\" width=\"0.762\" layer=\"21\"/>\n<pad name=\"1\" x=\"-6.35\" y=\"-3.81\" drill=\"1.016\" shape=\"long\" rot=\"R90\"/>\n<pad name=\"2\" x=\"-3.81\" y=\"-3.81\" drill=\"1.016\" shape=\"long\" rot=\"R90\"/>\n<pad name=\"3\" x=\"-1.27\" y=\"-3.81\" drill=\"1.016\" shape=\"long\" rot=\"R90\"/>\n<pad name=\"4\" x=\"1.27\" y=\"-3.81\" drill=\"1.016\" shape=\"long\" rot=\"R90\"/>\n<pad name=\"5\" x=\"3.81\" y=\"-3.81\" drill=\"1.016\" shape=\"long\" rot=\"R90\"/>\n<pad name=\"6\" x=\"6.35\" y=\"-3.81\" drill=\"1.016\" shape=\"long\" rot=\"R90\"/>\n<text x=\"-8.255\" y=\"-3.81\" size=\"1.27\" layer=\"25\" ratio=\"10\" rot=\"R90\">&gt;NAME</text>\n<text x=\"9.525\" y=\"-3.81\" size=\"1.27\" layer=\"27\" rot=\"R90\">&gt;VALUE</text>\n<rectangle x1=\"-6.731\" y1=\"0.635\" x2=\"-5.969\" y2=\"1.143\" layer=\"21\"/>\n<rectangle x1=\"-4.191\" y1=\"0.635\" x2=\"-3.429\" y2=\"1.143\" layer=\"21\"/>\n<rectangle x1=\"-1.651\" y1=\"0.635\" x2=\"-0.889\" y2=\"1.143\" layer=\"21\"/>\n<rectangle x1=\"0.889\" y1=\"0.635\" x2=\"1.651\" y2=\"1.143\" layer=\"21\"/>\n<rectangle x1=\"3.429\" y1=\"0.635\" x2=\"4.191\" y2=\"1.143\" layer=\"21\"/>\n<rectangle x1=\"5.969\" y1=\"0.635\" x2=\"6.731\" y2=\"1.143\" layer=\"21\"/>\n<rectangle x1=\"-6.731\" y1=\"-2.921\" x2=\"-5.969\" y2=\"-1.905\" layer=\"21\"/>\n<rectangle x1=\"-4.191\" y1=\"-2.921\" x2=\"-3.429\" y2=\"-1.905\" layer=\"21\"/>\n<rectangle x1=\"-1.651\" y1=\"-2.921\" x2=\"-0.889\" y2=\"-1.905\" layer=\"21\"/>\n<rectangle x1=\"0.889\" y1=\"-2.921\" x2=\"1.651\" y2=\"-1.905\" layer=\"21\"/>\n<rectangle x1=\"3.429\" y1=\"-2.921\" x2=\"4.191\" y2=\"-1.905\" layer=\"21\"/>\n<rectangle x1=\"5.969\" y1=\"-2.921\" x2=\"6.731\" y2=\"-1.905\" layer=\"21\"/>\n</package>\n<package name=\"1X04\">\n<description>&lt;b&gt;PIN HEADER&lt;/b&gt;</description>\n<wire x1=\"0\" y1=\"0.635\" x2=\"0.635\" y2=\"1.27\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"0.635\" y1=\"1.27\" x2=\"1.905\" y2=\"1.27\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"1.905\" y1=\"1.27\" x2=\"2.54\" y2=\"0.635\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.54\" y1=\"0.635\" x2=\"2.54\" y2=\"-0.635\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.54\" y1=\"-0.635\" x2=\"1.905\" y2=\"-1.27\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"1.905\" y1=\"-1.27\" x2=\"0.635\" y2=\"-1.27\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"0.635\" y1=\"-1.27\" x2=\"0\" y2=\"-0.635\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-4.445\" y1=\"1.27\" x2=\"-3.175\" y2=\"1.27\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-3.175\" y1=\"1.27\" x2=\"-2.54\" y2=\"0.635\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-2.54\" y1=\"0.635\" x2=\"-2.54\" y2=\"-0.635\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-2.54\" y1=\"-0.635\" x2=\"-3.175\" y2=\"-1.27\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-2.54\" y1=\"0.635\" x2=\"-1.905\" y2=\"1.27\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-1.905\" y1=\"1.27\" x2=\"-0.635\" y2=\"1.27\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-0.635\" y1=\"1.27\" x2=\"0\" y2=\"0.635\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"0\" y1=\"0.635\" x2=\"0\" y2=\"-0.635\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"0\" y1=\"-0.635\" x2=\"-0.635\" y2=\"-1.27\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-0.635\" y1=\"-1.27\" x2=\"-1.905\" y2=\"-1.27\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-1.905\" y1=\"-1.27\" x2=\"-2.54\" y2=\"-0.635\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-5.08\" y1=\"0.635\" x2=\"-5.08\" y2=\"-0.635\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-4.445\" y1=\"1.27\" x2=\"-5.08\" y2=\"0.635\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-5.08\" y1=\"-0.635\" x2=\"-4.445\" y2=\"-1.27\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-3.175\" y1=\"-1.27\" x2=\"-4.445\" y2=\"-1.27\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"3.175\" y1=\"1.27\" x2=\"4.445\" y2=\"1.27\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"4.445\" y1=\"1.27\" x2=\"5.08\" y2=\"0.635\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"5.08\" y1=\"0.635\" x2=\"5.08\" y2=\"-0.635\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"5.08\" y1=\"-0.635\" x2=\"4.445\" y2=\"-1.27\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"3.175\" y1=\"1.27\" x2=\"2.54\" y2=\"0.635\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.54\" y1=\"-0.635\" x2=\"3.175\" y2=\"-1.27\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"4.445\" y1=\"-1.27\" x2=\"3.175\" y2=\"-1.27\" width=\"0.1524\" layer=\"21\"/>\n<pad name=\"1\" x=\"-3.81\" y=\"0\" drill=\"1.016\" shape=\"long\" rot=\"R90\"/>\n<pad name=\"2\" x=\"-1.27\" y=\"0\" drill=\"1.016\" shape=\"long\" rot=\"R90\"/>\n<pad name=\"3\" x=\"1.27\" y=\"0\" drill=\"1.016\" shape=\"long\" rot=\"R90\"/>\n<pad name=\"4\" x=\"3.81\" y=\"0\" drill=\"1.016\" shape=\"long\" rot=\"R90\"/>\n<text x=\"-5.1562\" y=\"1.8288\" size=\"1.27\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-5.08\" y=\"-3.175\" size=\"1.27\" layer=\"27\">&gt;VALUE</text>\n<rectangle x1=\"1.016\" y1=\"-0.254\" x2=\"1.524\" y2=\"0.254\" layer=\"51\"/>\n<rectangle x1=\"-1.524\" y1=\"-0.254\" x2=\"-1.016\" y2=\"0.254\" layer=\"51\"/>\n<rectangle x1=\"-4.064\" y1=\"-0.254\" x2=\"-3.556\" y2=\"0.254\" layer=\"51\"/>\n<rectangle x1=\"3.556\" y1=\"-0.254\" x2=\"4.064\" y2=\"0.254\" layer=\"51\"/>\n</package>\n<package name=\"1X04/90\">\n<description>&lt;b&gt;PIN HEADER&lt;/b&gt;</description>\n<wire x1=\"-5.08\" y1=\"-1.905\" x2=\"-2.54\" y2=\"-1.905\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-2.54\" y1=\"-1.905\" x2=\"-2.54\" y2=\"0.635\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-2.54\" y1=\"0.635\" x2=\"-5.08\" y2=\"0.635\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-5.08\" y1=\"0.635\" x2=\"-5.08\" y2=\"-1.905\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-3.81\" y1=\"6.985\" x2=\"-3.81\" y2=\"1.27\" width=\"0.762\" layer=\"21\"/>\n<wire x1=\"-2.54\" y1=\"-1.905\" x2=\"0\" y2=\"-1.905\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"0\" y1=\"-1.905\" x2=\"0\" y2=\"0.635\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"0\" y1=\"0.635\" x2=\"-2.54\" y2=\"0.635\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-1.27\" y1=\"6.985\" x2=\"-1.27\" y2=\"1.27\" width=\"0.762\" layer=\"21\"/>\n<wire x1=\"0\" y1=\"-1.905\" x2=\"2.54\" y2=\"-1.905\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.54\" y1=\"-1.905\" x2=\"2.54\" y2=\"0.635\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.54\" y1=\"0.635\" x2=\"0\" y2=\"0.635\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"1.27\" y1=\"6.985\" x2=\"1.27\" y2=\"1.27\" width=\"0.762\" layer=\"21\"/>\n<wire x1=\"2.54\" y1=\"-1.905\" x2=\"5.08\" y2=\"-1.905\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"5.08\" y1=\"-1.905\" x2=\"5.08\" y2=\"0.635\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"5.08\" y1=\"0.635\" x2=\"2.54\" y2=\"0.635\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"3.81\" y1=\"6.985\" x2=\"3.81\" y2=\"1.27\" width=\"0.762\" layer=\"21\"/>\n<pad name=\"1\" x=\"-3.81\" y=\"-3.81\" drill=\"1.016\" shape=\"long\" rot=\"R90\"/>\n<pad name=\"2\" x=\"-1.27\" y=\"-3.81\" drill=\"1.016\" shape=\"long\" rot=\"R90\"/>\n<pad name=\"3\" x=\"1.27\" y=\"-3.81\" drill=\"1.016\" shape=\"long\" rot=\"R90\"/>\n<pad name=\"4\" x=\"3.81\" y=\"-3.81\" drill=\"1.016\" shape=\"long\" rot=\"R90\"/>\n<text x=\"-5.715\" y=\"-3.81\" size=\"1.27\" layer=\"25\" ratio=\"10\" rot=\"R90\">&gt;NAME</text>\n<text x=\"6.985\" y=\"-4.445\" size=\"1.27\" layer=\"27\" rot=\"R90\">&gt;VALUE</text>\n<rectangle x1=\"-4.191\" y1=\"0.635\" x2=\"-3.429\" y2=\"1.143\" layer=\"21\"/>\n<rectangle x1=\"-1.651\" y1=\"0.635\" x2=\"-0.889\" y2=\"1.143\" layer=\"21\"/>\n<rectangle x1=\"0.889\" y1=\"0.635\" x2=\"1.651\" y2=\"1.143\" layer=\"21\"/>\n<rectangle x1=\"3.429\" y1=\"0.635\" x2=\"4.191\" y2=\"1.143\" layer=\"21\"/>\n<rectangle x1=\"-4.191\" y1=\"-2.921\" x2=\"-3.429\" y2=\"-1.905\" layer=\"21\"/>\n<rectangle x1=\"-1.651\" y1=\"-2.921\" x2=\"-0.889\" y2=\"-1.905\" layer=\"21\"/>\n<rectangle x1=\"0.889\" y1=\"-2.921\" x2=\"1.651\" y2=\"-1.905\" layer=\"21\"/>\n<rectangle x1=\"3.429\" y1=\"-2.921\" x2=\"4.191\" y2=\"-1.905\" layer=\"21\"/>\n</package>\n<package name=\"1X03\">\n<description>&lt;b&gt;PIN HEADER&lt;/b&gt;</description>\n<wire x1=\"-3.175\" y1=\"1.27\" x2=\"-1.905\" y2=\"1.27\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-1.905\" y1=\"1.27\" x2=\"-1.27\" y2=\"0.635\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-1.27\" y1=\"0.635\" x2=\"-1.27\" y2=\"-0.635\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-1.27\" y1=\"-0.635\" x2=\"-1.905\" y2=\"-1.27\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-1.27\" y1=\"0.635\" x2=\"-0.635\" y2=\"1.27\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-0.635\" y1=\"1.27\" x2=\"0.635\" y2=\"1.27\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"0.635\" y1=\"1.27\" x2=\"1.27\" y2=\"0.635\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"1.27\" y1=\"0.635\" x2=\"1.27\" y2=\"-0.635\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"1.27\" y1=\"-0.635\" x2=\"0.635\" y2=\"-1.27\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"0.635\" y1=\"-1.27\" x2=\"-0.635\" y2=\"-1.27\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-0.635\" y1=\"-1.27\" x2=\"-1.27\" y2=\"-0.635\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-3.81\" y1=\"0.635\" x2=\"-3.81\" y2=\"-0.635\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-3.175\" y1=\"1.27\" x2=\"-3.81\" y2=\"0.635\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-3.81\" y1=\"-0.635\" x2=\"-3.175\" y2=\"-1.27\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-1.905\" y1=\"-1.27\" x2=\"-3.175\" y2=\"-1.27\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"1.27\" y1=\"0.635\" x2=\"1.905\" y2=\"1.27\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"1.905\" y1=\"1.27\" x2=\"3.175\" y2=\"1.27\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"3.175\" y1=\"1.27\" x2=\"3.81\" y2=\"0.635\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"3.81\" y1=\"0.635\" x2=\"3.81\" y2=\"-0.635\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"3.81\" y1=\"-0.635\" x2=\"3.175\" y2=\"-1.27\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"3.175\" y1=\"-1.27\" x2=\"1.905\" y2=\"-1.27\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"1.905\" y1=\"-1.27\" x2=\"1.27\" y2=\"-0.635\" width=\"0.1524\" layer=\"21\"/>\n<pad name=\"1\" x=\"-2.54\" y=\"0\" drill=\"1.016\" shape=\"long\" rot=\"R90\"/>\n<pad name=\"2\" x=\"0\" y=\"0\" drill=\"1.016\" shape=\"long\" rot=\"R90\"/>\n<pad name=\"3\" x=\"2.54\" y=\"0\" drill=\"1.016\" shape=\"long\" rot=\"R90\"/>\n<text x=\"-3.8862\" y=\"1.8288\" size=\"1.27\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-3.81\" y=\"-3.175\" size=\"1.27\" layer=\"27\">&gt;VALUE</text>\n<rectangle x1=\"-0.254\" y1=\"-0.254\" x2=\"0.254\" y2=\"0.254\" layer=\"51\"/>\n<rectangle x1=\"-2.794\" y1=\"-0.254\" x2=\"-2.286\" y2=\"0.254\" layer=\"51\"/>\n<rectangle x1=\"2.286\" y1=\"-0.254\" x2=\"2.794\" y2=\"0.254\" layer=\"51\"/>\n</package>\n<package name=\"1X03/90\">\n<description>&lt;b&gt;PIN HEADER&lt;/b&gt;</description>\n<wire x1=\"-3.81\" y1=\"-1.905\" x2=\"-1.27\" y2=\"-1.905\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-1.27\" y1=\"-1.905\" x2=\"-1.27\" y2=\"0.635\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-1.27\" y1=\"0.635\" x2=\"-3.81\" y2=\"0.635\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-3.81\" y1=\"0.635\" x2=\"-3.81\" y2=\"-1.905\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-2.54\" y1=\"6.985\" x2=\"-2.54\" y2=\"1.27\" width=\"0.762\" layer=\"21\"/>\n<wire x1=\"-1.27\" y1=\"-1.905\" x2=\"1.27\" y2=\"-1.905\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"1.27\" y1=\"-1.905\" x2=\"1.27\" y2=\"0.635\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"1.27\" y1=\"0.635\" x2=\"-1.27\" y2=\"0.635\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"0\" y1=\"6.985\" x2=\"0\" y2=\"1.27\" width=\"0.762\" layer=\"21\"/>\n<wire x1=\"1.27\" y1=\"-1.905\" x2=\"3.81\" y2=\"-1.905\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"3.81\" y1=\"-1.905\" x2=\"3.81\" y2=\"0.635\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"3.81\" y1=\"0.635\" x2=\"1.27\" y2=\"0.635\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.54\" y1=\"6.985\" x2=\"2.54\" y2=\"1.27\" width=\"0.762\" layer=\"21\"/>\n<pad name=\"1\" x=\"-2.54\" y=\"-3.81\" drill=\"1.016\" shape=\"long\" rot=\"R90\"/>\n<pad name=\"2\" x=\"0\" y=\"-3.81\" drill=\"1.016\" shape=\"long\" rot=\"R90\"/>\n<pad name=\"3\" x=\"2.54\" y=\"-3.81\" drill=\"1.016\" shape=\"long\" rot=\"R90\"/>\n<text x=\"-4.445\" y=\"-3.81\" size=\"1.27\" layer=\"25\" ratio=\"10\" rot=\"R90\">&gt;NAME</text>\n<text x=\"5.715\" y=\"-3.81\" size=\"1.27\" layer=\"27\" rot=\"R90\">&gt;VALUE</text>\n<rectangle x1=\"-2.921\" y1=\"0.635\" x2=\"-2.159\" y2=\"1.143\" layer=\"21\"/>\n<rectangle x1=\"-0.381\" y1=\"0.635\" x2=\"0.381\" y2=\"1.143\" layer=\"21\"/>\n<rectangle x1=\"2.159\" y1=\"0.635\" x2=\"2.921\" y2=\"1.143\" layer=\"21\"/>\n<rectangle x1=\"-2.921\" y1=\"-2.921\" x2=\"-2.159\" y2=\"-1.905\" layer=\"21\"/>\n<rectangle x1=\"-0.381\" y1=\"-2.921\" x2=\"0.381\" y2=\"-1.905\" layer=\"21\"/>\n<rectangle x1=\"2.159\" y1=\"-2.921\" x2=\"2.921\" y2=\"-1.905\" layer=\"21\"/>\n</package>\n</packages>\n<symbols>\n<symbol name=\"PINHD6\">\n<wire x1=\"-6.35\" y1=\"-7.62\" x2=\"1.27\" y2=\"-7.62\" width=\"0.4064\" layer=\"94\"/>\n<wire x1=\"1.27\" y1=\"-7.62\" x2=\"1.27\" y2=\"10.16\" width=\"0.4064\" layer=\"94\"/>\n<wire x1=\"1.27\" y1=\"10.16\" x2=\"-6.35\" y2=\"10.16\" width=\"0.4064\" layer=\"94\"/>\n<wire x1=\"-6.35\" y1=\"10.16\" x2=\"-6.35\" y2=\"-7.62\" width=\"0.4064\" layer=\"94\"/>\n<text x=\"-6.35\" y=\"10.795\" size=\"1.778\" layer=\"95\">&gt;NAME</text>\n<text x=\"-6.35\" y=\"-10.16\" size=\"1.778\" layer=\"96\">&gt;VALUE</text>\n<pin name=\"1\" x=\"-2.54\" y=\"7.62\" visible=\"pad\" length=\"short\" direction=\"pas\" function=\"dot\"/>\n<pin name=\"2\" x=\"-2.54\" y=\"5.08\" visible=\"pad\" length=\"short\" direction=\"pas\" function=\"dot\"/>\n<pin name=\"3\" x=\"-2.54\" y=\"2.54\" visible=\"pad\" length=\"short\" direction=\"pas\" function=\"dot\"/>\n<pin name=\"4\" x=\"-2.54\" y=\"0\" visible=\"pad\" length=\"short\" direction=\"pas\" function=\"dot\"/>\n<pin name=\"5\" x=\"-2.54\" y=\"-2.54\" visible=\"pad\" length=\"short\" direction=\"pas\" function=\"dot\"/>\n<pin name=\"6\" x=\"-2.54\" y=\"-5.08\" visible=\"pad\" length=\"short\" direction=\"pas\" function=\"dot\"/>\n</symbol>\n<symbol name=\"PINHD4\">\n<wire x1=\"-6.35\" y1=\"-5.08\" x2=\"1.27\" y2=\"-5.08\" width=\"0.4064\" layer=\"94\"/>\n<wire x1=\"1.27\" y1=\"-5.08\" x2=\"1.27\" y2=\"7.62\" width=\"0.4064\" layer=\"94\"/>\n<wire x1=\"1.27\" y1=\"7.62\" x2=\"-6.35\" y2=\"7.62\" width=\"0.4064\" layer=\"94\"/>\n<wire x1=\"-6.35\" y1=\"7.62\" x2=\"-6.35\" y2=\"-5.08\" width=\"0.4064\" layer=\"94\"/>\n<text x=\"-6.35\" y=\"8.255\" size=\"1.778\" layer=\"95\">&gt;NAME</text>\n<text x=\"-6.35\" y=\"-7.62\" size=\"1.778\" layer=\"96\">&gt;VALUE</text>\n<pin name=\"1\" x=\"-2.54\" y=\"5.08\" visible=\"pad\" length=\"short\" direction=\"pas\" function=\"dot\"/>\n<pin name=\"2\" x=\"-2.54\" y=\"2.54\" visible=\"pad\" length=\"short\" direction=\"pas\" function=\"dot\"/>\n<pin name=\"3\" x=\"-2.54\" y=\"0\" visible=\"pad\" length=\"short\" direction=\"pas\" function=\"dot\"/>\n<pin name=\"4\" x=\"-2.54\" y=\"-2.54\" visible=\"pad\" length=\"short\" direction=\"pas\" function=\"dot\"/>\n</symbol>\n<symbol name=\"PINHD3\">\n<wire x1=\"-6.35\" y1=\"-5.08\" x2=\"1.27\" y2=\"-5.08\" width=\"0.4064\" layer=\"94\"/>\n<wire x1=\"1.27\" y1=\"-5.08\" x2=\"1.27\" y2=\"5.08\" width=\"0.4064\" layer=\"94\"/>\n<wire x1=\"1.27\" y1=\"5.08\" x2=\"-6.35\" y2=\"5.08\" width=\"0.4064\" layer=\"94\"/>\n<wire x1=\"-6.35\" y1=\"5.08\" x2=\"-6.35\" y2=\"-5.08\" width=\"0.4064\" layer=\"94\"/>\n<text x=\"-6.35\" y=\"5.715\" size=\"1.778\" layer=\"95\">&gt;NAME</text>\n<text x=\"-6.35\" y=\"-7.62\" size=\"1.778\" layer=\"96\">&gt;VALUE</text>\n<pin name=\"1\" x=\"-2.54\" y=\"2.54\" visible=\"pad\" length=\"short\" direction=\"pas\" function=\"dot\"/>\n<pin name=\"2\" x=\"-2.54\" y=\"0\" visible=\"pad\" length=\"short\" direction=\"pas\" function=\"dot\"/>\n<pin name=\"3\" x=\"-2.54\" y=\"-2.54\" visible=\"pad\" length=\"short\" direction=\"pas\" function=\"dot\"/>\n</symbol>\n</symbols>\n<devicesets>\n<deviceset name=\"PINHD-1X6\" prefix=\"JP\" uservalue=\"yes\">\n<description>&lt;b&gt;PIN HEADER&lt;/b&gt;</description>\n<gates>\n<gate name=\"A\" symbol=\"PINHD6\" x=\"0\" y=\"-2.54\"/>\n</gates>\n<devices>\n<device name=\"\" package=\"1X06\">\n<connects>\n<connect gate=\"A\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"A\" pin=\"2\" pad=\"2\"/>\n<connect gate=\"A\" pin=\"3\" pad=\"3\"/>\n<connect gate=\"A\" pin=\"4\" pad=\"4\"/>\n<connect gate=\"A\" pin=\"5\" pad=\"5\"/>\n<connect gate=\"A\" pin=\"6\" pad=\"6\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"/90\" package=\"1X06/90\">\n<connects>\n<connect gate=\"A\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"A\" pin=\"2\" pad=\"2\"/>\n<connect gate=\"A\" pin=\"3\" pad=\"3\"/>\n<connect gate=\"A\" pin=\"4\" pad=\"4\"/>\n<connect gate=\"A\" pin=\"5\" pad=\"5\"/>\n<connect gate=\"A\" pin=\"6\" pad=\"6\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n</devices>\n</deviceset>\n<deviceset name=\"PINHD-1X4\" prefix=\"JP\" uservalue=\"yes\">\n<description>&lt;b&gt;PIN HEADER&lt;/b&gt;</description>\n<gates>\n<gate name=\"A\" symbol=\"PINHD4\" x=\"0\" y=\"0\"/>\n</gates>\n<devices>\n<device name=\"\" package=\"1X04\">\n<connects>\n<connect gate=\"A\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"A\" pin=\"2\" pad=\"2\"/>\n<connect gate=\"A\" pin=\"3\" pad=\"3\"/>\n<connect gate=\"A\" pin=\"4\" pad=\"4\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"/90\" package=\"1X04/90\">\n<connects>\n<connect gate=\"A\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"A\" pin=\"2\" pad=\"2\"/>\n<connect gate=\"A\" pin=\"3\" pad=\"3\"/>\n<connect gate=\"A\" pin=\"4\" pad=\"4\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n</devices>\n</deviceset>\n<deviceset name=\"PINHD-1X3\" prefix=\"JP\" uservalue=\"yes\">\n<description>&lt;b&gt;PIN HEADER&lt;/b&gt;</description>\n<gates>\n<gate name=\"A\" symbol=\"PINHD3\" x=\"0\" y=\"0\"/>\n</gates>\n<devices>\n<device name=\"\" package=\"1X03\">\n<connects>\n<connect gate=\"A\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"A\" pin=\"2\" pad=\"2\"/>\n<connect gate=\"A\" pin=\"3\" pad=\"3\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"/90\" package=\"1X03/90\">\n<connects>\n<connect gate=\"A\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"A\" pin=\"2\" pad=\"2\"/>\n<connect gate=\"A\" pin=\"3\" pad=\"3\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n</devices>\n</deviceset>\n</devicesets>\n</library>\n<library name=\"supply1\">\n<description>&lt;b&gt;Supply Symbols&lt;/b&gt;&lt;p&gt;\n GND, VCC, 0V, +5V, -5V, etc.&lt;p&gt;\n Please keep in mind, that these devices are necessary for the\n automatic wiring of the supply signals.&lt;p&gt;\n The pin name defined in the symbol is identical to the net which is to be wired automatically.&lt;p&gt;\n In this library the device names are the same as the pin names of the symbols, therefore the correct signal names appear next to the supply symbols in the schematic.&lt;p&gt;\n &lt;author&gt;Created by librarian@cadsoft.de&lt;/author&gt;</description>\n<packages>\n</packages>\n<symbols>\n<symbol name=\"+5V\">\n<wire x1=\"1.27\" y1=\"-1.905\" x2=\"0\" y2=\"0\" width=\"0.254\" layer=\"94\"/>\n<wire x1=\"0\" y1=\"0\" x2=\"-1.27\" y2=\"-1.905\" width=\"0.254\" layer=\"94\"/>\n<text x=\"-2.54\" y=\"-5.08\" size=\"1.778\" layer=\"96\" rot=\"R90\">&gt;VALUE</text>\n<pin name=\"+5V\" x=\"0\" y=\"-2.54\" visible=\"off\" length=\"short\" direction=\"sup\" rot=\"R90\"/>\n</symbol>\n<symbol name=\"GND\">\n<wire x1=\"-1.905\" y1=\"0\" x2=\"1.905\" y2=\"0\" width=\"0.254\" layer=\"94\"/>\n<text x=\"-2.54\" y=\"-2.54\" size=\"1.778\" layer=\"96\">&gt;VALUE</text>\n<pin name=\"GND\" x=\"0\" y=\"2.54\" visible=\"off\" length=\"short\" direction=\"sup\" rot=\"R270\"/>\n</symbol>\n<symbol name=\"+3V3\">\n<wire x1=\"1.27\" y1=\"-1.905\" x2=\"0\" y2=\"0\" width=\"0.254\" layer=\"94\"/>\n<wire x1=\"0\" y1=\"0\" x2=\"-1.27\" y2=\"-1.905\" width=\"0.254\" layer=\"94\"/>\n<text x=\"-2.54\" y=\"-5.08\" size=\"1.778\" layer=\"96\" rot=\"R90\">&gt;VALUE</text>\n<pin name=\"+3V3\" x=\"0\" y=\"-2.54\" visible=\"off\" length=\"short\" direction=\"sup\" rot=\"R90\"/>\n</symbol>\n<symbol name=\"VCC\">\n<wire x1=\"1.27\" y1=\"-1.905\" x2=\"0\" y2=\"0\" width=\"0.254\" layer=\"94\"/>\n<wire x1=\"0\" y1=\"0\" x2=\"-1.27\" y2=\"-1.905\" width=\"0.254\" layer=\"94\"/>\n<text x=\"-2.54\" y=\"-2.54\" size=\"1.778\" layer=\"96\" rot=\"R90\">&gt;VALUE</text>\n<pin name=\"VCC\" x=\"0\" y=\"-2.54\" visible=\"off\" length=\"short\" direction=\"sup\" rot=\"R90\"/>\n</symbol>\n</symbols>\n<devicesets>\n<deviceset name=\"+5V\" prefix=\"P+\">\n<description>&lt;b&gt;SUPPLY SYMBOL&lt;/b&gt;</description>\n<gates>\n<gate name=\"1\" symbol=\"+5V\" x=\"0\" y=\"0\"/>\n</gates>\n<devices>\n<device name=\"\">\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n</devices>\n</deviceset>\n<deviceset name=\"GND\" prefix=\"GND\">\n<description>&lt;b&gt;SUPPLY SYMBOL&lt;/b&gt;</description>\n<gates>\n<gate name=\"1\" symbol=\"GND\" x=\"0\" y=\"0\"/>\n</gates>\n<devices>\n<device name=\"\">\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n</devices>\n</deviceset>\n<deviceset name=\"+3V3\" prefix=\"+3V3\">\n<description>&lt;b&gt;SUPPLY SYMBOL&lt;/b&gt;</description>\n<gates>\n<gate name=\"G$1\" symbol=\"+3V3\" x=\"0\" y=\"0\"/>\n</gates>\n<devices>\n<device name=\"\">\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n</devices>\n</deviceset>\n<deviceset name=\"VCC\" prefix=\"P+\">\n<description>&lt;b&gt;SUPPLY SYMBOL&lt;/b&gt;</description>\n<gates>\n<gate name=\"VCC\" symbol=\"VCC\" x=\"0\" y=\"0\"/>\n</gates>\n<devices>\n<device name=\"\">\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n</devices>\n</deviceset>\n</devicesets>\n</library>\n<library name=\"diode\">\n<description>&lt;b&gt;Diodes&lt;/b&gt;&lt;p&gt;\nBased on the following sources:\n&lt;ul&gt;\n&lt;li&gt;Motorola : www.onsemi.com\n&lt;li&gt;Fairchild : www.fairchildsemi.com\n&lt;li&gt;Philips : www.semiconductors.com\n&lt;li&gt;Vishay : www.vishay.de\n&lt;/ul&gt;\n&lt;author&gt;Created by librarian@cadsoft.de&lt;/author&gt;</description>\n<packages>\n<package name=\"SOD323_ST\">\n<description>&lt;b&gt;SOD-323&lt;/b&gt;&lt;p&gt;\nSource: www.st.com, BAT60J.pdf</description>\n<wire x1=\"-0.85\" y1=\"0.55\" x2=\"0.85\" y2=\"0.55\" width=\"0.1016\" layer=\"21\"/>\n<wire x1=\"0.85\" y1=\"0.55\" x2=\"0.85\" y2=\"-0.55\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"0.85\" y1=\"-0.55\" x2=\"-0.85\" y2=\"-0.55\" width=\"0.1016\" layer=\"21\"/>\n<wire x1=\"-0.85\" y1=\"-0.55\" x2=\"-0.85\" y2=\"0.55\" width=\"0.1016\" layer=\"51\"/>\n<smd name=\"C\" x=\"-1.25\" y=\"0\" dx=\"0.8\" dy=\"0.6\" layer=\"1\"/>\n<smd name=\"A\" x=\"1.25\" y=\"0\" dx=\"0.8\" dy=\"0.6\" layer=\"1\"/>\n<text x=\"-1.65\" y=\"0.75\" size=\"1.27\" layer=\"25\">&gt;NAME</text>\n<text x=\"-1.65\" y=\"-2\" size=\"1.27\" layer=\"27\">&gt;VALUE</text>\n<rectangle x1=\"-0.65\" y1=\"-0.55\" x2=\"-0.05\" y2=\"0.55\" layer=\"21\"/>\n<rectangle x1=\"-1.35\" y1=\"-0.15\" x2=\"-0.8\" y2=\"0.15\" layer=\"51\"/>\n<rectangle x1=\"0.8\" y1=\"-0.15\" x2=\"1.35\" y2=\"0.15\" layer=\"51\"/>\n<rectangle x1=\"-0.85\" y1=\"-0.55\" x2=\"-0.05\" y2=\"0.55\" layer=\"51\"/>\n</package>\n</packages>\n<symbols>\n<symbol name=\"SCHOTTKY\">\n<wire x1=\"-1.27\" y1=\"-1.27\" x2=\"1.27\" y2=\"0\" width=\"0.254\" layer=\"94\"/>\n<wire x1=\"1.27\" y1=\"0\" x2=\"-1.27\" y2=\"1.27\" width=\"0.254\" layer=\"94\"/>\n<wire x1=\"1.905\" y1=\"1.27\" x2=\"1.27\" y2=\"1.27\" width=\"0.254\" layer=\"94\"/>\n<wire x1=\"1.27\" y1=\"1.27\" x2=\"1.27\" y2=\"0\" width=\"0.254\" layer=\"94\"/>\n<wire x1=\"-1.27\" y1=\"1.27\" x2=\"-1.27\" y2=\"-1.27\" width=\"0.254\" layer=\"94\"/>\n<wire x1=\"1.27\" y1=\"0\" x2=\"1.27\" y2=\"-1.27\" width=\"0.254\" layer=\"94\"/>\n<wire x1=\"1.905\" y1=\"1.27\" x2=\"1.905\" y2=\"1.016\" width=\"0.254\" layer=\"94\"/>\n<wire x1=\"1.27\" y1=\"-1.27\" x2=\"0.635\" y2=\"-1.27\" width=\"0.254\" layer=\"94\"/>\n<wire x1=\"0.635\" y1=\"-1.016\" x2=\"0.635\" y2=\"-1.27\" width=\"0.254\" layer=\"94\"/>\n<text x=\"-2.286\" y=\"1.905\" size=\"1.778\" layer=\"95\">&gt;NAME</text>\n<text x=\"-2.286\" y=\"-3.429\" size=\"1.778\" layer=\"96\">&gt;VALUE</text>\n<pin name=\"A\" x=\"-2.54\" y=\"0\" visible=\"off\" length=\"short\" direction=\"pas\"/>\n<pin name=\"C\" x=\"2.54\" y=\"0\" visible=\"off\" length=\"short\" direction=\"pas\" rot=\"R180\"/>\n</symbol>\n</symbols>\n<devicesets>\n<deviceset name=\"BAT60J\" prefix=\"D\">\n<description>&lt;b&gt;Schottky barrier diode&lt;/b&gt;&lt;p&gt;\nSource: www.st.com, BAT60J.pdf</description>\n<gates>\n<gate name=\"G$1\" symbol=\"SCHOTTKY\" x=\"0\" y=\"0\"/>\n</gates>\n<devices>\n<device name=\"\" package=\"SOD323_ST\">\n<connects>\n<connect gate=\"G$1\" pin=\"A\" pad=\"A\"/>\n<connect gate=\"G$1\" pin=\"C\" pad=\"C\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n</devices>\n</deviceset>\n</devicesets>\n</library>\n<library name=\"rcl\">\n<description>&lt;b&gt;Resistors, Capacitors, Inductors&lt;/b&gt;&lt;p&gt;\nBased on the previous libraries:\n&lt;ul&gt;\n&lt;li&gt;r.lbr\n&lt;li&gt;cap.lbr \n&lt;li&gt;cap-fe.lbr\n&lt;li&gt;captant.lbr\n&lt;li&gt;polcap.lbr\n&lt;li&gt;ipc-smd.lbr\n&lt;/ul&gt;\nAll SMD packages are defined according to the IPC specifications and  CECC&lt;p&gt;\n&lt;author&gt;Created by librarian@cadsoft.de&lt;/author&gt;&lt;p&gt;\n&lt;p&gt;\nfor Electrolyt Capacitors see also :&lt;p&gt;\nwww.bccomponents.com &lt;p&gt;\nwww.panasonic.com&lt;p&gt;\nwww.kemet.com&lt;p&gt;\nhttp://www.secc.co.jp/pdf/os_e/2004/e_os_all.pdf &lt;b&gt;(SANYO)&lt;/b&gt;\n&lt;p&gt;\nfor trimmer refence see : &lt;u&gt;www.electrospec-inc.com/cross_references/trimpotcrossref.asp&lt;/u&gt;&lt;p&gt;\n\n&lt;table border=0 cellspacing=0 cellpadding=0 width=\"100%\" cellpaddding=0&gt;\n&lt;tr valign=\"top\"&gt;\n\n&lt;! &lt;td width=\"10\"&gt;&amp;nbsp;&lt;/td&gt;\n&lt;td width=\"90%\"&gt;\n\n&lt;b&gt;&lt;font color=\"#0000FF\" size=\"4\"&gt;TRIM-POT CROSS REFERENCE&lt;/font&gt;&lt;/b&gt;\n&lt;P&gt;\n&lt;TABLE BORDER=0 CELLSPACING=1 CELLPADDING=2&gt;\n  &lt;TR&gt;\n    &lt;TD COLSPAN=8&gt;\n      &lt;FONT SIZE=3 FACE=ARIAL&gt;&lt;B&gt;RECTANGULAR MULTI-TURN&lt;/B&gt;&lt;/FONT&gt;\n    &lt;/TD&gt;\n  &lt;/TR&gt;\n  &lt;TR&gt;\n    &lt;TD ALIGN=CENTER&gt;\n      &lt;B&gt;\n      &lt;FONT SIZE=3 FACE=ARIAL color=\"#FF0000\"&gt;BOURNS&lt;/FONT&gt;\n      &lt;/B&gt;\n    &lt;/TD&gt;\n    &lt;TD ALIGN=CENTER&gt;\n      &lt;B&gt;\n      &lt;FONT SIZE=3 FACE=ARIAL color=\"#FF0000\"&gt;BI&amp;nbsp;TECH&lt;/FONT&gt;\n      &lt;/B&gt;\n    &lt;/TD&gt;\n    &lt;TD ALIGN=CENTER&gt;\n      &lt;B&gt;\n      &lt;FONT SIZE=3 FACE=ARIAL color=\"#FF0000\"&gt;DALE-VISHAY&lt;/FONT&gt;\n      &lt;/B&gt;\n    &lt;/TD&gt;\n    &lt;TD ALIGN=CENTER&gt;\n      &lt;B&gt;\n      &lt;FONT SIZE=3 FACE=ARIAL color=\"#FF0000\"&gt;PHILIPS/MEPCO&lt;/FONT&gt;\n      &lt;/B&gt;\n    &lt;/TD&gt;\n    &lt;TD ALIGN=CENTER&gt;\n      &lt;B&gt;\n      &lt;FONT SIZE=3 FACE=ARIAL color=\"#FF0000\"&gt;MURATA&lt;/FONT&gt;\n      &lt;/B&gt;\n    &lt;/TD&gt;\n    &lt;TD ALIGN=CENTER&gt;\n      &lt;B&gt;\n      &lt;FONT SIZE=3 FACE=ARIAL color=\"#FF0000\"&gt;PANASONIC&lt;/FONT&gt;\n      &lt;/B&gt;\n    &lt;/TD&gt;\n    &lt;TD ALIGN=CENTER&gt;\n      &lt;B&gt;\n      &lt;FONT SIZE=3 FACE=ARIAL color=\"#FF0000\"&gt;SPECTROL&lt;/FONT&gt;\n      &lt;/B&gt;\n    &lt;/TD&gt;\n    &lt;TD ALIGN=CENTER&gt;\n      &lt;B&gt;\n      &lt;FONT SIZE=3 FACE=ARIAL color=\"#FF0000\"&gt;MILSPEC&lt;/FONT&gt;\n      &lt;/B&gt;\n    &lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;\n  &lt;/TR&gt;\n  &lt;TR&gt;\n    &lt;TD BGCOLOR=\"#cccccc\" ALIGN=CENTER&gt;&lt;FONT FACE=ARIAL SIZE=3 &gt;\n      3005P&lt;BR&gt;\n      3006P&lt;BR&gt;\n      3006W&lt;BR&gt;\n      3006Y&lt;BR&gt;\n      3009P&lt;BR&gt;\n      3009W&lt;BR&gt;\n      3009Y&lt;BR&gt;\n      3057J&lt;BR&gt;\n      3057L&lt;BR&gt;\n      3057P&lt;BR&gt;\n      3057Y&lt;BR&gt;\n      3059J&lt;BR&gt;\n      3059L&lt;BR&gt;\n      3059P&lt;BR&gt;\n      3059Y&lt;BR&gt;&lt;/FONT&gt;\n    &lt;/TD&gt;\n    &lt;TD BGCOLOR=\"#cccccc\" ALIGN=CENTER&gt;&lt;FONT FACE=ARIAL SIZE=3&gt;\n      -&lt;BR&gt;\n      89P&lt;BR&gt;\n      89W&lt;BR&gt;\n      89X&lt;BR&gt;\n      89PH&lt;BR&gt;\n      76P&lt;BR&gt;\n      89XH&lt;BR&gt;\n      78SLT&lt;BR&gt;\n      78L&amp;nbsp;ALT&lt;BR&gt;\n      56P&amp;nbsp;ALT&lt;BR&gt;\n      78P&amp;nbsp;ALT&lt;BR&gt;\n      T8S&lt;BR&gt;\n      78L&lt;BR&gt;\n      56P&lt;BR&gt;\n      78P&lt;BR&gt;&lt;/FONT&gt;\n    &lt;/TD&gt;\n    &lt;TD BGCOLOR=\"#cccccc\" ALIGN=CENTER&gt;&lt;FONT FACE=ARIAL SIZE=3&gt;\n      -&lt;BR&gt;\n      T18/784&lt;BR&gt;\n      783&lt;BR&gt;\n      781&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      2199&lt;BR&gt;\n      1697/1897&lt;BR&gt;\n      1680/1880&lt;BR&gt;\n      2187&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;&lt;/FONT&gt;\n    &lt;/TD&gt;\n    &lt;TD BGCOLOR=\"#cccccc\" ALIGN=CENTER&gt;&lt;FONT FACE=ARIAL SIZE=3&gt;\n      -&lt;BR&gt;\n      8035EKP/CT20/RJ-20P&lt;BR&gt;\n      -&lt;BR&gt;\n      RJ-20X&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      1211L&lt;BR&gt;\n      8012EKQ&amp;nbsp;ALT&lt;BR&gt;\n      8012EKR&amp;nbsp;ALT&lt;BR&gt;\n      1211P&lt;BR&gt;\n      8012EKJ&lt;BR&gt;\n      8012EKL&lt;BR&gt;\n      8012EKQ&lt;BR&gt;\n      8012EKR&lt;BR&gt;&lt;/FONT&gt;\n    &lt;/TD&gt;\n    &lt;TD BGCOLOR=\"#cccccc\" ALIGN=CENTER&gt;&lt;FONT FACE=ARIAL SIZE=3&gt;\n      -&lt;BR&gt;\n      2101P&lt;BR&gt;\n      2101W&lt;BR&gt;\n      2101Y&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      2102L&lt;BR&gt;\n      2102S&lt;BR&gt;\n      2102Y&lt;BR&gt;&lt;/FONT&gt;\n    &lt;/TD&gt;\n    &lt;TD BGCOLOR=\"#cccccc\" ALIGN=CENTER&gt;&lt;FONT FACE=ARIAL SIZE=3&gt;\n      -&lt;BR&gt;\n      EVMCOG&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;&lt;/FONT&gt;\n    &lt;/TD&gt;\n    &lt;TD BGCOLOR=\"#cccccc\" ALIGN=CENTER&gt;&lt;FONT FACE=ARIAL SIZE=3&gt;\n      -&lt;BR&gt;\n      43P&lt;BR&gt;\n      43W&lt;BR&gt;\n      43Y&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      40L&lt;BR&gt;\n      40P&lt;BR&gt;\n      40Y&lt;BR&gt;\n      70Y-T602&lt;BR&gt;\n      70L&lt;BR&gt;\n      70P&lt;BR&gt;\n      70Y&lt;BR&gt;&lt;/FONT&gt;\n    &lt;/TD&gt;\n    &lt;TD BGCOLOR=\"#cccccc\" ALIGN=CENTER&gt;&lt;FONT FACE=ARIAL SIZE=3&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      RT/RTR12&lt;BR&gt;\n      RT/RTR12&lt;BR&gt;\n      RT/RTR12&lt;BR&gt;\n      -&lt;BR&gt;\n      RJ/RJR12&lt;BR&gt;\n      RJ/RJR12&lt;BR&gt;\n      RJ/RJR12&lt;BR&gt;&lt;/FONT&gt;\n    &lt;/TD&gt;\n  &lt;/TR&gt;\n  &lt;TR&gt;\n    &lt;TD COLSPAN=8&gt;&amp;nbsp;\n    &lt;/TD&gt;\n  &lt;/TR&gt;\n  &lt;TR&gt;\n    &lt;TD COLSPAN=8&gt;\n      &lt;FONT SIZE=4 FACE=ARIAL&gt;&lt;B&gt;SQUARE MULTI-TURN&lt;/B&gt;&lt;/FONT&gt;\n    &lt;/TD&gt;\n  &lt;/TR&gt;\n  &lt;TR&gt;\n   &lt;TD ALIGN=CENTER&gt;\n      &lt;FONT SIZE=3 FACE=ARIAL&gt;&lt;B&gt;BOURN&lt;/B&gt;&lt;/FONT&gt;\n    &lt;/TD&gt;\n    &lt;TD ALIGN=CENTER&gt;\n      &lt;FONT SIZE=3 FACE=ARIAL&gt;&lt;B&gt;BI&amp;nbsp;TECH&lt;/B&gt;&lt;/FONT&gt;\n    &lt;/TD&gt;\n    &lt;TD ALIGN=CENTER&gt;\n      &lt;FONT SIZE=3 FACE=ARIAL&gt;&lt;B&gt;DALE-VISHAY&lt;/B&gt;&lt;/FONT&gt;\n    &lt;/TD&gt;\n    &lt;TD ALIGN=CENTER&gt;\n      &lt;FONT SIZE=3 FACE=ARIAL&gt;&lt;B&gt;PHILIPS/MEPCO&lt;/B&gt;&lt;/FONT&gt;\n    &lt;/TD&gt;\n    &lt;TD ALIGN=CENTER&gt;\n      &lt;FONT SIZE=3 FACE=ARIAL&gt;&lt;B&gt;MURATA&lt;/B&gt;&lt;/FONT&gt;\n    &lt;/TD&gt;\n    &lt;TD ALIGN=CENTER&gt;\n      &lt;FONT SIZE=3 FACE=ARIAL&gt;&lt;B&gt;PANASONIC&lt;/B&gt;&lt;/FONT&gt;\n    &lt;/TD&gt;\n    &lt;TD ALIGN=CENTER&gt;\n      &lt;FONT SIZE=3 FACE=ARIAL&gt;&lt;B&gt;SPECTROL&lt;/B&gt;&lt;/FONT&gt;\n    &lt;/TD&gt;\n    &lt;TD ALIGN=CENTER&gt;\n      &lt;FONT SIZE=3 FACE=ARIAL&gt;&lt;B&gt;MILSPEC&lt;/B&gt;&lt;/FONT&gt;\n    &lt;/TD&gt;\n  &lt;/TR&gt;\n  &lt;TR&gt;\n    &lt;TD BGCOLOR=\"#cccccc\" ALIGN=CENTER&gt;&lt;FONT FACE=ARIAL SIZE=3&gt;\n      3250L&lt;BR&gt;\n      3250P&lt;BR&gt;\n      3250W&lt;BR&gt;\n      3250X&lt;BR&gt;\n      3252P&lt;BR&gt;\n      3252W&lt;BR&gt;\n      3252X&lt;BR&gt;\n      3260P&lt;BR&gt;\n      3260W&lt;BR&gt;\n      3260X&lt;BR&gt;\n      3262P&lt;BR&gt;\n      3262W&lt;BR&gt;\n      3262X&lt;BR&gt;\n      3266P&lt;BR&gt;\n      3266W&lt;BR&gt;\n      3266X&lt;BR&gt;\n      3290H&lt;BR&gt;\n      3290P&lt;BR&gt;\n      3290W&lt;BR&gt;\n      3292P&lt;BR&gt;\n      3292W&lt;BR&gt;\n      3292X&lt;BR&gt;\n      3296P&lt;BR&gt;\n      3296W&lt;BR&gt;\n      3296X&lt;BR&gt;\n      3296Y&lt;BR&gt;\n      3296Z&lt;BR&gt;\n      3299P&lt;BR&gt;\n      3299W&lt;BR&gt;\n      3299X&lt;BR&gt;\n      3299Y&lt;BR&gt;\n      3299Z&lt;BR&gt;&lt;/FONT&gt;\n    &lt;/TD&gt;\n    &lt;TD BGCOLOR=\"#cccccc\" ALIGN=CENTER&gt;&lt;FONT FACE=ARIAL SIZE=3&gt;\n      -&lt;BR&gt;\n      66P&amp;nbsp;ALT&lt;BR&gt;\n      66W&amp;nbsp;ALT&lt;BR&gt;\n      66X&amp;nbsp;ALT&lt;BR&gt;\n      66P&amp;nbsp;ALT&lt;BR&gt;\n      66W&amp;nbsp;ALT&lt;BR&gt;\n      66X&amp;nbsp;ALT&lt;BR&gt;\n      -&lt;BR&gt;\n      64W&amp;nbsp;ALT&lt;BR&gt;\n      -&lt;BR&gt;\n      64P&amp;nbsp;ALT&lt;BR&gt;\n      64W&amp;nbsp;ALT&lt;BR&gt;\n      64X&amp;nbsp;ALT&lt;BR&gt;\n      64P&lt;BR&gt;\n      64W&lt;BR&gt;\n      64X&lt;BR&gt;\n      66X&amp;nbsp;ALT&lt;BR&gt;\n      66P&amp;nbsp;ALT&lt;BR&gt;\n      66W&amp;nbsp;ALT&lt;BR&gt;\n      66P&lt;BR&gt;\n      66W&lt;BR&gt;\n      66X&lt;BR&gt;\n      67P&lt;BR&gt;\n      67W&lt;BR&gt;\n      67X&lt;BR&gt;\n      67Y&lt;BR&gt;\n      67Z&lt;BR&gt;\n      68P&lt;BR&gt;\n      68W&lt;BR&gt;\n      68X&lt;BR&gt;\n      67Y&amp;nbsp;ALT&lt;BR&gt;\n      67Z&amp;nbsp;ALT&lt;BR&gt;&lt;/FONT&gt;\n    &lt;/TD&gt;\n    &lt;TD BGCOLOR=\"#cccccc\" ALIGN=CENTER&gt;&lt;FONT FACE=ARIAL SIZE=3&gt;\n      5050&lt;BR&gt;\n      5091&lt;BR&gt;\n      5080&lt;BR&gt;\n      5087&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      T63YB&lt;BR&gt;\n      T63XB&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      5887&lt;BR&gt;\n      5891&lt;BR&gt;\n      5880&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      T93Z&lt;BR&gt;\n      T93YA&lt;BR&gt;\n      T93XA&lt;BR&gt;\n      T93YB&lt;BR&gt;\n      T93XB&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;&lt;/FONT&gt;\n    &lt;/TD&gt;\n    &lt;TD BGCOLOR=\"#cccccc\" ALIGN=CENTER&gt;&lt;FONT FACE=ARIAL SIZE=3&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      8026EKP&lt;BR&gt;\n      8026EKW&lt;BR&gt;\n      8026EKM&lt;BR&gt;\n      8026EKP&lt;BR&gt;\n      8026EKB&lt;BR&gt;\n      8026EKM&lt;BR&gt;\n      1309X&lt;BR&gt;\n      1309P&lt;BR&gt;\n      1309W&lt;BR&gt;\n      8024EKP&lt;BR&gt;\n      8024EKW&lt;BR&gt;\n      8024EKN&lt;BR&gt;\n      RJ-9P/CT9P&lt;BR&gt;\n      RJ-9W&lt;BR&gt;\n      RJ-9X&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;&lt;/FONT&gt;\n    &lt;/TD&gt;\n    &lt;TD BGCOLOR=\"#cccccc\" ALIGN=CENTER&gt;&lt;FONT FACE=ARIAL SIZE=3&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      3103P&lt;BR&gt;\n      3103Y&lt;BR&gt;\n      3103Z&lt;BR&gt;\n      3103P&lt;BR&gt;\n      3103Y&lt;BR&gt;\n      3103Z&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      3105P/3106P&lt;BR&gt;\n      3105W/3106W&lt;BR&gt;\n      3105X/3106X&lt;BR&gt;\n      3105Y/3106Y&lt;BR&gt;\n      3105Z/3105Z&lt;BR&gt;\n      3102P&lt;BR&gt;\n      3102W&lt;BR&gt;\n      3102X&lt;BR&gt;\n      3102Y&lt;BR&gt;\n      3102Z&lt;BR&gt;&lt;/FONT&gt;\n    &lt;/TD&gt;\n    &lt;TD BGCOLOR=\"#cccccc\" ALIGN=CENTER&gt;&lt;FONT FACE=ARIAL SIZE=3&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      EVMCBG&lt;BR&gt;\n      EVMCCG&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;&lt;/FONT&gt;\n    &lt;/TD&gt;\n    &lt;TD BGCOLOR=\"#cccccc\" ALIGN=CENTER&gt;&lt;FONT FACE=ARIAL SIZE=3&gt;\n      55-1-X&lt;BR&gt;\n      55-4-X&lt;BR&gt;\n      55-3-X&lt;BR&gt;\n      55-2-X&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      50-2-X&lt;BR&gt;\n      50-4-X&lt;BR&gt;\n      50-3-X&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      64P&lt;BR&gt;\n      64W&lt;BR&gt;\n      64X&lt;BR&gt;\n      64Y&lt;BR&gt;\n      64Z&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;&lt;/FONT&gt;\n    &lt;/TD&gt;\n    &lt;TD BGCOLOR=\"#cccccc\" ALIGN=CENTER&gt;&lt;FONT FACE=ARIAL SIZE=3&gt;\n      RT/RTR22&lt;BR&gt;\n      RT/RTR22&lt;BR&gt;\n      RT/RTR22&lt;BR&gt;\n      RT/RTR22&lt;BR&gt;\n      RJ/RJR22&lt;BR&gt;\n      RJ/RJR22&lt;BR&gt;\n      RJ/RJR22&lt;BR&gt;\n      RT/RTR26&lt;BR&gt;\n      RT/RTR26&lt;BR&gt;\n      RT/RTR26&lt;BR&gt;\n      RJ/RJR26&lt;BR&gt;\n      RJ/RJR26&lt;BR&gt;\n      RJ/RJR26&lt;BR&gt;\n      RJ/RJR26&lt;BR&gt;\n      RJ/RJR26&lt;BR&gt;\n      RJ/RJR26&lt;BR&gt;\n      RT/RTR24&lt;BR&gt;\n      RT/RTR24&lt;BR&gt;\n      RT/RTR24&lt;BR&gt;\n      RJ/RJR24&lt;BR&gt;\n      RJ/RJR24&lt;BR&gt;\n      RJ/RJR24&lt;BR&gt;\n      RJ/RJR24&lt;BR&gt;\n      RJ/RJR24&lt;BR&gt;\n      RJ/RJR24&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;&lt;/FONT&gt;\n    &lt;/TD&gt;\n  &lt;/TR&gt;\n  &lt;TR&gt;\n    &lt;TD COLSPAN=8&gt;&amp;nbsp;\n    &lt;/TD&gt;\n  &lt;/TR&gt;\n  &lt;TR&gt;\n    &lt;TD COLSPAN=8&gt;\n      &lt;FONT SIZE=4 FACE=ARIAL&gt;&lt;B&gt;SINGLE TURN&lt;/B&gt;&lt;/FONT&gt;\n    &lt;/TD&gt;\n  &lt;/TR&gt;\n  &lt;TR&gt;\n    &lt;TD ALIGN=CENTER&gt;\n      &lt;FONT SIZE=3 FACE=ARIAL&gt;&lt;B&gt;BOURN&lt;/B&gt;&lt;/FONT&gt;\n    &lt;/TD&gt;\n    &lt;TD ALIGN=CENTER&gt;\n      &lt;FONT SIZE=3 FACE=ARIAL&gt;&lt;B&gt;BI&amp;nbsp;TECH&lt;/B&gt;&lt;/FONT&gt;\n    &lt;/TD&gt;\n    &lt;TD ALIGN=CENTER&gt;\n      &lt;FONT SIZE=3 FACE=ARIAL&gt;&lt;B&gt;DALE-VISHAY&lt;/B&gt;&lt;/FONT&gt;\n    &lt;/TD&gt;\n    &lt;TD ALIGN=CENTER&gt;\n      &lt;FONT SIZE=3 FACE=ARIAL&gt;&lt;B&gt;PHILIPS/MEPCO&lt;/B&gt;&lt;/FONT&gt;\n    &lt;/TD&gt;\n    &lt;TD ALIGN=CENTER&gt;\n      &lt;FONT SIZE=3 FACE=ARIAL&gt;&lt;B&gt;MURATA&lt;/B&gt;&lt;/FONT&gt;\n    &lt;/TD&gt;\n    &lt;TD ALIGN=CENTER&gt;\n      &lt;FONT SIZE=3 FACE=ARIAL&gt;&lt;B&gt;PANASONIC&lt;/B&gt;&lt;/FONT&gt;\n    &lt;/TD&gt;\n    &lt;TD ALIGN=CENTER&gt;\n      &lt;FONT SIZE=3 FACE=ARIAL&gt;&lt;B&gt;SPECTROL&lt;/B&gt;&lt;/FONT&gt;\n    &lt;/TD&gt;\n    &lt;TD ALIGN=CENTER&gt;\n      &lt;FONT SIZE=3 FACE=ARIAL&gt;&lt;B&gt;MILSPEC&lt;/B&gt;&lt;/FONT&gt;\n    &lt;/TD&gt;\n  &lt;/TR&gt;\n  &lt;TR&gt;\n    &lt;TD BGCOLOR=\"#cccccc\" ALIGN=CENTER&gt;&lt;FONT FACE=ARIAL SIZE=3&gt;\n      3323P&lt;BR&gt;\n      3323S&lt;BR&gt;\n      3323W&lt;BR&gt;\n      3329H&lt;BR&gt;\n      3329P&lt;BR&gt;\n      3329W&lt;BR&gt;\n      3339H&lt;BR&gt;\n      3339P&lt;BR&gt;\n      3339W&lt;BR&gt;\n      3352E&lt;BR&gt;\n      3352H&lt;BR&gt;\n      3352K&lt;BR&gt;\n      3352P&lt;BR&gt;\n      3352T&lt;BR&gt;\n      3352V&lt;BR&gt;\n      3352W&lt;BR&gt;\n      3362H&lt;BR&gt;\n      3362M&lt;BR&gt;\n      3362P&lt;BR&gt;\n      3362R&lt;BR&gt;\n      3362S&lt;BR&gt;\n      3362U&lt;BR&gt;\n      3362W&lt;BR&gt;\n      3362X&lt;BR&gt;\n      3386B&lt;BR&gt;\n      3386C&lt;BR&gt;\n      3386F&lt;BR&gt;\n      3386H&lt;BR&gt;\n      3386K&lt;BR&gt;\n      3386M&lt;BR&gt;\n      3386P&lt;BR&gt;\n      3386S&lt;BR&gt;\n      3386W&lt;BR&gt;\n      3386X&lt;BR&gt;&lt;/FONT&gt;\n    &lt;/TD&gt;\n    &lt;TD BGCOLOR=\"#cccccc\" ALIGN=CENTER&gt;&lt;FONT FACE=ARIAL SIZE=3&gt;\n      25P&lt;BR&gt;\n      25S&lt;BR&gt;\n      25RX&lt;BR&gt;\n      82P&lt;BR&gt;\n      82M&lt;BR&gt;\n      82PA&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      91E&lt;BR&gt;\n      91X&lt;BR&gt;\n      91T&lt;BR&gt;\n      91B&lt;BR&gt;\n      91A&lt;BR&gt;\n      91V&lt;BR&gt;\n      91W&lt;BR&gt;\n      25W&lt;BR&gt;\n      25V&lt;BR&gt;\n      25P&lt;BR&gt;\n      -&lt;BR&gt;\n      25S&lt;BR&gt;\n      25U&lt;BR&gt;\n      25RX&lt;BR&gt;\n      25X&lt;BR&gt;\n      72XW&lt;BR&gt;\n      72XL&lt;BR&gt;\n      72PM&lt;BR&gt;\n      72RX&lt;BR&gt;\n      -&lt;BR&gt;\n      72PX&lt;BR&gt;\n      72P&lt;BR&gt;\n      72RXW&lt;BR&gt;\n      72RXL&lt;BR&gt;\n      72X&lt;BR&gt;&lt;/FONT&gt;\n    &lt;/TD&gt;\n    &lt;TD BGCOLOR=\"#cccccc\" ALIGN=CENTER&gt;&lt;FONT FACE=ARIAL SIZE=3&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      T7YB&lt;BR&gt;\n      T7YA&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      TXD&lt;BR&gt;\n      TYA&lt;BR&gt;\n      TYP&lt;BR&gt;\n      -&lt;BR&gt;\n      TYD&lt;BR&gt;\n      TX&lt;BR&gt;\n      -&lt;BR&gt;\n      150SX&lt;BR&gt;\n      100SX&lt;BR&gt;\n      102T&lt;BR&gt;\n      101S&lt;BR&gt;\n      190T&lt;BR&gt;\n      150TX&lt;BR&gt;\n      101&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      101SX&lt;BR&gt;&lt;/FONT&gt;\n    &lt;/TD&gt;\n    &lt;TD BGCOLOR=\"#cccccc\" ALIGN=CENTER&gt;&lt;FONT FACE=ARIAL SIZE=3&gt;\n      ET6P&lt;BR&gt;\n      ET6S&lt;BR&gt;\n      ET6X&lt;BR&gt;\n      RJ-6W/8014EMW&lt;BR&gt;\n      RJ-6P/8014EMP&lt;BR&gt;\n      RJ-6X/8014EMX&lt;BR&gt;\n      TM7W&lt;BR&gt;\n      TM7P&lt;BR&gt;\n      TM7X&lt;BR&gt;\n      -&lt;BR&gt;\n      8017SMS&lt;BR&gt;\n      -&lt;BR&gt;\n      8017SMB&lt;BR&gt;\n      8017SMA&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      CT-6W&lt;BR&gt;\n      CT-6H&lt;BR&gt;\n      CT-6P&lt;BR&gt;\n      CT-6R&lt;BR&gt;\n      -&lt;BR&gt;\n      CT-6V&lt;BR&gt;\n      CT-6X&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      8038EKV&lt;BR&gt;\n      -&lt;BR&gt;\n      8038EKX&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      8038EKP&lt;BR&gt;\n      8038EKZ&lt;BR&gt;\n      8038EKW&lt;BR&gt;\n      -&lt;BR&gt;&lt;/FONT&gt;\n    &lt;/TD&gt;\n    &lt;TD BGCOLOR=\"#cccccc\" ALIGN=CENTER&gt;&lt;FONT FACE=ARIAL SIZE=3&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      3321H&lt;BR&gt;\n      3321P&lt;BR&gt;\n      3321N&lt;BR&gt;\n      1102H&lt;BR&gt;\n      1102P&lt;BR&gt;\n      1102T&lt;BR&gt;\n      RVA0911V304A&lt;BR&gt;\n      -&lt;BR&gt;\n      RVA0911H413A&lt;BR&gt;\n      RVG0707V100A&lt;BR&gt;\n      RVA0607V(H)306A&lt;BR&gt;\n      RVA1214H213A&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      3104B&lt;BR&gt;\n      3104C&lt;BR&gt;\n      3104F&lt;BR&gt;\n      3104H&lt;BR&gt;\n      -&lt;BR&gt;\n      3104M&lt;BR&gt;\n      3104P&lt;BR&gt;\n      3104S&lt;BR&gt;\n      3104W&lt;BR&gt;\n      3104X&lt;BR&gt;&lt;/FONT&gt;\n    &lt;/TD&gt;\n    &lt;TD BGCOLOR=\"#cccccc\" ALIGN=CENTER&gt;&lt;FONT FACE=ARIAL SIZE=3&gt;\n      EVMQ0G&lt;BR&gt;\n      EVMQIG&lt;BR&gt;\n      EVMQ3G&lt;BR&gt;\n      EVMS0G&lt;BR&gt;\n      EVMQ0G&lt;BR&gt;\n      EVMG0G&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      EVMK4GA00B&lt;BR&gt;\n      EVM30GA00B&lt;BR&gt;\n      EVMK0GA00B&lt;BR&gt;\n      EVM38GA00B&lt;BR&gt;\n      EVMB6&lt;BR&gt;\n      EVLQ0&lt;BR&gt;\n      -&lt;BR&gt;\n      EVMMSG&lt;BR&gt;\n      EVMMBG&lt;BR&gt;\n      EVMMAG&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      EVMMCS&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      EVMM1&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      EVMM0&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      EVMM3&lt;BR&gt;&lt;/FONT&gt;\n    &lt;/TD&gt;\n    &lt;TD BGCOLOR=\"#cccccc\" ALIGN=CENTER&gt;&lt;FONT FACE=ARIAL SIZE=3&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      62-3-1&lt;BR&gt;\n      62-1-2&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      67R&lt;BR&gt;\n      -&lt;BR&gt;\n      67P&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      67X&lt;BR&gt;\n      63V&lt;BR&gt;\n      63S&lt;BR&gt;\n      63M&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      63H&lt;BR&gt;\n      63P&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      63X&lt;BR&gt;&lt;/FONT&gt;\n    &lt;/TD&gt;\n    &lt;TD BGCOLOR=\"#cccccc\" ALIGN=CENTER&gt;&lt;FONT FACE=ARIAL SIZE=3&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      RJ/RJR50&lt;BR&gt;\n      RJ/RJR50&lt;BR&gt;\n      RJ/RJR50&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;&lt;/FONT&gt;\n    &lt;/TD&gt;\n  &lt;/TR&gt;\n&lt;/TABLE&gt;\n&lt;P&gt;&amp;nbsp;&lt;P&gt;\n&lt;TABLE BORDER=0 CELLSPACING=1 CELLPADDING=3&gt;\n  &lt;TR&gt;\n    &lt;TD COLSPAN=7&gt;\n      &lt;FONT color=\"#0000FF\" SIZE=4 FACE=ARIAL&gt;&lt;B&gt;SMD TRIM-POT CROSS REFERENCE&lt;/B&gt;&lt;/FONT&gt;\n      &lt;P&gt;\n      &lt;FONT SIZE=4 FACE=ARIAL&gt;&lt;B&gt;MULTI-TURN&lt;/B&gt;&lt;/FONT&gt;\n    &lt;/TD&gt;\n  &lt;/TR&gt;\n  &lt;TR&gt;\n    &lt;TD&gt;\n      &lt;FONT SIZE=3 FACE=ARIAL&gt;&lt;B&gt;BOURNS&lt;/B&gt;&lt;/FONT&gt;\n    &lt;/TD&gt;\n    &lt;TD&gt;\n      &lt;FONT SIZE=3 FACE=ARIAL&gt;&lt;B&gt;BI&amp;nbsp;TECH&lt;/B&gt;&lt;/FONT&gt;\n    &lt;/TD&gt;\n    &lt;TD&gt;\n      &lt;FONT SIZE=3 FACE=ARIAL&gt;&lt;B&gt;DALE-VISHAY&lt;/B&gt;&lt;/FONT&gt;\n    &lt;/TD&gt;\n    &lt;TD&gt;\n      &lt;FONT SIZE=3 FACE=ARIAL&gt;&lt;B&gt;PHILIPS/MEPCO&lt;/B&gt;&lt;/FONT&gt;\n    &lt;/TD&gt;\n    &lt;TD&gt;\n      &lt;FONT SIZE=3 FACE=ARIAL&gt;&lt;B&gt;PANASONIC&lt;/B&gt;&lt;/FONT&gt;\n    &lt;/TD&gt;\n    &lt;TD&gt;\n      &lt;FONT SIZE=3 FACE=ARIAL&gt;&lt;B&gt;TOCOS&lt;/B&gt;&lt;/FONT&gt;\n    &lt;/TD&gt;\n    &lt;TD&gt;\n      &lt;FONT SIZE=3 FACE=ARIAL&gt;&lt;B&gt;AUX/KYOCERA&lt;/B&gt;&lt;/FONT&gt;\n    &lt;/TD&gt;\n  &lt;/TR&gt;\n  &lt;TR&gt;\n    &lt;TD BGCOLOR=\"#cccccc\" ALIGN=CENTER&gt;&lt;FONT FACE=ARIAL SIZE=3&gt;\n      3224G&lt;BR&gt;\n      3224J&lt;BR&gt;\n      3224W&lt;BR&gt;\n      3269P&lt;BR&gt;\n      3269W&lt;BR&gt;\n      3269X&lt;BR&gt;&lt;/FONT&gt;\n    &lt;/TD&gt;\n    &lt;TD BGCOLOR=\"#cccccc\" ALIGN=CENTER&gt;&lt;FONT FACE=ARIAL SIZE=3&gt;\n      44G&lt;BR&gt;\n      44J&lt;BR&gt;\n      44W&lt;BR&gt;\n      84P&lt;BR&gt;\n      84W&lt;BR&gt;\n      84X&lt;BR&gt;&lt;/FONT&gt;\n    &lt;/TD&gt;\n    &lt;TD BGCOLOR=\"#cccccc\" ALIGN=CENTER&gt;&lt;FONT FACE=ARIAL SIZE=3&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      ST63Z&lt;BR&gt;\n      ST63Y&lt;BR&gt;\n      -&lt;BR&gt;&lt;/FONT&gt;\n    &lt;/TD&gt;\n    &lt;TD BGCOLOR=\"#cccccc\" ALIGN=CENTER&gt;&lt;FONT FACE=ARIAL SIZE=3&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      ST5P&lt;BR&gt;\n      ST5W&lt;BR&gt;\n      ST5X&lt;BR&gt;&lt;/FONT&gt;\n    &lt;/TD&gt;\n    &lt;TD BGCOLOR=\"#cccccc\" ALIGN=CENTER&gt;&lt;FONT FACE=ARIAL SIZE=3&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;&lt;/FONT&gt;\n    &lt;/TD&gt;\n    &lt;TD BGCOLOR=\"#cccccc\" ALIGN=CENTER&gt;&lt;FONT FACE=ARIAL SIZE=3&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;&lt;/FONT&gt;\n    &lt;/TD&gt;\n    &lt;TD BGCOLOR=\"#cccccc\" ALIGN=CENTER&gt;&lt;FONT FACE=ARIAL SIZE=3&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;&lt;/FONT&gt;\n    &lt;/TD&gt;\n  &lt;/TR&gt;\n  &lt;TR&gt;\n    &lt;TD COLSPAN=7&gt;&amp;nbsp;\n    &lt;/TD&gt;\n  &lt;/TR&gt;\n  &lt;TR&gt;\n    &lt;TD COLSPAN=7&gt;\n      &lt;FONT SIZE=4 FACE=ARIAL&gt;&lt;B&gt;SINGLE TURN&lt;/B&gt;&lt;/FONT&gt;\n    &lt;/TD&gt;\n  &lt;/TR&gt;\n  &lt;TR&gt;\n    &lt;TD&gt;\n      &lt;FONT SIZE=3 FACE=ARIAL&gt;&lt;B&gt;BOURNS&lt;/B&gt;&lt;/FONT&gt;\n    &lt;/TD&gt;\n    &lt;TD&gt;\n      &lt;FONT SIZE=3 FACE=ARIAL&gt;&lt;B&gt;BI&amp;nbsp;TECH&lt;/B&gt;&lt;/FONT&gt;\n    &lt;/TD&gt;\n    &lt;TD&gt;\n      &lt;FONT SIZE=3 FACE=ARIAL&gt;&lt;B&gt;DALE-VISHAY&lt;/B&gt;&lt;/FONT&gt;\n    &lt;/TD&gt;\n    &lt;TD&gt;\n      &lt;FONT SIZE=3 FACE=ARIAL&gt;&lt;B&gt;PHILIPS/MEPCO&lt;/B&gt;&lt;/FONT&gt;\n    &lt;/TD&gt;\n    &lt;TD&gt;\n      &lt;FONT SIZE=3 FACE=ARIAL&gt;&lt;B&gt;PANASONIC&lt;/B&gt;&lt;/FONT&gt;\n    &lt;/TD&gt;\n    &lt;TD&gt;\n      &lt;FONT SIZE=3 FACE=ARIAL&gt;&lt;B&gt;TOCOS&lt;/B&gt;&lt;/FONT&gt;\n    &lt;/TD&gt;\n    &lt;TD&gt;\n      &lt;FONT SIZE=3 FACE=ARIAL&gt;&lt;B&gt;AUX/KYOCERA&lt;/B&gt;&lt;/FONT&gt;\n    &lt;/TD&gt;\n  &lt;/TR&gt;\n  &lt;TR&gt;\n    &lt;TD BGCOLOR=\"#cccccc\" ALIGN=CENTER&gt;&lt;FONT FACE=ARIAL SIZE=3&gt;\n      3314G&lt;BR&gt;\n      3314J&lt;BR&gt;\n      3364A/B&lt;BR&gt;\n      3364C/D&lt;BR&gt;\n      3364W/X&lt;BR&gt;\n      3313G&lt;BR&gt;\n      3313J&lt;BR&gt;&lt;/FONT&gt;\n    &lt;/TD&gt;\n    &lt;TD BGCOLOR=\"#cccccc\" ALIGN=CENTER&gt;&lt;FONT FACE=ARIAL SIZE=3&gt;\n      23B&lt;BR&gt;\n      23A&lt;BR&gt;\n      21X&lt;BR&gt;\n      21W&lt;BR&gt;\n      -&lt;BR&gt;\n      22B&lt;BR&gt;\n      22A&lt;BR&gt;&lt;/FONT&gt;\n    &lt;/TD&gt;\n    &lt;TD BGCOLOR=\"#cccccc\" ALIGN=CENTER&gt;&lt;FONT FACE=ARIAL SIZE=3&gt;\n      ST5YL/ST53YL&lt;BR&gt;\n      ST5YJ/5T53YJ&lt;BR&gt;\n      ST-23A&lt;BR&gt;\n      ST-22B&lt;BR&gt;\n      ST-22&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;&lt;/FONT&gt;\n    &lt;/TD&gt;\n    &lt;TD BGCOLOR=\"#cccccc\" ALIGN=CENTER&gt;&lt;FONT FACE=ARIAL SIZE=3&gt;\n      ST-4B&lt;BR&gt;\n      ST-4A&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      ST-3B&lt;BR&gt;\n      ST-3A&lt;BR&gt;&lt;/FONT&gt;\n    &lt;/TD&gt;\n    &lt;TD BGCOLOR=\"#cccccc\" ALIGN=CENTER&gt;&lt;FONT FACE=ARIAL SIZE=3&gt;\n      -&lt;BR&gt;\n      EVM-6YS&lt;BR&gt;\n      EVM-1E&lt;BR&gt;\n      EVM-1G&lt;BR&gt;\n      EVM-1D&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;&lt;/FONT&gt;\n    &lt;/TD&gt;\n    &lt;TD BGCOLOR=\"#cccccc\" ALIGN=CENTER&gt;&lt;FONT FACE=ARIAL SIZE=3&gt;\n      G4B&lt;BR&gt;\n      G4A&lt;BR&gt;\n      TR04-3S1&lt;BR&gt;\n      TRG04-2S1&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;&lt;/FONT&gt;\n    &lt;/TD&gt;\n    &lt;TD BGCOLOR=\"#cccccc\" ALIGN=CENTER&gt;&lt;FONT FACE=ARIAL SIZE=3&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;\n      DVR-43A&lt;BR&gt;\n      CVR-42C&lt;BR&gt;\n      CVR-42A/C&lt;BR&gt;\n      -&lt;BR&gt;\n      -&lt;BR&gt;&lt;/FONT&gt;\n    &lt;/TD&gt;\n  &lt;/TR&gt;\n&lt;/TABLE&gt;\n&lt;P&gt;\n&lt;FONT SIZE=4 FACE=ARIAL&gt;&lt;B&gt;ALT =&amp;nbsp;ALTERNATE&lt;/B&gt;&lt;/FONT&gt;\n&lt;P&gt;\n\n&amp;nbsp;\n&lt;P&gt;\n&lt;/td&gt;\n&lt;/tr&gt;\n&lt;/table&gt;</description>\n<packages>\n<package name=\"R0402\">\n<description>&lt;b&gt;RESISTOR&lt;/b&gt;</description>\n<wire x1=\"-0.245\" y1=\"0.224\" x2=\"0.245\" y2=\"0.224\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"0.245\" y1=\"-0.224\" x2=\"-0.245\" y2=\"-0.224\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"-1.473\" y1=\"0.483\" x2=\"1.473\" y2=\"0.483\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"1.473\" y1=\"0.483\" x2=\"1.473\" y2=\"-0.483\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"1.473\" y1=\"-0.483\" x2=\"-1.473\" y2=\"-0.483\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"-1.473\" y1=\"-0.483\" x2=\"-1.473\" y2=\"0.483\" width=\"0.0508\" layer=\"39\"/>\n<smd name=\"1\" x=\"-0.65\" y=\"0\" dx=\"0.7\" dy=\"0.9\" layer=\"1\"/>\n<smd name=\"2\" x=\"0.65\" y=\"0\" dx=\"0.7\" dy=\"0.9\" layer=\"1\"/>\n<text x=\"-0.635\" y=\"0.635\" size=\"1.27\" layer=\"25\">&gt;NAME</text>\n<text x=\"-0.635\" y=\"-1.905\" size=\"1.27\" layer=\"27\">&gt;VALUE</text>\n<rectangle x1=\"-0.554\" y1=\"-0.3048\" x2=\"-0.254\" y2=\"0.2951\" layer=\"51\"/>\n<rectangle x1=\"0.2588\" y1=\"-0.3048\" x2=\"0.5588\" y2=\"0.2951\" layer=\"51\"/>\n<rectangle x1=\"-0.1999\" y1=\"-0.4001\" x2=\"0.1999\" y2=\"0.4001\" layer=\"35\"/>\n</package>\n<package name=\"R0603\">\n<description>&lt;b&gt;RESISTOR&lt;/b&gt;</description>\n<wire x1=\"-0.432\" y1=\"-0.356\" x2=\"0.432\" y2=\"-0.356\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"0.432\" y1=\"0.356\" x2=\"-0.432\" y2=\"0.356\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"-1.473\" y1=\"0.983\" x2=\"1.473\" y2=\"0.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"1.473\" y1=\"0.983\" x2=\"1.473\" y2=\"-0.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"1.473\" y1=\"-0.983\" x2=\"-1.473\" y2=\"-0.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"-1.473\" y1=\"-0.983\" x2=\"-1.473\" y2=\"0.983\" width=\"0.0508\" layer=\"39\"/>\n<smd name=\"1\" x=\"-0.85\" y=\"0\" dx=\"1\" dy=\"1.1\" layer=\"1\"/>\n<smd name=\"2\" x=\"0.85\" y=\"0\" dx=\"1\" dy=\"1.1\" layer=\"1\"/>\n<text x=\"-0.635\" y=\"0.635\" size=\"1.27\" layer=\"25\">&gt;NAME</text>\n<text x=\"-0.635\" y=\"-1.905\" size=\"1.27\" layer=\"27\">&gt;VALUE</text>\n<rectangle x1=\"0.4318\" y1=\"-0.4318\" x2=\"0.8382\" y2=\"0.4318\" layer=\"51\"/>\n<rectangle x1=\"-0.8382\" y1=\"-0.4318\" x2=\"-0.4318\" y2=\"0.4318\" layer=\"51\"/>\n<rectangle x1=\"-0.1999\" y1=\"-0.4001\" x2=\"0.1999\" y2=\"0.4001\" layer=\"35\"/>\n</package>\n<package name=\"R0805\">\n<description>&lt;b&gt;RESISTOR&lt;/b&gt;&lt;p&gt;</description>\n<wire x1=\"-0.41\" y1=\"0.635\" x2=\"0.41\" y2=\"0.635\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"-0.41\" y1=\"-0.635\" x2=\"0.41\" y2=\"-0.635\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"-1.973\" y1=\"0.983\" x2=\"1.973\" y2=\"0.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"1.973\" y1=\"0.983\" x2=\"1.973\" y2=\"-0.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"1.973\" y1=\"-0.983\" x2=\"-1.973\" y2=\"-0.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"-1.973\" y1=\"-0.983\" x2=\"-1.973\" y2=\"0.983\" width=\"0.0508\" layer=\"39\"/>\n<smd name=\"1\" x=\"-0.95\" y=\"0\" dx=\"1.3\" dy=\"1.5\" layer=\"1\"/>\n<smd name=\"2\" x=\"0.95\" y=\"0\" dx=\"1.3\" dy=\"1.5\" layer=\"1\"/>\n<text x=\"-0.635\" y=\"1.27\" size=\"1.27\" layer=\"25\">&gt;NAME</text>\n<text x=\"-0.635\" y=\"-2.54\" size=\"1.27\" layer=\"27\">&gt;VALUE</text>\n<rectangle x1=\"0.4064\" y1=\"-0.6985\" x2=\"1.0564\" y2=\"0.7015\" layer=\"51\"/>\n<rectangle x1=\"-1.0668\" y1=\"-0.6985\" x2=\"-0.4168\" y2=\"0.7015\" layer=\"51\"/>\n<rectangle x1=\"-0.1999\" y1=\"-0.5001\" x2=\"0.1999\" y2=\"0.5001\" layer=\"35\"/>\n</package>\n<package name=\"R0805W\">\n<description>&lt;b&gt;RESISTOR&lt;/b&gt; wave soldering&lt;p&gt;</description>\n<wire x1=\"-0.41\" y1=\"0.635\" x2=\"0.41\" y2=\"0.635\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"-0.41\" y1=\"-0.635\" x2=\"0.41\" y2=\"-0.635\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"-1.973\" y1=\"0.983\" x2=\"1.973\" y2=\"0.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"1.973\" y1=\"0.983\" x2=\"1.973\" y2=\"-0.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"1.973\" y1=\"-0.983\" x2=\"-1.973\" y2=\"-0.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"-1.973\" y1=\"-0.983\" x2=\"-1.973\" y2=\"0.983\" width=\"0.0508\" layer=\"39\"/>\n<smd name=\"1\" x=\"-1.0525\" y=\"0\" dx=\"1.5\" dy=\"1\" layer=\"1\"/>\n<smd name=\"2\" x=\"1.0525\" y=\"0\" dx=\"1.5\" dy=\"1\" layer=\"1\"/>\n<text x=\"-0.635\" y=\"1.27\" size=\"1.27\" layer=\"25\">&gt;NAME</text>\n<text x=\"-0.635\" y=\"-2.54\" size=\"1.27\" layer=\"27\">&gt;VALUE</text>\n<rectangle x1=\"0.4064\" y1=\"-0.6985\" x2=\"1.0564\" y2=\"0.7015\" layer=\"51\"/>\n<rectangle x1=\"-1.0668\" y1=\"-0.6985\" x2=\"-0.4168\" y2=\"0.7015\" layer=\"51\"/>\n<rectangle x1=\"-0.1999\" y1=\"-0.5001\" x2=\"0.1999\" y2=\"0.5001\" layer=\"35\"/>\n</package>\n<package name=\"R1206\">\n<description>&lt;b&gt;RESISTOR&lt;/b&gt;</description>\n<wire x1=\"0.9525\" y1=\"-0.8128\" x2=\"-0.9652\" y2=\"-0.8128\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"0.9525\" y1=\"0.8128\" x2=\"-0.9652\" y2=\"0.8128\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"-2.473\" y1=\"0.983\" x2=\"2.473\" y2=\"0.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"2.473\" y1=\"0.983\" x2=\"2.473\" y2=\"-0.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"2.473\" y1=\"-0.983\" x2=\"-2.473\" y2=\"-0.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"-2.473\" y1=\"-0.983\" x2=\"-2.473\" y2=\"0.983\" width=\"0.0508\" layer=\"39\"/>\n<smd name=\"2\" x=\"1.422\" y=\"0\" dx=\"1.6\" dy=\"1.803\" layer=\"1\"/>\n<smd name=\"1\" x=\"-1.422\" y=\"0\" dx=\"1.6\" dy=\"1.803\" layer=\"1\"/>\n<text x=\"-1.27\" y=\"1.27\" size=\"1.27\" layer=\"25\">&gt;NAME</text>\n<text x=\"-1.27\" y=\"-2.54\" size=\"1.27\" layer=\"27\">&gt;VALUE</text>\n<rectangle x1=\"-1.6891\" y1=\"-0.8763\" x2=\"-0.9525\" y2=\"0.8763\" layer=\"51\"/>\n<rectangle x1=\"0.9525\" y1=\"-0.8763\" x2=\"1.6891\" y2=\"0.8763\" layer=\"51\"/>\n<rectangle x1=\"-0.3\" y1=\"-0.7\" x2=\"0.3\" y2=\"0.7\" layer=\"35\"/>\n</package>\n<package name=\"R1206W\">\n<description>&lt;b&gt;RESISTOR&lt;/b&gt;&lt;p&gt;\nwave soldering</description>\n<wire x1=\"-0.913\" y1=\"0.8\" x2=\"0.888\" y2=\"0.8\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"-0.913\" y1=\"-0.8\" x2=\"0.888\" y2=\"-0.8\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"-2.473\" y1=\"0.983\" x2=\"2.473\" y2=\"0.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"2.473\" y1=\"0.983\" x2=\"2.473\" y2=\"-0.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"2.473\" y1=\"-0.983\" x2=\"-2.473\" y2=\"-0.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"-2.473\" y1=\"-0.983\" x2=\"-2.473\" y2=\"0.983\" width=\"0.0508\" layer=\"39\"/>\n<smd name=\"1\" x=\"-1.499\" y=\"0\" dx=\"1.8\" dy=\"1.2\" layer=\"1\"/>\n<smd name=\"2\" x=\"1.499\" y=\"0\" dx=\"1.8\" dy=\"1.2\" layer=\"1\"/>\n<text x=\"-1.905\" y=\"1.27\" size=\"1.27\" layer=\"25\">&gt;NAME</text>\n<text x=\"-1.905\" y=\"-2.54\" size=\"1.27\" layer=\"27\">&gt;VALUE</text>\n<rectangle x1=\"-1.651\" y1=\"-0.8763\" x2=\"-0.9009\" y2=\"0.8738\" layer=\"51\"/>\n<rectangle x1=\"0.889\" y1=\"-0.8763\" x2=\"1.6391\" y2=\"0.8738\" layer=\"51\"/>\n<rectangle x1=\"-0.3\" y1=\"-0.7\" x2=\"0.3\" y2=\"0.7\" layer=\"35\"/>\n</package>\n<package name=\"R1210\">\n<description>&lt;b&gt;RESISTOR&lt;/b&gt;</description>\n<wire x1=\"-0.913\" y1=\"1.219\" x2=\"0.939\" y2=\"1.219\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"-0.913\" y1=\"-1.219\" x2=\"0.939\" y2=\"-1.219\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"-2.473\" y1=\"1.483\" x2=\"2.473\" y2=\"1.483\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"2.473\" y1=\"1.483\" x2=\"2.473\" y2=\"-1.483\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"2.473\" y1=\"-1.483\" x2=\"-2.473\" y2=\"-1.483\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"-2.473\" y1=\"-1.483\" x2=\"-2.473\" y2=\"1.483\" width=\"0.0508\" layer=\"39\"/>\n<smd name=\"1\" x=\"-1.4\" y=\"0\" dx=\"1.6\" dy=\"2.7\" layer=\"1\"/>\n<smd name=\"2\" x=\"1.4\" y=\"0\" dx=\"1.6\" dy=\"2.7\" layer=\"1\"/>\n<text x=\"-2.54\" y=\"1.905\" size=\"1.27\" layer=\"25\">&gt;NAME</text>\n<text x=\"-2.54\" y=\"-3.175\" size=\"1.27\" layer=\"27\">&gt;VALUE</text>\n<rectangle x1=\"-1.651\" y1=\"-1.3081\" x2=\"-0.9009\" y2=\"1.2918\" layer=\"51\"/>\n<rectangle x1=\"0.9144\" y1=\"-1.3081\" x2=\"1.6645\" y2=\"1.2918\" layer=\"51\"/>\n<rectangle x1=\"-0.3\" y1=\"-0.8999\" x2=\"0.3\" y2=\"0.8999\" layer=\"35\"/>\n</package>\n<package name=\"R1210W\">\n<description>&lt;b&gt;RESISTOR&lt;/b&gt;&lt;p&gt;\nwave soldering</description>\n<wire x1=\"-0.913\" y1=\"1.219\" x2=\"0.939\" y2=\"1.219\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"-0.913\" y1=\"-1.219\" x2=\"0.939\" y2=\"-1.219\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"-2.473\" y1=\"1.483\" x2=\"2.473\" y2=\"1.483\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"2.473\" y1=\"1.483\" x2=\"2.473\" y2=\"-1.483\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"2.473\" y1=\"-1.483\" x2=\"-2.473\" y2=\"-1.483\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"-2.473\" y1=\"-1.483\" x2=\"-2.473\" y2=\"1.483\" width=\"0.0508\" layer=\"39\"/>\n<smd name=\"1\" x=\"-1.499\" y=\"0\" dx=\"1.8\" dy=\"1.8\" layer=\"1\"/>\n<smd name=\"2\" x=\"1.499\" y=\"0\" dx=\"1.8\" dy=\"1.8\" layer=\"1\"/>\n<text x=\"-2.54\" y=\"1.905\" size=\"1.27\" layer=\"25\">&gt;NAME</text>\n<text x=\"-2.54\" y=\"-3.175\" size=\"1.27\" layer=\"27\">&gt;VALUE</text>\n<rectangle x1=\"-1.651\" y1=\"-1.3081\" x2=\"-0.9009\" y2=\"1.2918\" layer=\"51\"/>\n<rectangle x1=\"0.9144\" y1=\"-1.3081\" x2=\"1.6645\" y2=\"1.2918\" layer=\"51\"/>\n<rectangle x1=\"-0.3\" y1=\"-0.8001\" x2=\"0.3\" y2=\"0.8001\" layer=\"35\"/>\n</package>\n<package name=\"R2010\">\n<description>&lt;b&gt;RESISTOR&lt;/b&gt;</description>\n<wire x1=\"-1.662\" y1=\"1.245\" x2=\"1.662\" y2=\"1.245\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"-1.637\" y1=\"-1.245\" x2=\"1.687\" y2=\"-1.245\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"-3.473\" y1=\"1.483\" x2=\"3.473\" y2=\"1.483\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"3.473\" y1=\"1.483\" x2=\"3.473\" y2=\"-1.483\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"3.473\" y1=\"-1.483\" x2=\"-3.473\" y2=\"-1.483\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"-3.473\" y1=\"-1.483\" x2=\"-3.473\" y2=\"1.483\" width=\"0.0508\" layer=\"39\"/>\n<smd name=\"1\" x=\"-2.2\" y=\"0\" dx=\"1.8\" dy=\"2.7\" layer=\"1\"/>\n<smd name=\"2\" x=\"2.2\" y=\"0\" dx=\"1.8\" dy=\"2.7\" layer=\"1\"/>\n<text x=\"-3.175\" y=\"1.905\" size=\"1.27\" layer=\"25\">&gt;NAME</text>\n<text x=\"-3.175\" y=\"-3.175\" size=\"1.27\" layer=\"27\">&gt;VALUE</text>\n<rectangle x1=\"-2.4892\" y1=\"-1.3208\" x2=\"-1.6393\" y2=\"1.3292\" layer=\"51\"/>\n<rectangle x1=\"1.651\" y1=\"-1.3208\" x2=\"2.5009\" y2=\"1.3292\" layer=\"51\"/>\n</package>\n<package name=\"R2010W\">\n<description>&lt;b&gt;RESISTOR&lt;/b&gt;&lt;p&gt;\nwave soldering</description>\n<wire x1=\"-1.662\" y1=\"1.245\" x2=\"1.662\" y2=\"1.245\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"-1.637\" y1=\"-1.245\" x2=\"1.687\" y2=\"-1.245\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"-3.473\" y1=\"1.483\" x2=\"3.473\" y2=\"1.483\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"3.473\" y1=\"1.483\" x2=\"3.473\" y2=\"-1.483\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"3.473\" y1=\"-1.483\" x2=\"-3.473\" y2=\"-1.483\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"-3.473\" y1=\"-1.483\" x2=\"-3.473\" y2=\"1.483\" width=\"0.0508\" layer=\"39\"/>\n<smd name=\"1\" x=\"-2.311\" y=\"0\" dx=\"2\" dy=\"1.8\" layer=\"1\"/>\n<smd name=\"2\" x=\"2.311\" y=\"0\" dx=\"2\" dy=\"1.8\" layer=\"1\"/>\n<text x=\"-2.54\" y=\"1.905\" size=\"1.27\" layer=\"25\">&gt;NAME</text>\n<text x=\"-2.54\" y=\"-3.175\" size=\"1.27\" layer=\"27\">&gt;VALUE</text>\n<rectangle x1=\"-2.4892\" y1=\"-1.3208\" x2=\"-1.6393\" y2=\"1.3292\" layer=\"51\"/>\n<rectangle x1=\"1.651\" y1=\"-1.3208\" x2=\"2.5009\" y2=\"1.3292\" layer=\"51\"/>\n</package>\n<package name=\"R2012\">\n<description>&lt;b&gt;RESISTOR&lt;/b&gt;</description>\n<wire x1=\"-0.41\" y1=\"0.635\" x2=\"0.41\" y2=\"0.635\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"-0.41\" y1=\"-0.635\" x2=\"0.41\" y2=\"-0.635\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"-1.973\" y1=\"0.983\" x2=\"1.973\" y2=\"0.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"1.973\" y1=\"0.983\" x2=\"1.973\" y2=\"-0.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"1.973\" y1=\"-0.983\" x2=\"-1.973\" y2=\"-0.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"-1.973\" y1=\"-0.983\" x2=\"-1.973\" y2=\"0.983\" width=\"0.0508\" layer=\"39\"/>\n<smd name=\"1\" x=\"-0.85\" y=\"0\" dx=\"1.3\" dy=\"1.5\" layer=\"1\"/>\n<smd name=\"2\" x=\"0.85\" y=\"0\" dx=\"1.3\" dy=\"1.5\" layer=\"1\"/>\n<text x=\"-0.635\" y=\"1.27\" size=\"1.27\" layer=\"25\">&gt;NAME</text>\n<text x=\"-0.635\" y=\"-2.54\" size=\"1.27\" layer=\"27\">&gt;VALUE</text>\n<rectangle x1=\"0.4064\" y1=\"-0.6985\" x2=\"1.0564\" y2=\"0.7015\" layer=\"51\"/>\n<rectangle x1=\"-1.0668\" y1=\"-0.6985\" x2=\"-0.4168\" y2=\"0.7015\" layer=\"51\"/>\n<rectangle x1=\"-0.1001\" y1=\"-0.5999\" x2=\"0.1001\" y2=\"0.5999\" layer=\"35\"/>\n</package>\n<package name=\"R2012W\">\n<description>&lt;b&gt;RESISTOR&lt;/b&gt;&lt;p&gt;\nwave soldering</description>\n<wire x1=\"-0.41\" y1=\"0.635\" x2=\"0.41\" y2=\"0.635\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"-0.41\" y1=\"-0.635\" x2=\"0.41\" y2=\"-0.635\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"-1.973\" y1=\"0.983\" x2=\"1.973\" y2=\"0.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"1.973\" y1=\"0.983\" x2=\"1.973\" y2=\"-0.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"1.973\" y1=\"-0.983\" x2=\"-1.973\" y2=\"-0.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"-1.973\" y1=\"-0.983\" x2=\"-1.973\" y2=\"0.983\" width=\"0.0508\" layer=\"39\"/>\n<smd name=\"1\" x=\"-0.94\" y=\"0\" dx=\"1.5\" dy=\"1\" layer=\"1\"/>\n<smd name=\"2\" x=\"0.94\" y=\"0\" dx=\"1.5\" dy=\"1\" layer=\"1\"/>\n<text x=\"-0.635\" y=\"1.27\" size=\"1.27\" layer=\"25\">&gt;NAME</text>\n<text x=\"-0.635\" y=\"-2.54\" size=\"1.27\" layer=\"27\">&gt;VALUE</text>\n<rectangle x1=\"0.4064\" y1=\"-0.6985\" x2=\"1.0564\" y2=\"0.7015\" layer=\"51\"/>\n<rectangle x1=\"-1.0668\" y1=\"-0.6985\" x2=\"-0.4168\" y2=\"0.7015\" layer=\"51\"/>\n<rectangle x1=\"-0.1001\" y1=\"-0.5999\" x2=\"0.1001\" y2=\"0.5999\" layer=\"35\"/>\n</package>\n<package name=\"R2512\">\n<description>&lt;b&gt;RESISTOR&lt;/b&gt;</description>\n<wire x1=\"-2.362\" y1=\"1.473\" x2=\"2.387\" y2=\"1.473\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"-2.362\" y1=\"-1.473\" x2=\"2.387\" y2=\"-1.473\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"-3.973\" y1=\"1.983\" x2=\"3.973\" y2=\"1.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"3.973\" y1=\"1.983\" x2=\"3.973\" y2=\"-1.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"3.973\" y1=\"-1.983\" x2=\"-3.973\" y2=\"-1.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"-3.973\" y1=\"-1.983\" x2=\"-3.973\" y2=\"1.983\" width=\"0.0508\" layer=\"39\"/>\n<smd name=\"1\" x=\"-2.8\" y=\"0\" dx=\"1.8\" dy=\"3.2\" layer=\"1\"/>\n<smd name=\"2\" x=\"2.8\" y=\"0\" dx=\"1.8\" dy=\"3.2\" layer=\"1\"/>\n<text x=\"-2.54\" y=\"1.905\" size=\"1.27\" layer=\"25\">&gt;NAME</text>\n<text x=\"-2.54\" y=\"-3.175\" size=\"1.27\" layer=\"27\">&gt;VALUE</text>\n<rectangle x1=\"-3.2004\" y1=\"-1.5494\" x2=\"-2.3505\" y2=\"1.5507\" layer=\"51\"/>\n<rectangle x1=\"2.3622\" y1=\"-1.5494\" x2=\"3.2121\" y2=\"1.5507\" layer=\"51\"/>\n<rectangle x1=\"-0.5001\" y1=\"-1\" x2=\"0.5001\" y2=\"1\" layer=\"35\"/>\n</package>\n<package name=\"R2512W\">\n<description>&lt;b&gt;RESISTOR&lt;/b&gt;&lt;p&gt;\nwave soldering</description>\n<wire x1=\"-2.362\" y1=\"1.473\" x2=\"2.387\" y2=\"1.473\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"-2.362\" y1=\"-1.473\" x2=\"2.387\" y2=\"-1.473\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"-3.973\" y1=\"1.983\" x2=\"3.973\" y2=\"1.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"3.973\" y1=\"1.983\" x2=\"3.973\" y2=\"-1.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"3.973\" y1=\"-1.983\" x2=\"-3.973\" y2=\"-1.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"-3.973\" y1=\"-1.983\" x2=\"-3.973\" y2=\"1.983\" width=\"0.0508\" layer=\"39\"/>\n<smd name=\"1\" x=\"-2.896\" y=\"0\" dx=\"2\" dy=\"2.1\" layer=\"1\"/>\n<smd name=\"2\" x=\"2.896\" y=\"0\" dx=\"2\" dy=\"2.1\" layer=\"1\"/>\n<text x=\"-1.905\" y=\"1.905\" size=\"1.27\" layer=\"25\">&gt;NAME</text>\n<text x=\"-1.905\" y=\"-3.175\" size=\"1.27\" layer=\"27\">&gt;VALUE</text>\n<rectangle x1=\"-3.2004\" y1=\"-1.5494\" x2=\"-2.3505\" y2=\"1.5507\" layer=\"51\"/>\n<rectangle x1=\"2.3622\" y1=\"-1.5494\" x2=\"3.2121\" y2=\"1.5507\" layer=\"51\"/>\n<rectangle x1=\"-0.5001\" y1=\"-1\" x2=\"0.5001\" y2=\"1\" layer=\"35\"/>\n</package>\n<package name=\"R3216\">\n<description>&lt;b&gt;RESISTOR&lt;/b&gt;</description>\n<wire x1=\"-0.913\" y1=\"0.8\" x2=\"0.888\" y2=\"0.8\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"-0.913\" y1=\"-0.8\" x2=\"0.888\" y2=\"-0.8\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"-2.473\" y1=\"0.983\" x2=\"2.473\" y2=\"0.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"2.473\" y1=\"0.983\" x2=\"2.473\" y2=\"-0.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"2.473\" y1=\"-0.983\" x2=\"-2.473\" y2=\"-0.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"-2.473\" y1=\"-0.983\" x2=\"-2.473\" y2=\"0.983\" width=\"0.0508\" layer=\"39\"/>\n<smd name=\"1\" x=\"-1.4\" y=\"0\" dx=\"1.6\" dy=\"1.8\" layer=\"1\"/>\n<smd name=\"2\" x=\"1.4\" y=\"0\" dx=\"1.6\" dy=\"1.8\" layer=\"1\"/>\n<text x=\"-1.905\" y=\"1.27\" size=\"1.27\" layer=\"25\">&gt;NAME</text>\n<text x=\"-1.905\" y=\"-2.54\" size=\"1.27\" layer=\"27\">&gt;VALUE</text>\n<rectangle x1=\"-1.651\" y1=\"-0.8763\" x2=\"-0.9009\" y2=\"0.8738\" layer=\"51\"/>\n<rectangle x1=\"0.889\" y1=\"-0.8763\" x2=\"1.6391\" y2=\"0.8738\" layer=\"51\"/>\n<rectangle x1=\"-0.3\" y1=\"-0.7\" x2=\"0.3\" y2=\"0.7\" layer=\"35\"/>\n</package>\n<package name=\"R3216W\">\n<description>&lt;b&gt;RESISTOR&lt;/b&gt;&lt;p&gt;\nwave soldering</description>\n<wire x1=\"-0.913\" y1=\"0.8\" x2=\"0.888\" y2=\"0.8\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"-0.913\" y1=\"-0.8\" x2=\"0.888\" y2=\"-0.8\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"-2.473\" y1=\"0.983\" x2=\"2.473\" y2=\"0.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"2.473\" y1=\"0.983\" x2=\"2.473\" y2=\"-0.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"2.473\" y1=\"-0.983\" x2=\"-2.473\" y2=\"-0.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"-2.473\" y1=\"-0.983\" x2=\"-2.473\" y2=\"0.983\" width=\"0.0508\" layer=\"39\"/>\n<smd name=\"1\" x=\"-1.499\" y=\"0\" dx=\"1.8\" dy=\"1.2\" layer=\"1\"/>\n<smd name=\"2\" x=\"1.499\" y=\"0\" dx=\"1.8\" dy=\"1.2\" layer=\"1\"/>\n<text x=\"-1.905\" y=\"1.27\" size=\"1.27\" layer=\"25\">&gt;NAME</text>\n<text x=\"-1.905\" y=\"-2.54\" size=\"1.27\" layer=\"27\">&gt;VALUE</text>\n<rectangle x1=\"-1.651\" y1=\"-0.8763\" x2=\"-0.9009\" y2=\"0.8738\" layer=\"51\"/>\n<rectangle x1=\"0.889\" y1=\"-0.8763\" x2=\"1.6391\" y2=\"0.8738\" layer=\"51\"/>\n<rectangle x1=\"-0.3\" y1=\"-0.7\" x2=\"0.3\" y2=\"0.7\" layer=\"35\"/>\n</package>\n<package name=\"R3225\">\n<description>&lt;b&gt;RESISTOR&lt;/b&gt;</description>\n<wire x1=\"-0.913\" y1=\"1.219\" x2=\"0.939\" y2=\"1.219\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"-0.913\" y1=\"-1.219\" x2=\"0.939\" y2=\"-1.219\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"-2.473\" y1=\"1.483\" x2=\"2.473\" y2=\"1.483\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"2.473\" y1=\"1.483\" x2=\"2.473\" y2=\"-1.483\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"2.473\" y1=\"-1.483\" x2=\"-2.473\" y2=\"-1.483\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"-2.473\" y1=\"-1.483\" x2=\"-2.473\" y2=\"1.483\" width=\"0.0508\" layer=\"39\"/>\n<smd name=\"1\" x=\"-1.4\" y=\"0\" dx=\"1.6\" dy=\"2.7\" layer=\"1\"/>\n<smd name=\"2\" x=\"1.4\" y=\"0\" dx=\"1.6\" dy=\"2.7\" layer=\"1\"/>\n<text x=\"-2.54\" y=\"1.905\" size=\"1.27\" layer=\"25\">&gt;NAME</text>\n<text x=\"-2.54\" y=\"-3.175\" size=\"1.27\" layer=\"27\">&gt;VALUE</text>\n<rectangle x1=\"-1.651\" y1=\"-1.3081\" x2=\"-0.9009\" y2=\"1.2918\" layer=\"51\"/>\n<rectangle x1=\"0.9144\" y1=\"-1.3081\" x2=\"1.6645\" y2=\"1.2918\" layer=\"51\"/>\n<rectangle x1=\"-0.3\" y1=\"-1\" x2=\"0.3\" y2=\"1\" layer=\"35\"/>\n</package>\n<package name=\"R3225W\">\n<description>&lt;b&gt;RESISTOR&lt;/b&gt;&lt;p&gt;\nwave soldering</description>\n<wire x1=\"-0.913\" y1=\"1.219\" x2=\"0.939\" y2=\"1.219\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"-0.913\" y1=\"-1.219\" x2=\"0.939\" y2=\"-1.219\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"-2.473\" y1=\"1.483\" x2=\"2.473\" y2=\"1.483\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"2.473\" y1=\"1.483\" x2=\"2.473\" y2=\"-1.483\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"2.473\" y1=\"-1.483\" x2=\"-2.473\" y2=\"-1.483\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"-2.473\" y1=\"-1.483\" x2=\"-2.473\" y2=\"1.483\" width=\"0.0508\" layer=\"39\"/>\n<smd name=\"1\" x=\"-1.499\" y=\"0\" dx=\"1.8\" dy=\"1.8\" layer=\"1\"/>\n<smd name=\"2\" x=\"1.499\" y=\"0\" dx=\"1.8\" dy=\"1.8\" layer=\"1\"/>\n<text x=\"-1.905\" y=\"1.905\" size=\"1.27\" layer=\"25\">&gt;NAME</text>\n<text x=\"-1.905\" y=\"-3.175\" size=\"1.27\" layer=\"27\">&gt;VALUE</text>\n<rectangle x1=\"-1.651\" y1=\"-1.3081\" x2=\"-0.9009\" y2=\"1.2918\" layer=\"51\"/>\n<rectangle x1=\"0.9144\" y1=\"-1.3081\" x2=\"1.6645\" y2=\"1.2918\" layer=\"51\"/>\n<rectangle x1=\"-0.3\" y1=\"-1\" x2=\"0.3\" y2=\"1\" layer=\"35\"/>\n</package>\n<package name=\"R5025\">\n<description>&lt;b&gt;RESISTOR&lt;/b&gt;</description>\n<wire x1=\"-1.662\" y1=\"1.245\" x2=\"1.662\" y2=\"1.245\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"-1.637\" y1=\"-1.245\" x2=\"1.687\" y2=\"-1.245\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"-3.473\" y1=\"1.483\" x2=\"3.473\" y2=\"1.483\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"3.473\" y1=\"1.483\" x2=\"3.473\" y2=\"-1.483\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"3.473\" y1=\"-1.483\" x2=\"-3.473\" y2=\"-1.483\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"-3.473\" y1=\"-1.483\" x2=\"-3.473\" y2=\"1.483\" width=\"0.0508\" layer=\"39\"/>\n<smd name=\"1\" x=\"-2.2\" y=\"0\" dx=\"1.8\" dy=\"2.7\" layer=\"1\"/>\n<smd name=\"2\" x=\"2.2\" y=\"0\" dx=\"1.8\" dy=\"2.7\" layer=\"1\"/>\n<text x=\"-3.175\" y=\"1.905\" size=\"1.27\" layer=\"25\">&gt;NAME</text>\n<text x=\"-3.175\" y=\"-3.175\" size=\"1.27\" layer=\"27\">&gt;VALUE</text>\n<rectangle x1=\"-2.4892\" y1=\"-1.3208\" x2=\"-1.6393\" y2=\"1.3292\" layer=\"51\"/>\n<rectangle x1=\"1.651\" y1=\"-1.3208\" x2=\"2.5009\" y2=\"1.3292\" layer=\"51\"/>\n<rectangle x1=\"-0.5001\" y1=\"-1\" x2=\"0.5001\" y2=\"1\" layer=\"35\"/>\n</package>\n<package name=\"R5025W\">\n<description>&lt;b&gt;RESISTOR&lt;/b&gt;&lt;p&gt;\nwave soldering</description>\n<wire x1=\"-1.662\" y1=\"1.245\" x2=\"1.662\" y2=\"1.245\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"-1.637\" y1=\"-1.245\" x2=\"1.687\" y2=\"-1.245\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"-3.473\" y1=\"1.483\" x2=\"3.473\" y2=\"1.483\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"3.473\" y1=\"1.483\" x2=\"3.473\" y2=\"-1.483\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"3.473\" y1=\"-1.483\" x2=\"-3.473\" y2=\"-1.483\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"-3.473\" y1=\"-1.483\" x2=\"-3.473\" y2=\"1.483\" width=\"0.0508\" layer=\"39\"/>\n<smd name=\"1\" x=\"-2.311\" y=\"0\" dx=\"2\" dy=\"1.8\" layer=\"1\"/>\n<smd name=\"2\" x=\"2.311\" y=\"0\" dx=\"2\" dy=\"1.8\" layer=\"1\"/>\n<text x=\"-3.175\" y=\"1.905\" size=\"1.27\" layer=\"25\">&gt;NAME</text>\n<text x=\"-3.175\" y=\"-3.175\" size=\"1.27\" layer=\"27\">&gt;VALUE</text>\n<rectangle x1=\"-2.4892\" y1=\"-1.3208\" x2=\"-1.6393\" y2=\"1.3292\" layer=\"51\"/>\n<rectangle x1=\"1.651\" y1=\"-1.3208\" x2=\"2.5009\" y2=\"1.3292\" layer=\"51\"/>\n<rectangle x1=\"-0.5001\" y1=\"-1\" x2=\"0.5001\" y2=\"1\" layer=\"35\"/>\n</package>\n<package name=\"R6332\">\n<description>&lt;b&gt;RESISTOR&lt;/b&gt;&lt;p&gt;\nSource: http://download.siliconexpert.com/pdfs/2005/02/24/Semi_Ap/2/VSH/Resistor/dcrcwfre.pdf</description>\n<wire x1=\"-2.362\" y1=\"1.473\" x2=\"2.387\" y2=\"1.473\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"-2.362\" y1=\"-1.473\" x2=\"2.387\" y2=\"-1.473\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"-3.973\" y1=\"1.983\" x2=\"3.973\" y2=\"1.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"3.973\" y1=\"1.983\" x2=\"3.973\" y2=\"-1.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"3.973\" y1=\"-1.983\" x2=\"-3.973\" y2=\"-1.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"-3.973\" y1=\"-1.983\" x2=\"-3.973\" y2=\"1.983\" width=\"0.0508\" layer=\"39\"/>\n<smd name=\"1\" x=\"-3.1\" y=\"0\" dx=\"1\" dy=\"3.2\" layer=\"1\"/>\n<smd name=\"2\" x=\"3.1\" y=\"0\" dx=\"1\" dy=\"3.2\" layer=\"1\"/>\n<text x=\"-2.54\" y=\"1.905\" size=\"1.27\" layer=\"25\">&gt;NAME</text>\n<text x=\"-2.54\" y=\"-3.175\" size=\"1.27\" layer=\"27\">&gt;VALUE</text>\n<rectangle x1=\"-3.2004\" y1=\"-1.5494\" x2=\"-2.3505\" y2=\"1.5507\" layer=\"51\"/>\n<rectangle x1=\"2.3622\" y1=\"-1.5494\" x2=\"3.2121\" y2=\"1.5507\" layer=\"51\"/>\n<rectangle x1=\"-0.5001\" y1=\"-1\" x2=\"0.5001\" y2=\"1\" layer=\"35\"/>\n</package>\n<package name=\"R6332W\">\n<description>&lt;b&gt;RESISTOR&lt;/b&gt; wave soldering&lt;p&gt;\nSource: http://download.siliconexpert.com/pdfs/2005/02/24/Semi_Ap/2/VSH/Resistor/dcrcwfre.pdf</description>\n<wire x1=\"-2.362\" y1=\"1.473\" x2=\"2.387\" y2=\"1.473\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"-2.362\" y1=\"-1.473\" x2=\"2.387\" y2=\"-1.473\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"-3.973\" y1=\"1.983\" x2=\"3.973\" y2=\"1.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"3.973\" y1=\"1.983\" x2=\"3.973\" y2=\"-1.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"3.973\" y1=\"-1.983\" x2=\"-3.973\" y2=\"-1.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"-3.973\" y1=\"-1.983\" x2=\"-3.973\" y2=\"1.983\" width=\"0.0508\" layer=\"39\"/>\n<smd name=\"1\" x=\"-3.196\" y=\"0\" dx=\"1.2\" dy=\"3.2\" layer=\"1\"/>\n<smd name=\"2\" x=\"3.196\" y=\"0\" dx=\"1.2\" dy=\"3.2\" layer=\"1\"/>\n<text x=\"-2.54\" y=\"1.905\" size=\"1.27\" layer=\"25\">&gt;NAME</text>\n<text x=\"-2.54\" y=\"-3.175\" size=\"1.27\" layer=\"27\">&gt;VALUE</text>\n<rectangle x1=\"-3.2004\" y1=\"-1.5494\" x2=\"-2.3505\" y2=\"1.5507\" layer=\"51\"/>\n<rectangle x1=\"2.3622\" y1=\"-1.5494\" x2=\"3.2121\" y2=\"1.5507\" layer=\"51\"/>\n<rectangle x1=\"-0.5001\" y1=\"-1\" x2=\"0.5001\" y2=\"1\" layer=\"35\"/>\n</package>\n<package name=\"M0805\">\n<description>&lt;b&gt;RESISTOR&lt;/b&gt;&lt;p&gt;\nMELF 0.10 W</description>\n<wire x1=\"-1.973\" y1=\"0.983\" x2=\"1.973\" y2=\"0.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"1.973\" y1=\"-0.983\" x2=\"-1.973\" y2=\"-0.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"-1.973\" y1=\"-0.983\" x2=\"-1.973\" y2=\"0.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"1.973\" y1=\"0.983\" x2=\"1.973\" y2=\"-0.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"0.7112\" y1=\"0.635\" x2=\"-0.7112\" y2=\"0.635\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"0.7112\" y1=\"-0.635\" x2=\"-0.7112\" y2=\"-0.635\" width=\"0.1524\" layer=\"51\"/>\n<smd name=\"1\" x=\"-0.95\" y=\"0\" dx=\"1.3\" dy=\"1.6\" layer=\"1\"/>\n<smd name=\"2\" x=\"0.95\" y=\"0\" dx=\"1.3\" dy=\"1.6\" layer=\"1\"/>\n<text x=\"-1.27\" y=\"1.27\" size=\"1.27\" layer=\"25\">&gt;NAME</text>\n<text x=\"-1.27\" y=\"-2.54\" size=\"1.27\" layer=\"27\">&gt;VALUE</text>\n<rectangle x1=\"-1.0414\" y1=\"-0.7112\" x2=\"-0.6858\" y2=\"0.7112\" layer=\"51\"/>\n<rectangle x1=\"0.6858\" y1=\"-0.7112\" x2=\"1.0414\" y2=\"0.7112\" layer=\"51\"/>\n<rectangle x1=\"-0.1999\" y1=\"-0.5999\" x2=\"0.1999\" y2=\"0.5999\" layer=\"35\"/>\n</package>\n<package name=\"M1206\">\n<description>&lt;b&gt;RESISTOR&lt;/b&gt;&lt;p&gt;\nMELF 0.25 W</description>\n<wire x1=\"-2.473\" y1=\"1.483\" x2=\"2.473\" y2=\"1.483\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"2.473\" y1=\"-1.483\" x2=\"-2.473\" y2=\"-1.483\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"-2.473\" y1=\"-1.483\" x2=\"-2.473\" y2=\"1.483\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"2.473\" y1=\"1.483\" x2=\"2.473\" y2=\"-1.483\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"1.143\" y1=\"0.8382\" x2=\"-1.143\" y2=\"0.8382\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"1.143\" y1=\"-0.8382\" x2=\"-1.143\" y2=\"-0.8382\" width=\"0.1524\" layer=\"51\"/>\n<smd name=\"1\" x=\"-1.4\" y=\"0\" dx=\"1.6\" dy=\"2\" layer=\"1\"/>\n<smd name=\"2\" x=\"1.4\" y=\"0\" dx=\"1.6\" dy=\"2\" layer=\"1\"/>\n<text x=\"-1.27\" y=\"1.27\" size=\"1.27\" layer=\"25\">&gt;NAME</text>\n<text x=\"-1.27\" y=\"-2.54\" size=\"1.27\" layer=\"27\">&gt;VALUE</text>\n<rectangle x1=\"-1.7018\" y1=\"-0.9144\" x2=\"-1.1176\" y2=\"0.9144\" layer=\"51\"/>\n<rectangle x1=\"1.1176\" y1=\"-0.9144\" x2=\"1.7018\" y2=\"0.9144\" layer=\"51\"/>\n<rectangle x1=\"-0.3\" y1=\"-0.8001\" x2=\"0.3\" y2=\"0.8001\" layer=\"35\"/>\n</package>\n<package name=\"M1406\">\n<description>&lt;b&gt;RESISTOR&lt;/b&gt;&lt;p&gt;\nMELF 0.12 W</description>\n<wire x1=\"-2.973\" y1=\"0.983\" x2=\"2.973\" y2=\"0.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"2.973\" y1=\"-0.983\" x2=\"-2.973\" y2=\"-0.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"-2.973\" y1=\"-0.983\" x2=\"-2.973\" y2=\"0.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"2.973\" y1=\"0.983\" x2=\"2.973\" y2=\"-0.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"1.3208\" y1=\"0.762\" x2=\"-1.3208\" y2=\"0.762\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"1.3208\" y1=\"-0.762\" x2=\"-1.3208\" y2=\"-0.762\" width=\"0.1524\" layer=\"51\"/>\n<smd name=\"1\" x=\"-1.7\" y=\"0\" dx=\"1.4\" dy=\"1.8\" layer=\"1\"/>\n<smd name=\"2\" x=\"1.7\" y=\"0\" dx=\"1.4\" dy=\"1.8\" layer=\"1\"/>\n<text x=\"-1.27\" y=\"1.27\" size=\"1.27\" layer=\"25\">&gt;NAME</text>\n<text x=\"-1.27\" y=\"-2.54\" size=\"1.27\" layer=\"27\">&gt;VALUE</text>\n<rectangle x1=\"-1.8542\" y1=\"-0.8382\" x2=\"-1.2954\" y2=\"0.8382\" layer=\"51\"/>\n<rectangle x1=\"1.2954\" y1=\"-0.8382\" x2=\"1.8542\" y2=\"0.8382\" layer=\"51\"/>\n<rectangle x1=\"-0.3\" y1=\"-0.7\" x2=\"0.3\" y2=\"0.7\" layer=\"35\"/>\n</package>\n<package name=\"M2012\">\n<description>&lt;b&gt;RESISTOR&lt;/b&gt;&lt;p&gt;\nMELF 0.10 W</description>\n<wire x1=\"-1.973\" y1=\"0.983\" x2=\"1.973\" y2=\"0.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"1.973\" y1=\"-0.983\" x2=\"-1.973\" y2=\"-0.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"-1.973\" y1=\"-0.983\" x2=\"-1.973\" y2=\"0.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"1.973\" y1=\"0.983\" x2=\"1.973\" y2=\"-0.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"0.7112\" y1=\"0.635\" x2=\"-0.7112\" y2=\"0.635\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"0.7112\" y1=\"-0.635\" x2=\"-0.7112\" y2=\"-0.635\" width=\"0.1524\" layer=\"51\"/>\n<smd name=\"1\" x=\"-0.95\" y=\"0\" dx=\"1.3\" dy=\"1.6\" layer=\"1\"/>\n<smd name=\"2\" x=\"0.95\" y=\"0\" dx=\"1.3\" dy=\"1.6\" layer=\"1\"/>\n<text x=\"-1.27\" y=\"1.27\" size=\"1.27\" layer=\"25\">&gt;NAME</text>\n<text x=\"-1.27\" y=\"-2.54\" size=\"1.27\" layer=\"27\">&gt;VALUE</text>\n<rectangle x1=\"-1.0414\" y1=\"-0.7112\" x2=\"-0.6858\" y2=\"0.7112\" layer=\"51\"/>\n<rectangle x1=\"0.6858\" y1=\"-0.7112\" x2=\"1.0414\" y2=\"0.7112\" layer=\"51\"/>\n<rectangle x1=\"-0.1999\" y1=\"-0.5999\" x2=\"0.1999\" y2=\"0.5999\" layer=\"35\"/>\n</package>\n<package name=\"M2309\">\n<description>&lt;b&gt;RESISTOR&lt;/b&gt;&lt;p&gt;\nMELF 0.25 W</description>\n<wire x1=\"-4.473\" y1=\"1.483\" x2=\"4.473\" y2=\"1.483\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"4.473\" y1=\"-1.483\" x2=\"-4.473\" y2=\"-1.483\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"-4.473\" y1=\"-1.483\" x2=\"-4.473\" y2=\"1.483\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"4.473\" y1=\"1.483\" x2=\"4.473\" y2=\"-1.483\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"2.413\" y1=\"1.1684\" x2=\"-2.4384\" y2=\"1.1684\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"2.413\" y1=\"-1.1684\" x2=\"-2.413\" y2=\"-1.1684\" width=\"0.1524\" layer=\"51\"/>\n<smd name=\"1\" x=\"-2.85\" y=\"0\" dx=\"1.5\" dy=\"2.6\" layer=\"1\"/>\n<smd name=\"2\" x=\"2.85\" y=\"0\" dx=\"1.5\" dy=\"2.6\" layer=\"1\"/>\n<text x=\"-1.905\" y=\"1.905\" size=\"1.27\" layer=\"25\">&gt;NAME</text>\n<text x=\"-2.54\" y=\"-2.54\" size=\"1.27\" layer=\"27\">&gt;VALUE</text>\n<rectangle x1=\"-3.048\" y1=\"-1.2446\" x2=\"-2.3876\" y2=\"1.2446\" layer=\"51\"/>\n<rectangle x1=\"2.3876\" y1=\"-1.2446\" x2=\"3.048\" y2=\"1.2446\" layer=\"51\"/>\n<rectangle x1=\"-0.5001\" y1=\"-1\" x2=\"0.5001\" y2=\"1\" layer=\"35\"/>\n</package>\n<package name=\"M3216\">\n<description>&lt;b&gt;RESISTOR&lt;/b&gt;&lt;p&gt;\nMELF 0.25 W</description>\n<wire x1=\"-2.473\" y1=\"1.483\" x2=\"2.473\" y2=\"1.483\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"2.473\" y1=\"-1.483\" x2=\"-2.473\" y2=\"-1.483\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"-2.473\" y1=\"-1.483\" x2=\"-2.473\" y2=\"1.483\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"2.473\" y1=\"1.483\" x2=\"2.473\" y2=\"-1.483\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"1.143\" y1=\"0.8382\" x2=\"-1.143\" y2=\"0.8382\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"1.143\" y1=\"-0.8382\" x2=\"-1.143\" y2=\"-0.8382\" width=\"0.1524\" layer=\"51\"/>\n<smd name=\"1\" x=\"-1.4\" y=\"0\" dx=\"1.6\" dy=\"2\" layer=\"1\"/>\n<smd name=\"2\" x=\"1.4\" y=\"0\" dx=\"1.6\" dy=\"2\" layer=\"1\"/>\n<text x=\"-1.27\" y=\"1.27\" size=\"1.27\" layer=\"25\">&gt;NAME</text>\n<text x=\"-1.27\" y=\"-2.54\" size=\"1.27\" layer=\"27\">&gt;VALUE</text>\n<rectangle x1=\"-1.7018\" y1=\"-0.9144\" x2=\"-1.1176\" y2=\"0.9144\" layer=\"51\"/>\n<rectangle x1=\"1.1176\" y1=\"-0.9144\" x2=\"1.7018\" y2=\"0.9144\" layer=\"51\"/>\n<rectangle x1=\"-0.3\" y1=\"-0.8001\" x2=\"0.3\" y2=\"0.8001\" layer=\"35\"/>\n</package>\n<package name=\"M3516\">\n<description>&lt;b&gt;RESISTOR&lt;/b&gt;&lt;p&gt;\nMELF 0.12 W</description>\n<wire x1=\"-2.973\" y1=\"0.983\" x2=\"2.973\" y2=\"0.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"2.973\" y1=\"-0.983\" x2=\"-2.973\" y2=\"-0.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"-2.973\" y1=\"-0.983\" x2=\"-2.973\" y2=\"0.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"2.973\" y1=\"0.983\" x2=\"2.973\" y2=\"-0.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"1.3208\" y1=\"0.762\" x2=\"-1.3208\" y2=\"0.762\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"1.3208\" y1=\"-0.762\" x2=\"-1.3208\" y2=\"-0.762\" width=\"0.1524\" layer=\"51\"/>\n<smd name=\"1\" x=\"-1.7\" y=\"0\" dx=\"1.4\" dy=\"1.8\" layer=\"1\"/>\n<smd name=\"2\" x=\"1.7\" y=\"0\" dx=\"1.4\" dy=\"1.8\" layer=\"1\"/>\n<text x=\"-1.27\" y=\"1.27\" size=\"1.27\" layer=\"25\">&gt;NAME</text>\n<text x=\"-1.27\" y=\"-2.54\" size=\"1.27\" layer=\"27\">&gt;VALUE</text>\n<rectangle x1=\"-1.8542\" y1=\"-0.8382\" x2=\"-1.2954\" y2=\"0.8382\" layer=\"51\"/>\n<rectangle x1=\"1.2954\" y1=\"-0.8382\" x2=\"1.8542\" y2=\"0.8382\" layer=\"51\"/>\n<rectangle x1=\"-0.4001\" y1=\"-0.7\" x2=\"0.4001\" y2=\"0.7\" layer=\"35\"/>\n</package>\n<package name=\"M5923\">\n<description>&lt;b&gt;RESISTOR&lt;/b&gt;&lt;p&gt;\nMELF 0.25 W</description>\n<wire x1=\"-4.473\" y1=\"1.483\" x2=\"4.473\" y2=\"1.483\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"4.473\" y1=\"-1.483\" x2=\"-4.473\" y2=\"-1.483\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"-4.473\" y1=\"-1.483\" x2=\"-4.473\" y2=\"1.483\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"4.473\" y1=\"1.483\" x2=\"4.473\" y2=\"-1.483\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"2.413\" y1=\"1.1684\" x2=\"-2.4384\" y2=\"1.1684\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"2.413\" y1=\"-1.1684\" x2=\"-2.413\" y2=\"-1.1684\" width=\"0.1524\" layer=\"51\"/>\n<smd name=\"1\" x=\"-2.85\" y=\"0\" dx=\"1.5\" dy=\"2.6\" layer=\"1\"/>\n<smd name=\"2\" x=\"2.85\" y=\"0\" dx=\"1.5\" dy=\"2.6\" layer=\"1\"/>\n<text x=\"-1.905\" y=\"1.905\" size=\"1.27\" layer=\"25\">&gt;NAME</text>\n<text x=\"-2.54\" y=\"-2.54\" size=\"1.27\" layer=\"27\">&gt;VALUE</text>\n<rectangle x1=\"-3.048\" y1=\"-1.2446\" x2=\"-2.3876\" y2=\"1.2446\" layer=\"51\"/>\n<rectangle x1=\"2.3876\" y1=\"-1.2446\" x2=\"3.048\" y2=\"1.2446\" layer=\"51\"/>\n<rectangle x1=\"-0.5001\" y1=\"-1\" x2=\"0.5001\" y2=\"1\" layer=\"35\"/>\n</package>\n<package name=\"0204/5\">\n<description>&lt;b&gt;RESISTOR&lt;/b&gt;&lt;p&gt;\ntype 0204, grid 5 mm</description>\n<wire x1=\"2.54\" y1=\"0\" x2=\"2.032\" y2=\"0\" width=\"0.508\" layer=\"51\"/>\n<wire x1=\"-2.54\" y1=\"0\" x2=\"-2.032\" y2=\"0\" width=\"0.508\" layer=\"51\"/>\n<wire x1=\"-1.778\" y1=\"0.635\" x2=\"-1.524\" y2=\"0.889\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"-1.778\" y1=\"-0.635\" x2=\"-1.524\" y2=\"-0.889\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"1.524\" y1=\"-0.889\" x2=\"1.778\" y2=\"-0.635\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"1.524\" y1=\"0.889\" x2=\"1.778\" y2=\"0.635\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"-1.778\" y1=\"-0.635\" x2=\"-1.778\" y2=\"0.635\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"-1.524\" y1=\"0.889\" x2=\"-1.27\" y2=\"0.889\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-1.143\" y1=\"0.762\" x2=\"-1.27\" y2=\"0.889\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-1.524\" y1=\"-0.889\" x2=\"-1.27\" y2=\"-0.889\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-1.143\" y1=\"-0.762\" x2=\"-1.27\" y2=\"-0.889\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"1.143\" y1=\"0.762\" x2=\"1.27\" y2=\"0.889\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"1.143\" y1=\"0.762\" x2=\"-1.143\" y2=\"0.762\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"1.143\" y1=\"-0.762\" x2=\"1.27\" y2=\"-0.889\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"1.143\" y1=\"-0.762\" x2=\"-1.143\" y2=\"-0.762\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"1.524\" y1=\"0.889\" x2=\"1.27\" y2=\"0.889\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"1.524\" y1=\"-0.889\" x2=\"1.27\" y2=\"-0.889\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"1.778\" y1=\"-0.635\" x2=\"1.778\" y2=\"0.635\" width=\"0.1524\" layer=\"51\"/>\n<pad name=\"1\" x=\"-2.54\" y=\"0\" drill=\"0.8128\" shape=\"octagon\"/>\n<pad name=\"2\" x=\"2.54\" y=\"0\" drill=\"0.8128\" shape=\"octagon\"/>\n<text x=\"-2.0066\" y=\"1.1684\" size=\"0.9906\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-2.1336\" y=\"-2.3114\" size=\"0.9906\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n<rectangle x1=\"-2.032\" y1=\"-0.254\" x2=\"-1.778\" y2=\"0.254\" layer=\"51\"/>\n<rectangle x1=\"1.778\" y1=\"-0.254\" x2=\"2.032\" y2=\"0.254\" layer=\"51\"/>\n</package>\n<package name=\"0204/7\">\n<description>&lt;b&gt;RESISTOR&lt;/b&gt;&lt;p&gt;\ntype 0204, grid 7.5 mm</description>\n<wire x1=\"3.81\" y1=\"0\" x2=\"2.921\" y2=\"0\" width=\"0.508\" layer=\"51\"/>\n<wire x1=\"-3.81\" y1=\"0\" x2=\"-2.921\" y2=\"0\" width=\"0.508\" layer=\"51\"/>\n<wire x1=\"-2.54\" y1=\"0.762\" x2=\"-2.286\" y2=\"1.016\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"-2.54\" y1=\"-0.762\" x2=\"-2.286\" y2=\"-1.016\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"2.286\" y1=\"-1.016\" x2=\"2.54\" y2=\"-0.762\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"2.286\" y1=\"1.016\" x2=\"2.54\" y2=\"0.762\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"-2.54\" y1=\"-0.762\" x2=\"-2.54\" y2=\"0.762\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-2.286\" y1=\"1.016\" x2=\"-1.905\" y2=\"1.016\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-1.778\" y1=\"0.889\" x2=\"-1.905\" y2=\"1.016\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-2.286\" y1=\"-1.016\" x2=\"-1.905\" y2=\"-1.016\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-1.778\" y1=\"-0.889\" x2=\"-1.905\" y2=\"-1.016\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"1.778\" y1=\"0.889\" x2=\"1.905\" y2=\"1.016\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"1.778\" y1=\"0.889\" x2=\"-1.778\" y2=\"0.889\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"1.778\" y1=\"-0.889\" x2=\"1.905\" y2=\"-1.016\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"1.778\" y1=\"-0.889\" x2=\"-1.778\" y2=\"-0.889\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.286\" y1=\"1.016\" x2=\"1.905\" y2=\"1.016\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.286\" y1=\"-1.016\" x2=\"1.905\" y2=\"-1.016\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.54\" y1=\"-0.762\" x2=\"2.54\" y2=\"0.762\" width=\"0.1524\" layer=\"21\"/>\n<pad name=\"1\" x=\"-3.81\" y=\"0\" drill=\"0.8128\" shape=\"octagon\"/>\n<pad name=\"2\" x=\"3.81\" y=\"0\" drill=\"0.8128\" shape=\"octagon\"/>\n<text x=\"-2.54\" y=\"1.2954\" size=\"0.9906\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-1.6256\" y=\"-0.4826\" size=\"0.9906\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n<rectangle x1=\"2.54\" y1=\"-0.254\" x2=\"2.921\" y2=\"0.254\" layer=\"21\"/>\n<rectangle x1=\"-2.921\" y1=\"-0.254\" x2=\"-2.54\" y2=\"0.254\" layer=\"21\"/>\n</package>\n<package name=\"0204V\">\n<description>&lt;b&gt;RESISTOR&lt;/b&gt;&lt;p&gt;\ntype 0204, grid 2.5 mm</description>\n<wire x1=\"-1.27\" y1=\"0\" x2=\"1.27\" y2=\"0\" width=\"0.508\" layer=\"51\"/>\n<wire x1=\"-0.127\" y1=\"0\" x2=\"0.127\" y2=\"0\" width=\"0.508\" layer=\"21\"/>\n<circle x=\"-1.27\" y=\"0\" radius=\"0.889\" width=\"0.1524\" layer=\"51\"/>\n<circle x=\"-1.27\" y=\"0\" radius=\"0.635\" width=\"0.0508\" layer=\"51\"/>\n<pad name=\"1\" x=\"-1.27\" y=\"0\" drill=\"0.8128\" shape=\"octagon\"/>\n<pad name=\"2\" x=\"1.27\" y=\"0\" drill=\"0.8128\" shape=\"octagon\"/>\n<text x=\"-2.1336\" y=\"1.1684\" size=\"1.27\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-2.1336\" y=\"-2.3114\" size=\"1.27\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n</package>\n<package name=\"0207/10\">\n<description>&lt;b&gt;RESISTOR&lt;/b&gt;&lt;p&gt;\ntype 0207, grid 10 mm</description>\n<wire x1=\"5.08\" y1=\"0\" x2=\"4.064\" y2=\"0\" width=\"0.6096\" layer=\"51\"/>\n<wire x1=\"-5.08\" y1=\"0\" x2=\"-4.064\" y2=\"0\" width=\"0.6096\" layer=\"51\"/>\n<wire x1=\"-3.175\" y1=\"0.889\" x2=\"-2.921\" y2=\"1.143\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"-3.175\" y1=\"-0.889\" x2=\"-2.921\" y2=\"-1.143\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"2.921\" y1=\"-1.143\" x2=\"3.175\" y2=\"-0.889\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"2.921\" y1=\"1.143\" x2=\"3.175\" y2=\"0.889\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"-3.175\" y1=\"-0.889\" x2=\"-3.175\" y2=\"0.889\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-2.921\" y1=\"1.143\" x2=\"-2.54\" y2=\"1.143\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-2.413\" y1=\"1.016\" x2=\"-2.54\" y2=\"1.143\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-2.921\" y1=\"-1.143\" x2=\"-2.54\" y2=\"-1.143\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-2.413\" y1=\"-1.016\" x2=\"-2.54\" y2=\"-1.143\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.413\" y1=\"1.016\" x2=\"2.54\" y2=\"1.143\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.413\" y1=\"1.016\" x2=\"-2.413\" y2=\"1.016\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.413\" y1=\"-1.016\" x2=\"2.54\" y2=\"-1.143\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.413\" y1=\"-1.016\" x2=\"-2.413\" y2=\"-1.016\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.921\" y1=\"1.143\" x2=\"2.54\" y2=\"1.143\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.921\" y1=\"-1.143\" x2=\"2.54\" y2=\"-1.143\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"3.175\" y1=\"-0.889\" x2=\"3.175\" y2=\"0.889\" width=\"0.1524\" layer=\"21\"/>\n<pad name=\"1\" x=\"-5.08\" y=\"0\" drill=\"0.8128\" shape=\"octagon\"/>\n<pad name=\"2\" x=\"5.08\" y=\"0\" drill=\"0.8128\" shape=\"octagon\"/>\n<text x=\"-3.048\" y=\"1.524\" size=\"1.27\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-2.2606\" y=\"-0.635\" size=\"1.27\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n<rectangle x1=\"3.175\" y1=\"-0.3048\" x2=\"4.0386\" y2=\"0.3048\" layer=\"21\"/>\n<rectangle x1=\"-4.0386\" y1=\"-0.3048\" x2=\"-3.175\" y2=\"0.3048\" layer=\"21\"/>\n</package>\n<package name=\"0207/12\">\n<description>&lt;b&gt;RESISTOR&lt;/b&gt;&lt;p&gt;\ntype 0207, grid 12 mm</description>\n<wire x1=\"6.35\" y1=\"0\" x2=\"5.334\" y2=\"0\" width=\"0.6096\" layer=\"51\"/>\n<wire x1=\"-6.35\" y1=\"0\" x2=\"-5.334\" y2=\"0\" width=\"0.6096\" layer=\"51\"/>\n<wire x1=\"-3.175\" y1=\"0.889\" x2=\"-2.921\" y2=\"1.143\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"-3.175\" y1=\"-0.889\" x2=\"-2.921\" y2=\"-1.143\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"2.921\" y1=\"-1.143\" x2=\"3.175\" y2=\"-0.889\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"2.921\" y1=\"1.143\" x2=\"3.175\" y2=\"0.889\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"-3.175\" y1=\"-0.889\" x2=\"-3.175\" y2=\"0.889\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-2.921\" y1=\"1.143\" x2=\"-2.54\" y2=\"1.143\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-2.413\" y1=\"1.016\" x2=\"-2.54\" y2=\"1.143\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-2.921\" y1=\"-1.143\" x2=\"-2.54\" y2=\"-1.143\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-2.413\" y1=\"-1.016\" x2=\"-2.54\" y2=\"-1.143\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.413\" y1=\"1.016\" x2=\"2.54\" y2=\"1.143\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.413\" y1=\"1.016\" x2=\"-2.413\" y2=\"1.016\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.413\" y1=\"-1.016\" x2=\"2.54\" y2=\"-1.143\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.413\" y1=\"-1.016\" x2=\"-2.413\" y2=\"-1.016\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.921\" y1=\"1.143\" x2=\"2.54\" y2=\"1.143\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.921\" y1=\"-1.143\" x2=\"2.54\" y2=\"-1.143\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"3.175\" y1=\"-0.889\" x2=\"3.175\" y2=\"0.889\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"4.445\" y1=\"0\" x2=\"4.064\" y2=\"0\" width=\"0.6096\" layer=\"21\"/>\n<wire x1=\"-4.445\" y1=\"0\" x2=\"-4.064\" y2=\"0\" width=\"0.6096\" layer=\"21\"/>\n<pad name=\"1\" x=\"-6.35\" y=\"0\" drill=\"0.8128\" shape=\"octagon\"/>\n<pad name=\"2\" x=\"6.35\" y=\"0\" drill=\"0.8128\" shape=\"octagon\"/>\n<text x=\"-3.175\" y=\"1.397\" size=\"1.27\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-2.286\" y=\"-0.6858\" size=\"1.27\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n<rectangle x1=\"3.175\" y1=\"-0.3048\" x2=\"4.0386\" y2=\"0.3048\" layer=\"21\"/>\n<rectangle x1=\"-4.0386\" y1=\"-0.3048\" x2=\"-3.175\" y2=\"0.3048\" layer=\"21\"/>\n<rectangle x1=\"4.445\" y1=\"-0.3048\" x2=\"5.3086\" y2=\"0.3048\" layer=\"21\"/>\n<rectangle x1=\"-5.3086\" y1=\"-0.3048\" x2=\"-4.445\" y2=\"0.3048\" layer=\"21\"/>\n</package>\n<package name=\"0207/15\">\n<description>&lt;b&gt;RESISTOR&lt;/b&gt;&lt;p&gt;\ntype 0207, grid 15mm</description>\n<wire x1=\"7.62\" y1=\"0\" x2=\"6.604\" y2=\"0\" width=\"0.6096\" layer=\"51\"/>\n<wire x1=\"-7.62\" y1=\"0\" x2=\"-6.604\" y2=\"0\" width=\"0.6096\" layer=\"51\"/>\n<wire x1=\"-3.175\" y1=\"0.889\" x2=\"-2.921\" y2=\"1.143\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"-3.175\" y1=\"-0.889\" x2=\"-2.921\" y2=\"-1.143\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"2.921\" y1=\"-1.143\" x2=\"3.175\" y2=\"-0.889\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"2.921\" y1=\"1.143\" x2=\"3.175\" y2=\"0.889\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"-3.175\" y1=\"-0.889\" x2=\"-3.175\" y2=\"0.889\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-2.921\" y1=\"1.143\" x2=\"-2.54\" y2=\"1.143\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-2.413\" y1=\"1.016\" x2=\"-2.54\" y2=\"1.143\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-2.921\" y1=\"-1.143\" x2=\"-2.54\" y2=\"-1.143\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-2.413\" y1=\"-1.016\" x2=\"-2.54\" y2=\"-1.143\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.413\" y1=\"1.016\" x2=\"2.54\" y2=\"1.143\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.413\" y1=\"1.016\" x2=\"-2.413\" y2=\"1.016\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.413\" y1=\"-1.016\" x2=\"2.54\" y2=\"-1.143\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.413\" y1=\"-1.016\" x2=\"-2.413\" y2=\"-1.016\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.921\" y1=\"1.143\" x2=\"2.54\" y2=\"1.143\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.921\" y1=\"-1.143\" x2=\"2.54\" y2=\"-1.143\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"3.175\" y1=\"-0.889\" x2=\"3.175\" y2=\"0.889\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"5.715\" y1=\"0\" x2=\"4.064\" y2=\"0\" width=\"0.6096\" layer=\"21\"/>\n<wire x1=\"-5.715\" y1=\"0\" x2=\"-4.064\" y2=\"0\" width=\"0.6096\" layer=\"21\"/>\n<pad name=\"1\" x=\"-7.62\" y=\"0\" drill=\"0.8128\" shape=\"octagon\"/>\n<pad name=\"2\" x=\"7.62\" y=\"0\" drill=\"0.8128\" shape=\"octagon\"/>\n<text x=\"-3.175\" y=\"1.397\" size=\"1.27\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-2.286\" y=\"-0.6858\" size=\"1.27\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n<rectangle x1=\"3.175\" y1=\"-0.3048\" x2=\"4.0386\" y2=\"0.3048\" layer=\"21\"/>\n<rectangle x1=\"-4.0386\" y1=\"-0.3048\" x2=\"-3.175\" y2=\"0.3048\" layer=\"21\"/>\n<rectangle x1=\"5.715\" y1=\"-0.3048\" x2=\"6.5786\" y2=\"0.3048\" layer=\"21\"/>\n<rectangle x1=\"-6.5786\" y1=\"-0.3048\" x2=\"-5.715\" y2=\"0.3048\" layer=\"21\"/>\n</package>\n<package name=\"0207/2V\">\n<description>&lt;b&gt;RESISTOR&lt;/b&gt;&lt;p&gt;\ntype 0207, grid 2.5 mm</description>\n<wire x1=\"-1.27\" y1=\"0\" x2=\"-0.381\" y2=\"0\" width=\"0.6096\" layer=\"51\"/>\n<wire x1=\"-0.254\" y1=\"0\" x2=\"0.254\" y2=\"0\" width=\"0.6096\" layer=\"21\"/>\n<wire x1=\"0.381\" y1=\"0\" x2=\"1.27\" y2=\"0\" width=\"0.6096\" layer=\"51\"/>\n<circle x=\"-1.27\" y=\"0\" radius=\"1.27\" width=\"0.1524\" layer=\"21\"/>\n<circle x=\"-1.27\" y=\"0\" radius=\"1.016\" width=\"0.1524\" layer=\"51\"/>\n<pad name=\"1\" x=\"-1.27\" y=\"0\" drill=\"0.8128\" shape=\"octagon\"/>\n<pad name=\"2\" x=\"1.27\" y=\"0\" drill=\"0.8128\" shape=\"octagon\"/>\n<text x=\"-0.0508\" y=\"1.016\" size=\"1.27\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-0.0508\" y=\"-2.2352\" size=\"1.27\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n</package>\n<package name=\"0207/5V\">\n<description>&lt;b&gt;RESISTOR&lt;/b&gt;&lt;p&gt;\ntype 0207, grid 5 mm</description>\n<wire x1=\"-2.54\" y1=\"0\" x2=\"-0.889\" y2=\"0\" width=\"0.6096\" layer=\"51\"/>\n<wire x1=\"-0.762\" y1=\"0\" x2=\"0.762\" y2=\"0\" width=\"0.6096\" layer=\"21\"/>\n<wire x1=\"0.889\" y1=\"0\" x2=\"2.54\" y2=\"0\" width=\"0.6096\" layer=\"51\"/>\n<circle x=\"-2.54\" y=\"0\" radius=\"1.27\" width=\"0.1016\" layer=\"21\"/>\n<circle x=\"-2.54\" y=\"0\" radius=\"1.016\" width=\"0.1524\" layer=\"51\"/>\n<pad name=\"1\" x=\"-2.54\" y=\"0\" drill=\"0.8128\" shape=\"octagon\"/>\n<pad name=\"2\" x=\"2.54\" y=\"0\" drill=\"0.8128\" shape=\"octagon\"/>\n<text x=\"-1.143\" y=\"0.889\" size=\"1.27\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-1.143\" y=\"-2.159\" size=\"1.27\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n</package>\n<package name=\"0207/7\">\n<description>&lt;b&gt;RESISTOR&lt;/b&gt;&lt;p&gt;\ntype 0207, grid 7.5 mm</description>\n<wire x1=\"-3.81\" y1=\"0\" x2=\"-3.429\" y2=\"0\" width=\"0.6096\" layer=\"51\"/>\n<wire x1=\"-3.175\" y1=\"0.889\" x2=\"-2.921\" y2=\"1.143\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"-3.175\" y1=\"-0.889\" x2=\"-2.921\" y2=\"-1.143\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"2.921\" y1=\"-1.143\" x2=\"3.175\" y2=\"-0.889\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"2.921\" y1=\"1.143\" x2=\"3.175\" y2=\"0.889\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"-3.175\" y1=\"-0.889\" x2=\"-3.175\" y2=\"0.889\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"-2.921\" y1=\"1.143\" x2=\"-2.54\" y2=\"1.143\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-2.413\" y1=\"1.016\" x2=\"-2.54\" y2=\"1.143\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-2.921\" y1=\"-1.143\" x2=\"-2.54\" y2=\"-1.143\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-2.413\" y1=\"-1.016\" x2=\"-2.54\" y2=\"-1.143\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.413\" y1=\"1.016\" x2=\"2.54\" y2=\"1.143\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.413\" y1=\"1.016\" x2=\"-2.413\" y2=\"1.016\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.413\" y1=\"-1.016\" x2=\"2.54\" y2=\"-1.143\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.413\" y1=\"-1.016\" x2=\"-2.413\" y2=\"-1.016\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.921\" y1=\"1.143\" x2=\"2.54\" y2=\"1.143\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.921\" y1=\"-1.143\" x2=\"2.54\" y2=\"-1.143\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"3.175\" y1=\"-0.889\" x2=\"3.175\" y2=\"0.889\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"3.429\" y1=\"0\" x2=\"3.81\" y2=\"0\" width=\"0.6096\" layer=\"51\"/>\n<pad name=\"1\" x=\"-3.81\" y=\"0\" drill=\"0.8128\" shape=\"octagon\"/>\n<pad name=\"2\" x=\"3.81\" y=\"0\" drill=\"0.8128\" shape=\"octagon\"/>\n<text x=\"-2.54\" y=\"1.397\" size=\"1.27\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-2.286\" y=\"-0.5588\" size=\"1.27\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n<rectangle x1=\"-3.429\" y1=\"-0.3048\" x2=\"-3.175\" y2=\"0.3048\" layer=\"51\"/>\n<rectangle x1=\"3.175\" y1=\"-0.3048\" x2=\"3.429\" y2=\"0.3048\" layer=\"51\"/>\n</package>\n<package name=\"0309/10\">\n<description>&lt;b&gt;RESISTOR&lt;/b&gt;&lt;p&gt;\ntype 0309, grid 10mm</description>\n<wire x1=\"-4.699\" y1=\"0\" x2=\"-5.08\" y2=\"0\" width=\"0.6096\" layer=\"51\"/>\n<wire x1=\"-4.318\" y1=\"1.27\" x2=\"-4.064\" y2=\"1.524\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"-4.318\" y1=\"-1.27\" x2=\"-4.064\" y2=\"-1.524\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"4.064\" y1=\"-1.524\" x2=\"4.318\" y2=\"-1.27\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"4.064\" y1=\"1.524\" x2=\"4.318\" y2=\"1.27\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"-4.318\" y1=\"-1.27\" x2=\"-4.318\" y2=\"1.27\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"-4.064\" y1=\"1.524\" x2=\"-3.429\" y2=\"1.524\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-3.302\" y1=\"1.397\" x2=\"-3.429\" y2=\"1.524\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-4.064\" y1=\"-1.524\" x2=\"-3.429\" y2=\"-1.524\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-3.302\" y1=\"-1.397\" x2=\"-3.429\" y2=\"-1.524\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"3.302\" y1=\"1.397\" x2=\"3.429\" y2=\"1.524\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"3.302\" y1=\"1.397\" x2=\"-3.302\" y2=\"1.397\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"3.302\" y1=\"-1.397\" x2=\"3.429\" y2=\"-1.524\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"3.302\" y1=\"-1.397\" x2=\"-3.302\" y2=\"-1.397\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"4.064\" y1=\"1.524\" x2=\"3.429\" y2=\"1.524\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"4.064\" y1=\"-1.524\" x2=\"3.429\" y2=\"-1.524\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"4.318\" y1=\"-1.27\" x2=\"4.318\" y2=\"1.27\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"5.08\" y1=\"0\" x2=\"4.699\" y2=\"0\" width=\"0.6096\" layer=\"51\"/>\n<pad name=\"1\" x=\"-5.08\" y=\"0\" drill=\"0.8128\" shape=\"octagon\"/>\n<pad name=\"2\" x=\"5.08\" y=\"0\" drill=\"0.8128\" shape=\"octagon\"/>\n<text x=\"-4.191\" y=\"1.905\" size=\"1.27\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-3.175\" y=\"-0.6858\" size=\"1.27\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n<rectangle x1=\"-4.6228\" y1=\"-0.3048\" x2=\"-4.318\" y2=\"0.3048\" layer=\"51\"/>\n<rectangle x1=\"4.318\" y1=\"-0.3048\" x2=\"4.6228\" y2=\"0.3048\" layer=\"51\"/>\n</package>\n<package name=\"0309/12\">\n<description>&lt;b&gt;RESISTOR&lt;/b&gt;&lt;p&gt;\ntype 0309, grid 12.5 mm</description>\n<wire x1=\"6.35\" y1=\"0\" x2=\"5.08\" y2=\"0\" width=\"0.6096\" layer=\"51\"/>\n<wire x1=\"-6.35\" y1=\"0\" x2=\"-5.08\" y2=\"0\" width=\"0.6096\" layer=\"51\"/>\n<wire x1=\"-4.318\" y1=\"1.27\" x2=\"-4.064\" y2=\"1.524\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"-4.318\" y1=\"-1.27\" x2=\"-4.064\" y2=\"-1.524\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"4.064\" y1=\"-1.524\" x2=\"4.318\" y2=\"-1.27\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"4.064\" y1=\"1.524\" x2=\"4.318\" y2=\"1.27\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"-4.318\" y1=\"-1.27\" x2=\"-4.318\" y2=\"1.27\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-4.064\" y1=\"1.524\" x2=\"-3.429\" y2=\"1.524\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-3.302\" y1=\"1.397\" x2=\"-3.429\" y2=\"1.524\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-4.064\" y1=\"-1.524\" x2=\"-3.429\" y2=\"-1.524\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-3.302\" y1=\"-1.397\" x2=\"-3.429\" y2=\"-1.524\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"3.302\" y1=\"1.397\" x2=\"3.429\" y2=\"1.524\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"3.302\" y1=\"1.397\" x2=\"-3.302\" y2=\"1.397\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"3.302\" y1=\"-1.397\" x2=\"3.429\" y2=\"-1.524\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"3.302\" y1=\"-1.397\" x2=\"-3.302\" y2=\"-1.397\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"4.064\" y1=\"1.524\" x2=\"3.429\" y2=\"1.524\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"4.064\" y1=\"-1.524\" x2=\"3.429\" y2=\"-1.524\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"4.318\" y1=\"-1.27\" x2=\"4.318\" y2=\"1.27\" width=\"0.1524\" layer=\"21\"/>\n<pad name=\"1\" x=\"-6.35\" y=\"0\" drill=\"0.8128\" shape=\"octagon\"/>\n<pad name=\"2\" x=\"6.35\" y=\"0\" drill=\"0.8128\" shape=\"octagon\"/>\n<text x=\"-4.191\" y=\"1.905\" size=\"1.27\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-3.175\" y=\"-0.6858\" size=\"1.27\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n<rectangle x1=\"4.318\" y1=\"-0.3048\" x2=\"5.1816\" y2=\"0.3048\" layer=\"21\"/>\n<rectangle x1=\"-5.1816\" y1=\"-0.3048\" x2=\"-4.318\" y2=\"0.3048\" layer=\"21\"/>\n</package>\n<package name=\"0309V\">\n<description>&lt;b&gt;RESISTOR&lt;/b&gt;&lt;p&gt;\ntype 0309, grid 2.5 mm</description>\n<wire x1=\"1.27\" y1=\"0\" x2=\"0.635\" y2=\"0\" width=\"0.6096\" layer=\"51\"/>\n<wire x1=\"-0.635\" y1=\"0\" x2=\"-1.27\" y2=\"0\" width=\"0.6096\" layer=\"51\"/>\n<circle x=\"-1.27\" y=\"0\" radius=\"1.524\" width=\"0.1524\" layer=\"21\"/>\n<circle x=\"-1.27\" y=\"0\" radius=\"0.762\" width=\"0.1524\" layer=\"51\"/>\n<pad name=\"1\" x=\"-1.27\" y=\"0\" drill=\"0.8128\" shape=\"octagon\"/>\n<pad name=\"2\" x=\"1.27\" y=\"0\" drill=\"0.8128\" shape=\"octagon\"/>\n<text x=\"0.254\" y=\"1.016\" size=\"1.27\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"0.254\" y=\"-2.2098\" size=\"1.27\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n<rectangle x1=\"0.254\" y1=\"-0.3048\" x2=\"0.5588\" y2=\"0.3048\" layer=\"51\"/>\n<rectangle x1=\"-0.635\" y1=\"-0.3048\" x2=\"-0.3302\" y2=\"0.3048\" layer=\"51\"/>\n<rectangle x1=\"-0.3302\" y1=\"-0.3048\" x2=\"0.254\" y2=\"0.3048\" layer=\"21\"/>\n</package>\n<package name=\"0411/12\">\n<description>&lt;b&gt;RESISTOR&lt;/b&gt;&lt;p&gt;\ntype 0411, grid 12.5 mm</description>\n<wire x1=\"6.35\" y1=\"0\" x2=\"5.461\" y2=\"0\" width=\"0.762\" layer=\"51\"/>\n<wire x1=\"-6.35\" y1=\"0\" x2=\"-5.461\" y2=\"0\" width=\"0.762\" layer=\"51\"/>\n<wire x1=\"5.08\" y1=\"-1.651\" x2=\"5.08\" y2=\"1.651\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"4.699\" y1=\"2.032\" x2=\"5.08\" y2=\"1.651\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"-5.08\" y1=\"-1.651\" x2=\"-4.699\" y2=\"-2.032\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"4.699\" y1=\"-2.032\" x2=\"5.08\" y2=\"-1.651\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"-5.08\" y1=\"1.651\" x2=\"-4.699\" y2=\"2.032\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"4.699\" y1=\"2.032\" x2=\"4.064\" y2=\"2.032\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"3.937\" y1=\"1.905\" x2=\"4.064\" y2=\"2.032\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"4.699\" y1=\"-2.032\" x2=\"4.064\" y2=\"-2.032\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"3.937\" y1=\"-1.905\" x2=\"4.064\" y2=\"-2.032\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-3.937\" y1=\"1.905\" x2=\"-4.064\" y2=\"2.032\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-3.937\" y1=\"1.905\" x2=\"3.937\" y2=\"1.905\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-3.937\" y1=\"-1.905\" x2=\"-4.064\" y2=\"-2.032\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-3.937\" y1=\"-1.905\" x2=\"3.937\" y2=\"-1.905\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-5.08\" y1=\"1.651\" x2=\"-5.08\" y2=\"-1.651\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-4.699\" y1=\"2.032\" x2=\"-4.064\" y2=\"2.032\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-4.699\" y1=\"-2.032\" x2=\"-4.064\" y2=\"-2.032\" width=\"0.1524\" layer=\"21\"/>\n<pad name=\"1\" x=\"-6.35\" y=\"0\" drill=\"0.9144\" shape=\"octagon\"/>\n<pad name=\"2\" x=\"6.35\" y=\"0\" drill=\"0.9144\" shape=\"octagon\"/>\n<text x=\"-5.08\" y=\"2.413\" size=\"1.27\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-3.5814\" y=\"-0.635\" size=\"1.27\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n<rectangle x1=\"-5.3594\" y1=\"-0.381\" x2=\"-5.08\" y2=\"0.381\" layer=\"21\"/>\n<rectangle x1=\"5.08\" y1=\"-0.381\" x2=\"5.3594\" y2=\"0.381\" layer=\"21\"/>\n</package>\n<package name=\"0411/15\">\n<description>&lt;b&gt;RESISTOR&lt;/b&gt;&lt;p&gt;\ntype 0411, grid 15 mm</description>\n<wire x1=\"5.08\" y1=\"-1.651\" x2=\"5.08\" y2=\"1.651\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"4.699\" y1=\"2.032\" x2=\"5.08\" y2=\"1.651\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"-5.08\" y1=\"-1.651\" x2=\"-4.699\" y2=\"-2.032\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"4.699\" y1=\"-2.032\" x2=\"5.08\" y2=\"-1.651\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"-5.08\" y1=\"1.651\" x2=\"-4.699\" y2=\"2.032\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"4.699\" y1=\"2.032\" x2=\"4.064\" y2=\"2.032\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"3.937\" y1=\"1.905\" x2=\"4.064\" y2=\"2.032\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"4.699\" y1=\"-2.032\" x2=\"4.064\" y2=\"-2.032\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"3.937\" y1=\"-1.905\" x2=\"4.064\" y2=\"-2.032\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-3.937\" y1=\"1.905\" x2=\"-4.064\" y2=\"2.032\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-3.937\" y1=\"1.905\" x2=\"3.937\" y2=\"1.905\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-3.937\" y1=\"-1.905\" x2=\"-4.064\" y2=\"-2.032\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-3.937\" y1=\"-1.905\" x2=\"3.937\" y2=\"-1.905\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-5.08\" y1=\"1.651\" x2=\"-5.08\" y2=\"-1.651\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-4.699\" y1=\"2.032\" x2=\"-4.064\" y2=\"2.032\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-4.699\" y1=\"-2.032\" x2=\"-4.064\" y2=\"-2.032\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-7.62\" y1=\"0\" x2=\"-6.35\" y2=\"0\" width=\"0.762\" layer=\"51\"/>\n<wire x1=\"6.35\" y1=\"0\" x2=\"7.62\" y2=\"0\" width=\"0.762\" layer=\"51\"/>\n<pad name=\"1\" x=\"-7.62\" y=\"0\" drill=\"0.9144\" shape=\"octagon\"/>\n<pad name=\"2\" x=\"7.62\" y=\"0\" drill=\"0.9144\" shape=\"octagon\"/>\n<text x=\"-5.08\" y=\"2.413\" size=\"1.27\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-3.5814\" y=\"-0.635\" size=\"1.27\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n<rectangle x1=\"5.08\" y1=\"-0.381\" x2=\"6.477\" y2=\"0.381\" layer=\"21\"/>\n<rectangle x1=\"-6.477\" y1=\"-0.381\" x2=\"-5.08\" y2=\"0.381\" layer=\"21\"/>\n</package>\n<package name=\"0411V\">\n<description>&lt;b&gt;RESISTOR&lt;/b&gt;&lt;p&gt;\ntype 0411, grid 3.81 mm</description>\n<wire x1=\"1.27\" y1=\"0\" x2=\"0.3048\" y2=\"0\" width=\"0.762\" layer=\"51\"/>\n<wire x1=\"-1.5748\" y1=\"0\" x2=\"-2.54\" y2=\"0\" width=\"0.762\" layer=\"51\"/>\n<circle x=\"-2.54\" y=\"0\" radius=\"2.032\" width=\"0.1524\" layer=\"21\"/>\n<circle x=\"-2.54\" y=\"0\" radius=\"1.016\" width=\"0.1524\" layer=\"51\"/>\n<pad name=\"1\" x=\"-2.54\" y=\"0\" drill=\"0.9144\" shape=\"octagon\"/>\n<pad name=\"2\" x=\"1.27\" y=\"0\" drill=\"0.9144\" shape=\"octagon\"/>\n<text x=\"-0.508\" y=\"1.143\" size=\"1.27\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-0.5334\" y=\"-2.413\" size=\"1.27\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n<rectangle x1=\"-1.4732\" y1=\"-0.381\" x2=\"0.2032\" y2=\"0.381\" layer=\"21\"/>\n</package>\n<package name=\"0414/15\">\n<description>&lt;b&gt;RESISTOR&lt;/b&gt;&lt;p&gt;\ntype 0414, grid 15 mm</description>\n<wire x1=\"7.62\" y1=\"0\" x2=\"6.604\" y2=\"0\" width=\"0.8128\" layer=\"51\"/>\n<wire x1=\"-7.62\" y1=\"0\" x2=\"-6.604\" y2=\"0\" width=\"0.8128\" layer=\"51\"/>\n<wire x1=\"-6.096\" y1=\"1.905\" x2=\"-5.842\" y2=\"2.159\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"-6.096\" y1=\"-1.905\" x2=\"-5.842\" y2=\"-2.159\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"5.842\" y1=\"-2.159\" x2=\"6.096\" y2=\"-1.905\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"5.842\" y1=\"2.159\" x2=\"6.096\" y2=\"1.905\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"-6.096\" y1=\"-1.905\" x2=\"-6.096\" y2=\"1.905\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-5.842\" y1=\"2.159\" x2=\"-4.953\" y2=\"2.159\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-4.826\" y1=\"2.032\" x2=\"-4.953\" y2=\"2.159\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-5.842\" y1=\"-2.159\" x2=\"-4.953\" y2=\"-2.159\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-4.826\" y1=\"-2.032\" x2=\"-4.953\" y2=\"-2.159\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"4.826\" y1=\"2.032\" x2=\"4.953\" y2=\"2.159\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"4.826\" y1=\"2.032\" x2=\"-4.826\" y2=\"2.032\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"4.826\" y1=\"-2.032\" x2=\"4.953\" y2=\"-2.159\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"4.826\" y1=\"-2.032\" x2=\"-4.826\" y2=\"-2.032\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"5.842\" y1=\"2.159\" x2=\"4.953\" y2=\"2.159\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"5.842\" y1=\"-2.159\" x2=\"4.953\" y2=\"-2.159\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"6.096\" y1=\"-1.905\" x2=\"6.096\" y2=\"1.905\" width=\"0.1524\" layer=\"21\"/>\n<pad name=\"1\" x=\"-7.62\" y=\"0\" drill=\"1.016\" shape=\"octagon\"/>\n<pad name=\"2\" x=\"7.62\" y=\"0\" drill=\"1.016\" shape=\"octagon\"/>\n<text x=\"-6.096\" y=\"2.5654\" size=\"1.27\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-4.318\" y=\"-0.5842\" size=\"1.27\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n<rectangle x1=\"6.096\" y1=\"-0.4064\" x2=\"6.5024\" y2=\"0.4064\" layer=\"21\"/>\n<rectangle x1=\"-6.5024\" y1=\"-0.4064\" x2=\"-6.096\" y2=\"0.4064\" layer=\"21\"/>\n</package>\n<package name=\"0414V\">\n<description>&lt;b&gt;RESISTOR&lt;/b&gt;&lt;p&gt;\ntype 0414, grid 5 mm</description>\n<wire x1=\"2.54\" y1=\"0\" x2=\"1.397\" y2=\"0\" width=\"0.8128\" layer=\"51\"/>\n<wire x1=\"-2.54\" y1=\"0\" x2=\"-1.397\" y2=\"0\" width=\"0.8128\" layer=\"51\"/>\n<circle x=\"-2.54\" y=\"0\" radius=\"2.159\" width=\"0.1524\" layer=\"21\"/>\n<circle x=\"-2.54\" y=\"0\" radius=\"1.143\" width=\"0.1524\" layer=\"51\"/>\n<pad name=\"1\" x=\"-2.54\" y=\"0\" drill=\"1.016\" shape=\"octagon\"/>\n<pad name=\"2\" x=\"2.54\" y=\"0\" drill=\"1.016\" shape=\"octagon\"/>\n<text x=\"-0.381\" y=\"1.1684\" size=\"1.27\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-0.381\" y=\"-2.3622\" size=\"1.27\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n<rectangle x1=\"-1.2954\" y1=\"-0.4064\" x2=\"1.2954\" y2=\"0.4064\" layer=\"21\"/>\n</package>\n<package name=\"0617/17\">\n<description>&lt;b&gt;RESISTOR&lt;/b&gt;&lt;p&gt;\ntype 0617, grid 17.5 mm</description>\n<wire x1=\"-8.89\" y1=\"0\" x2=\"-8.636\" y2=\"0\" width=\"0.8128\" layer=\"51\"/>\n<wire x1=\"-7.874\" y1=\"3.048\" x2=\"-6.985\" y2=\"3.048\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-6.731\" y1=\"2.794\" x2=\"-6.985\" y2=\"3.048\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-7.874\" y1=\"-3.048\" x2=\"-6.985\" y2=\"-3.048\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-6.731\" y1=\"-2.794\" x2=\"-6.985\" y2=\"-3.048\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"6.731\" y1=\"2.794\" x2=\"6.985\" y2=\"3.048\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"6.731\" y1=\"2.794\" x2=\"-6.731\" y2=\"2.794\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"6.731\" y1=\"-2.794\" x2=\"6.985\" y2=\"-3.048\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"6.731\" y1=\"-2.794\" x2=\"-6.731\" y2=\"-2.794\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"7.874\" y1=\"3.048\" x2=\"6.985\" y2=\"3.048\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"7.874\" y1=\"-3.048\" x2=\"6.985\" y2=\"-3.048\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-8.255\" y1=\"-2.667\" x2=\"-8.255\" y2=\"-1.016\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-8.255\" y1=\"1.016\" x2=\"-8.255\" y2=\"-1.016\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"-8.255\" y1=\"1.016\" x2=\"-8.255\" y2=\"2.667\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"8.255\" y1=\"-2.667\" x2=\"8.255\" y2=\"-1.016\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"8.255\" y1=\"1.016\" x2=\"8.255\" y2=\"-1.016\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"8.255\" y1=\"1.016\" x2=\"8.255\" y2=\"2.667\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"8.636\" y1=\"0\" x2=\"8.89\" y2=\"0\" width=\"0.8128\" layer=\"51\"/>\n<wire x1=\"-8.255\" y1=\"2.667\" x2=\"-7.874\" y2=\"3.048\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"7.874\" y1=\"3.048\" x2=\"8.255\" y2=\"2.667\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"-8.255\" y1=\"-2.667\" x2=\"-7.874\" y2=\"-3.048\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"7.874\" y1=\"-3.048\" x2=\"8.255\" y2=\"-2.667\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<pad name=\"1\" x=\"-8.89\" y=\"0\" drill=\"1.016\" shape=\"octagon\"/>\n<pad name=\"2\" x=\"8.89\" y=\"0\" drill=\"1.016\" shape=\"octagon\"/>\n<text x=\"-8.128\" y=\"3.4544\" size=\"1.27\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-6.096\" y=\"-0.7112\" size=\"1.27\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n<rectangle x1=\"-8.5344\" y1=\"-0.4064\" x2=\"-8.2296\" y2=\"0.4064\" layer=\"51\"/>\n<rectangle x1=\"8.2296\" y1=\"-0.4064\" x2=\"8.5344\" y2=\"0.4064\" layer=\"51\"/>\n</package>\n<package name=\"0617/22\">\n<description>&lt;b&gt;RESISTOR&lt;/b&gt;&lt;p&gt;\ntype 0617, grid 22.5 mm</description>\n<wire x1=\"-10.287\" y1=\"0\" x2=\"-11.43\" y2=\"0\" width=\"0.8128\" layer=\"51\"/>\n<wire x1=\"-8.255\" y1=\"-2.667\" x2=\"-8.255\" y2=\"2.667\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-7.874\" y1=\"3.048\" x2=\"-6.985\" y2=\"3.048\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-6.731\" y1=\"2.794\" x2=\"-6.985\" y2=\"3.048\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-7.874\" y1=\"-3.048\" x2=\"-6.985\" y2=\"-3.048\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-6.731\" y1=\"-2.794\" x2=\"-6.985\" y2=\"-3.048\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"6.731\" y1=\"2.794\" x2=\"6.985\" y2=\"3.048\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"6.731\" y1=\"2.794\" x2=\"-6.731\" y2=\"2.794\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"6.731\" y1=\"-2.794\" x2=\"6.985\" y2=\"-3.048\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"6.731\" y1=\"-2.794\" x2=\"-6.731\" y2=\"-2.794\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"7.874\" y1=\"3.048\" x2=\"6.985\" y2=\"3.048\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"7.874\" y1=\"-3.048\" x2=\"6.985\" y2=\"-3.048\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"8.255\" y1=\"-2.667\" x2=\"8.255\" y2=\"2.667\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"11.43\" y1=\"0\" x2=\"10.287\" y2=\"0\" width=\"0.8128\" layer=\"51\"/>\n<wire x1=\"-8.255\" y1=\"2.667\" x2=\"-7.874\" y2=\"3.048\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"-8.255\" y1=\"-2.667\" x2=\"-7.874\" y2=\"-3.048\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"7.874\" y1=\"3.048\" x2=\"8.255\" y2=\"2.667\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"7.874\" y1=\"-3.048\" x2=\"8.255\" y2=\"-2.667\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<pad name=\"1\" x=\"-11.43\" y=\"0\" drill=\"1.016\" shape=\"octagon\"/>\n<pad name=\"2\" x=\"11.43\" y=\"0\" drill=\"1.016\" shape=\"octagon\"/>\n<text x=\"-8.255\" y=\"3.4544\" size=\"1.27\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-6.477\" y=\"-0.5842\" size=\"1.27\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n<rectangle x1=\"-10.1854\" y1=\"-0.4064\" x2=\"-8.255\" y2=\"0.4064\" layer=\"21\"/>\n<rectangle x1=\"8.255\" y1=\"-0.4064\" x2=\"10.1854\" y2=\"0.4064\" layer=\"21\"/>\n</package>\n<package name=\"0617V\">\n<description>&lt;b&gt;RESISTOR&lt;/b&gt;&lt;p&gt;\ntype 0617, grid 5 mm</description>\n<wire x1=\"-2.54\" y1=\"0\" x2=\"-1.27\" y2=\"0\" width=\"0.8128\" layer=\"51\"/>\n<wire x1=\"1.27\" y1=\"0\" x2=\"2.54\" y2=\"0\" width=\"0.8128\" layer=\"51\"/>\n<circle x=\"-2.54\" y=\"0\" radius=\"3.048\" width=\"0.1524\" layer=\"21\"/>\n<circle x=\"-2.54\" y=\"0\" radius=\"1.143\" width=\"0.1524\" layer=\"51\"/>\n<pad name=\"1\" x=\"-2.54\" y=\"0\" drill=\"1.016\" shape=\"octagon\"/>\n<pad name=\"2\" x=\"2.54\" y=\"0\" drill=\"1.016\" shape=\"octagon\"/>\n<text x=\"0.635\" y=\"1.4224\" size=\"1.27\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"0.635\" y=\"-2.6162\" size=\"1.27\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n<rectangle x1=\"-1.3208\" y1=\"-0.4064\" x2=\"1.3208\" y2=\"0.4064\" layer=\"21\"/>\n</package>\n<package name=\"0922/22\">\n<description>&lt;b&gt;RESISTOR&lt;/b&gt;&lt;p&gt;\ntype 0922, grid 22.5 mm</description>\n<wire x1=\"11.43\" y1=\"0\" x2=\"10.795\" y2=\"0\" width=\"0.8128\" layer=\"51\"/>\n<wire x1=\"-11.43\" y1=\"0\" x2=\"-10.795\" y2=\"0\" width=\"0.8128\" layer=\"51\"/>\n<wire x1=\"-10.16\" y1=\"-4.191\" x2=\"-10.16\" y2=\"4.191\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-9.779\" y1=\"4.572\" x2=\"-8.89\" y2=\"4.572\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-8.636\" y1=\"4.318\" x2=\"-8.89\" y2=\"4.572\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-9.779\" y1=\"-4.572\" x2=\"-8.89\" y2=\"-4.572\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-8.636\" y1=\"-4.318\" x2=\"-8.89\" y2=\"-4.572\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"8.636\" y1=\"4.318\" x2=\"8.89\" y2=\"4.572\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"8.636\" y1=\"4.318\" x2=\"-8.636\" y2=\"4.318\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"8.636\" y1=\"-4.318\" x2=\"8.89\" y2=\"-4.572\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"8.636\" y1=\"-4.318\" x2=\"-8.636\" y2=\"-4.318\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"9.779\" y1=\"4.572\" x2=\"8.89\" y2=\"4.572\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"9.779\" y1=\"-4.572\" x2=\"8.89\" y2=\"-4.572\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"10.16\" y1=\"-4.191\" x2=\"10.16\" y2=\"4.191\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-10.16\" y1=\"-4.191\" x2=\"-9.779\" y2=\"-4.572\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"-10.16\" y1=\"4.191\" x2=\"-9.779\" y2=\"4.572\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"9.779\" y1=\"-4.572\" x2=\"10.16\" y2=\"-4.191\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"9.779\" y1=\"4.572\" x2=\"10.16\" y2=\"4.191\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<pad name=\"1\" x=\"-11.43\" y=\"0\" drill=\"1.016\" shape=\"octagon\"/>\n<pad name=\"2\" x=\"11.43\" y=\"0\" drill=\"1.016\" shape=\"octagon\"/>\n<text x=\"-10.16\" y=\"5.1054\" size=\"1.27\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-6.477\" y=\"-0.5842\" size=\"1.27\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n<rectangle x1=\"-10.7188\" y1=\"-0.4064\" x2=\"-10.16\" y2=\"0.4064\" layer=\"51\"/>\n<rectangle x1=\"10.16\" y1=\"-0.4064\" x2=\"10.3124\" y2=\"0.4064\" layer=\"21\"/>\n<rectangle x1=\"-10.3124\" y1=\"-0.4064\" x2=\"-10.16\" y2=\"0.4064\" layer=\"21\"/>\n<rectangle x1=\"10.16\" y1=\"-0.4064\" x2=\"10.7188\" y2=\"0.4064\" layer=\"51\"/>\n</package>\n<package name=\"P0613V\">\n<description>&lt;b&gt;RESISTOR&lt;/b&gt;&lt;p&gt;\ntype 0613, grid 5 mm</description>\n<wire x1=\"2.54\" y1=\"0\" x2=\"1.397\" y2=\"0\" width=\"0.8128\" layer=\"51\"/>\n<wire x1=\"-2.54\" y1=\"0\" x2=\"-1.397\" y2=\"0\" width=\"0.8128\" layer=\"51\"/>\n<circle x=\"-2.54\" y=\"0\" radius=\"2.286\" width=\"0.1524\" layer=\"21\"/>\n<circle x=\"-2.54\" y=\"0\" radius=\"1.143\" width=\"0.1524\" layer=\"51\"/>\n<pad name=\"1\" x=\"-2.54\" y=\"0\" drill=\"1.016\" shape=\"octagon\"/>\n<pad name=\"2\" x=\"2.54\" y=\"0\" drill=\"1.016\" shape=\"octagon\"/>\n<text x=\"-0.254\" y=\"1.143\" size=\"1.27\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-0.254\" y=\"-2.413\" size=\"1.27\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n<rectangle x1=\"-1.2954\" y1=\"-0.4064\" x2=\"1.3208\" y2=\"0.4064\" layer=\"21\"/>\n</package>\n<package name=\"P0613/15\">\n<description>&lt;b&gt;RESISTOR&lt;/b&gt;&lt;p&gt;\ntype 0613, grid 15 mm</description>\n<wire x1=\"7.62\" y1=\"0\" x2=\"6.985\" y2=\"0\" width=\"0.8128\" layer=\"51\"/>\n<wire x1=\"-7.62\" y1=\"0\" x2=\"-6.985\" y2=\"0\" width=\"0.8128\" layer=\"51\"/>\n<wire x1=\"-6.477\" y1=\"2.032\" x2=\"-6.223\" y2=\"2.286\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"-6.477\" y1=\"-2.032\" x2=\"-6.223\" y2=\"-2.286\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"6.223\" y1=\"-2.286\" x2=\"6.477\" y2=\"-2.032\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"6.223\" y1=\"2.286\" x2=\"6.477\" y2=\"2.032\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"-6.223\" y1=\"2.286\" x2=\"-5.334\" y2=\"2.286\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-5.207\" y1=\"2.159\" x2=\"-5.334\" y2=\"2.286\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-6.223\" y1=\"-2.286\" x2=\"-5.334\" y2=\"-2.286\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-5.207\" y1=\"-2.159\" x2=\"-5.334\" y2=\"-2.286\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"5.207\" y1=\"2.159\" x2=\"5.334\" y2=\"2.286\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"5.207\" y1=\"2.159\" x2=\"-5.207\" y2=\"2.159\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"5.207\" y1=\"-2.159\" x2=\"5.334\" y2=\"-2.286\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"5.207\" y1=\"-2.159\" x2=\"-5.207\" y2=\"-2.159\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"6.223\" y1=\"2.286\" x2=\"5.334\" y2=\"2.286\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"6.223\" y1=\"-2.286\" x2=\"5.334\" y2=\"-2.286\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"6.477\" y1=\"-0.635\" x2=\"6.477\" y2=\"-2.032\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"6.477\" y1=\"-0.635\" x2=\"6.477\" y2=\"0.635\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"6.477\" y1=\"2.032\" x2=\"6.477\" y2=\"0.635\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-6.477\" y1=\"-2.032\" x2=\"-6.477\" y2=\"-0.635\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-6.477\" y1=\"0.635\" x2=\"-6.477\" y2=\"-0.635\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"-6.477\" y1=\"0.635\" x2=\"-6.477\" y2=\"2.032\" width=\"0.1524\" layer=\"21\"/>\n<pad name=\"1\" x=\"-7.62\" y=\"0\" drill=\"1.016\" shape=\"octagon\"/>\n<pad name=\"2\" x=\"7.62\" y=\"0\" drill=\"1.016\" shape=\"octagon\"/>\n<text x=\"-6.477\" y=\"2.6924\" size=\"1.27\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-4.318\" y=\"-0.7112\" size=\"1.27\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n<rectangle x1=\"-7.0358\" y1=\"-0.4064\" x2=\"-6.477\" y2=\"0.4064\" layer=\"51\"/>\n<rectangle x1=\"6.477\" y1=\"-0.4064\" x2=\"7.0358\" y2=\"0.4064\" layer=\"51\"/>\n</package>\n<package name=\"P0817/22\">\n<description>&lt;b&gt;RESISTOR&lt;/b&gt;&lt;p&gt;\ntype 0817, grid 22.5 mm</description>\n<wire x1=\"-10.414\" y1=\"0\" x2=\"-11.43\" y2=\"0\" width=\"0.8128\" layer=\"51\"/>\n<wire x1=\"-8.509\" y1=\"-3.429\" x2=\"-8.509\" y2=\"3.429\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-8.128\" y1=\"3.81\" x2=\"-7.239\" y2=\"3.81\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-6.985\" y1=\"3.556\" x2=\"-7.239\" y2=\"3.81\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-8.128\" y1=\"-3.81\" x2=\"-7.239\" y2=\"-3.81\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-6.985\" y1=\"-3.556\" x2=\"-7.239\" y2=\"-3.81\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"6.985\" y1=\"3.556\" x2=\"7.239\" y2=\"3.81\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"6.985\" y1=\"3.556\" x2=\"-6.985\" y2=\"3.556\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"6.985\" y1=\"-3.556\" x2=\"7.239\" y2=\"-3.81\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"6.985\" y1=\"-3.556\" x2=\"-6.985\" y2=\"-3.556\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"8.128\" y1=\"3.81\" x2=\"7.239\" y2=\"3.81\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"8.128\" y1=\"-3.81\" x2=\"7.239\" y2=\"-3.81\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"8.509\" y1=\"-3.429\" x2=\"8.509\" y2=\"3.429\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"11.43\" y1=\"0\" x2=\"10.414\" y2=\"0\" width=\"0.8128\" layer=\"51\"/>\n<wire x1=\"-8.509\" y1=\"3.429\" x2=\"-8.128\" y2=\"3.81\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"-8.509\" y1=\"-3.429\" x2=\"-8.128\" y2=\"-3.81\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"8.128\" y1=\"3.81\" x2=\"8.509\" y2=\"3.429\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"8.128\" y1=\"-3.81\" x2=\"8.509\" y2=\"-3.429\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<pad name=\"1\" x=\"-11.43\" y=\"0\" drill=\"1.016\" shape=\"octagon\"/>\n<pad name=\"2\" x=\"11.43\" y=\"0\" drill=\"1.016\" shape=\"octagon\"/>\n<text x=\"-8.382\" y=\"4.2164\" size=\"1.27\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-6.223\" y=\"-0.5842\" size=\"1.27\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n<text x=\"6.604\" y=\"-2.2606\" size=\"1.27\" layer=\"51\" ratio=\"10\" rot=\"R90\">0817</text>\n<rectangle x1=\"8.509\" y1=\"-0.4064\" x2=\"10.3124\" y2=\"0.4064\" layer=\"21\"/>\n<rectangle x1=\"-10.3124\" y1=\"-0.4064\" x2=\"-8.509\" y2=\"0.4064\" layer=\"21\"/>\n</package>\n<package name=\"P0817V\">\n<description>&lt;b&gt;RESISTOR&lt;/b&gt;&lt;p&gt;\ntype 0817, grid 6.35 mm</description>\n<wire x1=\"-3.81\" y1=\"0\" x2=\"-5.08\" y2=\"0\" width=\"0.8128\" layer=\"51\"/>\n<wire x1=\"1.27\" y1=\"0\" x2=\"0\" y2=\"0\" width=\"0.8128\" layer=\"51\"/>\n<circle x=\"-5.08\" y=\"0\" radius=\"3.81\" width=\"0.1524\" layer=\"21\"/>\n<circle x=\"-5.08\" y=\"0\" radius=\"1.27\" width=\"0.1524\" layer=\"51\"/>\n<pad name=\"1\" x=\"-5.08\" y=\"0\" drill=\"1.016\" shape=\"octagon\"/>\n<pad name=\"2\" x=\"1.27\" y=\"0\" drill=\"1.016\" shape=\"octagon\"/>\n<text x=\"-1.016\" y=\"1.27\" size=\"1.27\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-1.016\" y=\"-2.54\" size=\"1.27\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n<text x=\"-6.858\" y=\"2.032\" size=\"1.016\" layer=\"21\" ratio=\"12\">0817</text>\n<rectangle x1=\"-3.81\" y1=\"-0.4064\" x2=\"0\" y2=\"0.4064\" layer=\"21\"/>\n</package>\n<package name=\"V234/12\">\n<description>&lt;b&gt;RESISTOR&lt;/b&gt;&lt;p&gt;\ntype V234, grid 12.5 mm</description>\n<wire x1=\"-4.953\" y1=\"1.524\" x2=\"-4.699\" y2=\"1.778\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"4.699\" y1=\"1.778\" x2=\"4.953\" y2=\"1.524\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"4.699\" y1=\"-1.778\" x2=\"4.953\" y2=\"-1.524\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"-4.953\" y1=\"-1.524\" x2=\"-4.699\" y2=\"-1.778\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"-4.699\" y1=\"1.778\" x2=\"4.699\" y2=\"1.778\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-4.953\" y1=\"1.524\" x2=\"-4.953\" y2=\"-1.524\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"4.699\" y1=\"-1.778\" x2=\"-4.699\" y2=\"-1.778\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"4.953\" y1=\"1.524\" x2=\"4.953\" y2=\"-1.524\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"6.35\" y1=\"0\" x2=\"5.461\" y2=\"0\" width=\"0.8128\" layer=\"51\"/>\n<wire x1=\"-6.35\" y1=\"0\" x2=\"-5.461\" y2=\"0\" width=\"0.8128\" layer=\"51\"/>\n<pad name=\"1\" x=\"-6.35\" y=\"0\" drill=\"1.016\" shape=\"octagon\"/>\n<pad name=\"2\" x=\"6.35\" y=\"0\" drill=\"1.016\" shape=\"octagon\"/>\n<text x=\"-4.953\" y=\"2.159\" size=\"1.27\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-3.81\" y=\"-0.635\" size=\"1.27\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n<rectangle x1=\"4.953\" y1=\"-0.4064\" x2=\"5.4102\" y2=\"0.4064\" layer=\"21\"/>\n<rectangle x1=\"-5.4102\" y1=\"-0.4064\" x2=\"-4.953\" y2=\"0.4064\" layer=\"21\"/>\n</package>\n<package name=\"V235/17\">\n<description>&lt;b&gt;RESISTOR&lt;/b&gt;&lt;p&gt;\ntype V235, grid 17.78 mm</description>\n<wire x1=\"-6.731\" y1=\"2.921\" x2=\"6.731\" y2=\"2.921\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-7.112\" y1=\"2.54\" x2=\"-7.112\" y2=\"-2.54\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"6.731\" y1=\"-2.921\" x2=\"-6.731\" y2=\"-2.921\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"7.112\" y1=\"2.54\" x2=\"7.112\" y2=\"-2.54\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"8.89\" y1=\"0\" x2=\"7.874\" y2=\"0\" width=\"1.016\" layer=\"51\"/>\n<wire x1=\"-7.874\" y1=\"0\" x2=\"-8.89\" y2=\"0\" width=\"1.016\" layer=\"51\"/>\n<wire x1=\"-7.112\" y1=\"-2.54\" x2=\"-6.731\" y2=\"-2.921\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"6.731\" y1=\"2.921\" x2=\"7.112\" y2=\"2.54\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"6.731\" y1=\"-2.921\" x2=\"7.112\" y2=\"-2.54\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"-7.112\" y1=\"2.54\" x2=\"-6.731\" y2=\"2.921\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<pad name=\"1\" x=\"-8.89\" y=\"0\" drill=\"1.1938\" shape=\"octagon\"/>\n<pad name=\"2\" x=\"8.89\" y=\"0\" drill=\"1.1938\" shape=\"octagon\"/>\n<text x=\"-6.858\" y=\"3.302\" size=\"1.27\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-5.842\" y=\"-0.635\" size=\"1.27\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n<rectangle x1=\"7.112\" y1=\"-0.508\" x2=\"7.747\" y2=\"0.508\" layer=\"21\"/>\n<rectangle x1=\"-7.747\" y1=\"-0.508\" x2=\"-7.112\" y2=\"0.508\" layer=\"21\"/>\n</package>\n<package name=\"V526-0\">\n<description>&lt;b&gt;RESISTOR&lt;/b&gt;&lt;p&gt;\ntype V526-0, grid 2.5 mm</description>\n<wire x1=\"-2.54\" y1=\"1.016\" x2=\"-2.286\" y2=\"1.27\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"2.286\" y1=\"1.27\" x2=\"2.54\" y2=\"1.016\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"2.286\" y1=\"-1.27\" x2=\"2.54\" y2=\"-1.016\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"-2.54\" y1=\"-1.016\" x2=\"-2.286\" y2=\"-1.27\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"2.286\" y1=\"1.27\" x2=\"-2.286\" y2=\"1.27\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.54\" y1=\"-1.016\" x2=\"2.54\" y2=\"1.016\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-2.286\" y1=\"-1.27\" x2=\"2.286\" y2=\"-1.27\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-2.54\" y1=\"1.016\" x2=\"-2.54\" y2=\"-1.016\" width=\"0.1524\" layer=\"21\"/>\n<pad name=\"1\" x=\"-1.27\" y=\"0\" drill=\"0.8128\" shape=\"octagon\"/>\n<pad name=\"2\" x=\"1.27\" y=\"0\" drill=\"0.8128\" shape=\"octagon\"/>\n<text x=\"-2.413\" y=\"1.651\" size=\"1.27\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-2.413\" y=\"-2.794\" size=\"1.27\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n</package>\n<package name=\"MINI_MELF-0102R\">\n<description>&lt;b&gt;CECC Size RC2211&lt;/b&gt; Reflow Soldering&lt;p&gt;\nsource Beyschlag</description>\n<wire x1=\"-1\" y1=\"-0.5\" x2=\"1\" y2=\"-0.5\" width=\"0.2032\" layer=\"51\"/>\n<wire x1=\"1\" y1=\"-0.5\" x2=\"1\" y2=\"0.5\" width=\"0.2032\" layer=\"51\"/>\n<wire x1=\"1\" y1=\"0.5\" x2=\"-1\" y2=\"0.5\" width=\"0.2032\" layer=\"51\"/>\n<wire x1=\"-1\" y1=\"0.5\" x2=\"-1\" y2=\"-0.5\" width=\"0.2032\" layer=\"51\"/>\n<smd name=\"1\" x=\"-0.9\" y=\"0\" dx=\"0.5\" dy=\"1.3\" layer=\"1\"/>\n<smd name=\"2\" x=\"0.9\" y=\"0\" dx=\"0.5\" dy=\"1.3\" layer=\"1\"/>\n<text x=\"-1.27\" y=\"0.9525\" size=\"1.27\" layer=\"25\">&gt;NAME</text>\n<text x=\"-1.27\" y=\"-2.2225\" size=\"1.27\" layer=\"27\">&gt;VALUE</text>\n</package>\n<package name=\"MINI_MELF-0102W\">\n<description>&lt;b&gt;CECC Size RC2211&lt;/b&gt; Wave Soldering&lt;p&gt;\nsource Beyschlag</description>\n<wire x1=\"-1\" y1=\"-0.5\" x2=\"1\" y2=\"-0.5\" width=\"0.2032\" layer=\"51\"/>\n<wire x1=\"1\" y1=\"-0.5\" x2=\"1\" y2=\"0.5\" width=\"0.2032\" layer=\"51\"/>\n<wire x1=\"1\" y1=\"0.5\" x2=\"-1\" y2=\"0.5\" width=\"0.2032\" layer=\"51\"/>\n<wire x1=\"-1\" y1=\"0.5\" x2=\"-1\" y2=\"-0.5\" width=\"0.2032\" layer=\"51\"/>\n<smd name=\"1\" x=\"-0.95\" y=\"0\" dx=\"0.6\" dy=\"1.3\" layer=\"1\"/>\n<smd name=\"2\" x=\"0.95\" y=\"0\" dx=\"0.6\" dy=\"1.3\" layer=\"1\"/>\n<text x=\"-1.27\" y=\"0.9525\" size=\"1.27\" layer=\"25\">&gt;NAME</text>\n<text x=\"-1.27\" y=\"-2.2225\" size=\"1.27\" layer=\"27\">&gt;VALUE</text>\n</package>\n<package name=\"MINI_MELF-0204R\">\n<description>&lt;b&gt;CECC Size RC3715&lt;/b&gt; Reflow Soldering&lt;p&gt;\nsource Beyschlag</description>\n<wire x1=\"-1.7\" y1=\"-0.6\" x2=\"1.7\" y2=\"-0.6\" width=\"0.2032\" layer=\"51\"/>\n<wire x1=\"1.7\" y1=\"-0.6\" x2=\"1.7\" y2=\"0.6\" width=\"0.2032\" layer=\"51\"/>\n<wire x1=\"1.7\" y1=\"0.6\" x2=\"-1.7\" y2=\"0.6\" width=\"0.2032\" layer=\"51\"/>\n<wire x1=\"-1.7\" y1=\"0.6\" x2=\"-1.7\" y2=\"-0.6\" width=\"0.2032\" layer=\"51\"/>\n<wire x1=\"0.938\" y1=\"0.6\" x2=\"-0.938\" y2=\"0.6\" width=\"0.2032\" layer=\"21\"/>\n<wire x1=\"-0.938\" y1=\"-0.6\" x2=\"0.938\" y2=\"-0.6\" width=\"0.2032\" layer=\"21\"/>\n<smd name=\"1\" x=\"-1.5\" y=\"0\" dx=\"0.8\" dy=\"1.6\" layer=\"1\"/>\n<smd name=\"2\" x=\"1.5\" y=\"0\" dx=\"0.8\" dy=\"1.6\" layer=\"1\"/>\n<text x=\"-1.27\" y=\"0.9525\" size=\"1.27\" layer=\"25\">&gt;NAME</text>\n<text x=\"-1.27\" y=\"-2.2225\" size=\"1.27\" layer=\"27\">&gt;VALUE</text>\n</package>\n<package name=\"MINI_MELF-0204W\">\n<description>&lt;b&gt;CECC Size RC3715&lt;/b&gt; Wave Soldering&lt;p&gt;\nsource Beyschlag</description>\n<wire x1=\"-1.7\" y1=\"-0.6\" x2=\"1.7\" y2=\"-0.6\" width=\"0.2032\" layer=\"51\"/>\n<wire x1=\"1.7\" y1=\"-0.6\" x2=\"1.7\" y2=\"0.6\" width=\"0.2032\" layer=\"51\"/>\n<wire x1=\"1.7\" y1=\"0.6\" x2=\"-1.7\" y2=\"0.6\" width=\"0.2032\" layer=\"51\"/>\n<wire x1=\"-1.7\" y1=\"0.6\" x2=\"-1.7\" y2=\"-0.6\" width=\"0.2032\" layer=\"51\"/>\n<wire x1=\"0.684\" y1=\"0.6\" x2=\"-0.684\" y2=\"0.6\" width=\"0.2032\" layer=\"21\"/>\n<wire x1=\"-0.684\" y1=\"-0.6\" x2=\"0.684\" y2=\"-0.6\" width=\"0.2032\" layer=\"21\"/>\n<smd name=\"1\" x=\"-1.5\" y=\"0\" dx=\"1.2\" dy=\"1.6\" layer=\"1\"/>\n<smd name=\"2\" x=\"1.5\" y=\"0\" dx=\"1.2\" dy=\"1.6\" layer=\"1\"/>\n<text x=\"-1.27\" y=\"0.9525\" size=\"1.27\" layer=\"25\">&gt;NAME</text>\n<text x=\"-1.27\" y=\"-2.2225\" size=\"1.27\" layer=\"27\">&gt;VALUE</text>\n</package>\n<package name=\"MINI_MELF-0207R\">\n<description>&lt;b&gt;CECC Size RC6123&lt;/b&gt; Reflow Soldering&lt;p&gt;\nsource Beyschlag</description>\n<wire x1=\"-2.8\" y1=\"-1\" x2=\"2.8\" y2=\"-1\" width=\"0.2032\" layer=\"51\"/>\n<wire x1=\"2.8\" y1=\"-1\" x2=\"2.8\" y2=\"1\" width=\"0.2032\" layer=\"51\"/>\n<wire x1=\"2.8\" y1=\"1\" x2=\"-2.8\" y2=\"1\" width=\"0.2032\" layer=\"51\"/>\n<wire x1=\"-2.8\" y1=\"1\" x2=\"-2.8\" y2=\"-1\" width=\"0.2032\" layer=\"51\"/>\n<wire x1=\"1.2125\" y1=\"1\" x2=\"-1.2125\" y2=\"1\" width=\"0.2032\" layer=\"21\"/>\n<wire x1=\"-1.2125\" y1=\"-1\" x2=\"1.2125\" y2=\"-1\" width=\"0.2032\" layer=\"21\"/>\n<smd name=\"1\" x=\"-2.25\" y=\"0\" dx=\"1.6\" dy=\"2.5\" layer=\"1\"/>\n<smd name=\"2\" x=\"2.25\" y=\"0\" dx=\"1.6\" dy=\"2.5\" layer=\"1\"/>\n<text x=\"-2.2225\" y=\"1.5875\" size=\"1.27\" layer=\"25\">&gt;NAME</text>\n<text x=\"-2.2225\" y=\"-2.54\" size=\"1.27\" layer=\"27\">&gt;VALUE</text>\n</package>\n<package name=\"MINI_MELF-0207W\">\n<description>&lt;b&gt;CECC Size RC6123&lt;/b&gt; Wave Soldering&lt;p&gt;\nsource Beyschlag</description>\n<wire x1=\"-2.8\" y1=\"-1\" x2=\"2.8\" y2=\"-1\" width=\"0.2032\" layer=\"51\"/>\n<wire x1=\"2.8\" y1=\"-1\" x2=\"2.8\" y2=\"1\" width=\"0.2032\" layer=\"51\"/>\n<wire x1=\"2.8\" y1=\"1\" x2=\"-2.8\" y2=\"1\" width=\"0.2032\" layer=\"51\"/>\n<wire x1=\"-2.8\" y1=\"1\" x2=\"-2.8\" y2=\"-1\" width=\"0.2032\" layer=\"51\"/>\n<wire x1=\"1.149\" y1=\"1\" x2=\"-1.149\" y2=\"1\" width=\"0.2032\" layer=\"21\"/>\n<wire x1=\"-1.149\" y1=\"-1\" x2=\"1.149\" y2=\"-1\" width=\"0.2032\" layer=\"21\"/>\n<smd name=\"1\" x=\"-2.6\" y=\"0\" dx=\"2.4\" dy=\"2.5\" layer=\"1\"/>\n<smd name=\"2\" x=\"2.6\" y=\"0\" dx=\"2.4\" dy=\"2.5\" layer=\"1\"/>\n<text x=\"-2.54\" y=\"1.5875\" size=\"1.27\" layer=\"25\">&gt;NAME</text>\n<text x=\"-2.54\" y=\"-2.54\" size=\"1.27\" layer=\"27\">&gt;VALUE</text>\n</package>\n<package name=\"0922V\">\n<description>&lt;b&gt;RESISTOR&lt;/b&gt;&lt;p&gt;\ntype 0922, grid 7.5 mm</description>\n<wire x1=\"2.54\" y1=\"0\" x2=\"1.397\" y2=\"0\" width=\"0.8128\" layer=\"51\"/>\n<wire x1=\"-5.08\" y1=\"0\" x2=\"-3.81\" y2=\"0\" width=\"0.8128\" layer=\"51\"/>\n<circle x=\"-5.08\" y=\"0\" radius=\"4.572\" width=\"0.1524\" layer=\"21\"/>\n<circle x=\"-5.08\" y=\"0\" radius=\"1.905\" width=\"0.1524\" layer=\"21\"/>\n<pad name=\"1\" x=\"-5.08\" y=\"0\" drill=\"1.016\" shape=\"octagon\"/>\n<pad name=\"2\" x=\"2.54\" y=\"0\" drill=\"1.016\" shape=\"octagon\"/>\n<text x=\"-0.508\" y=\"1.6764\" size=\"1.27\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-0.508\" y=\"-2.9972\" size=\"1.27\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n<text x=\"-6.858\" y=\"2.54\" size=\"1.016\" layer=\"21\" ratio=\"12\">0922</text>\n<rectangle x1=\"-3.81\" y1=\"-0.4064\" x2=\"1.3208\" y2=\"0.4064\" layer=\"21\"/>\n</package>\n<package name=\"RDH/15\">\n<description>&lt;b&gt;RESISTOR&lt;/b&gt;&lt;p&gt;\ntype RDH, grid 15 mm</description>\n<wire x1=\"-7.62\" y1=\"0\" x2=\"-6.858\" y2=\"0\" width=\"0.8128\" layer=\"51\"/>\n<wire x1=\"-6.096\" y1=\"3.048\" x2=\"-5.207\" y2=\"3.048\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-4.953\" y1=\"2.794\" x2=\"-5.207\" y2=\"3.048\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-6.096\" y1=\"-3.048\" x2=\"-5.207\" y2=\"-3.048\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-4.953\" y1=\"-2.794\" x2=\"-5.207\" y2=\"-3.048\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"4.953\" y1=\"2.794\" x2=\"5.207\" y2=\"3.048\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"4.953\" y1=\"2.794\" x2=\"-4.953\" y2=\"2.794\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"4.953\" y1=\"-2.794\" x2=\"5.207\" y2=\"-3.048\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"4.953\" y1=\"-2.794\" x2=\"-4.953\" y2=\"-2.794\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"6.096\" y1=\"3.048\" x2=\"5.207\" y2=\"3.048\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"6.096\" y1=\"-3.048\" x2=\"5.207\" y2=\"-3.048\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-6.477\" y1=\"-2.667\" x2=\"-6.477\" y2=\"-1.016\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-6.477\" y1=\"1.016\" x2=\"-6.477\" y2=\"-1.016\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"-6.477\" y1=\"1.016\" x2=\"-6.477\" y2=\"2.667\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"6.477\" y1=\"-2.667\" x2=\"6.477\" y2=\"-1.016\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"6.477\" y1=\"1.016\" x2=\"6.477\" y2=\"-1.016\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"6.477\" y1=\"1.016\" x2=\"6.477\" y2=\"2.667\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"6.858\" y1=\"0\" x2=\"7.62\" y2=\"0\" width=\"0.8128\" layer=\"51\"/>\n<wire x1=\"-6.477\" y1=\"2.667\" x2=\"-6.096\" y2=\"3.048\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"6.096\" y1=\"3.048\" x2=\"6.477\" y2=\"2.667\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"-6.477\" y1=\"-2.667\" x2=\"-6.096\" y2=\"-3.048\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"6.096\" y1=\"-3.048\" x2=\"6.477\" y2=\"-2.667\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<pad name=\"1\" x=\"-7.62\" y=\"0\" drill=\"1.016\" shape=\"octagon\"/>\n<pad name=\"2\" x=\"7.62\" y=\"0\" drill=\"1.016\" shape=\"octagon\"/>\n<text x=\"-6.35\" y=\"3.4544\" size=\"1.27\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-4.318\" y=\"-0.5842\" size=\"1.27\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n<text x=\"4.572\" y=\"-1.7272\" size=\"1.27\" layer=\"51\" ratio=\"10\" rot=\"R90\">RDH</text>\n<rectangle x1=\"-6.7564\" y1=\"-0.4064\" x2=\"-6.4516\" y2=\"0.4064\" layer=\"51\"/>\n<rectangle x1=\"6.4516\" y1=\"-0.4064\" x2=\"6.7564\" y2=\"0.4064\" layer=\"51\"/>\n</package>\n<package name=\"MINI_MELF-0102AX\">\n<description>&lt;b&gt;Mini MELF 0102 Axial&lt;/b&gt;</description>\n<circle x=\"0\" y=\"0\" radius=\"0.6\" width=\"0\" layer=\"51\"/>\n<circle x=\"0\" y=\"0\" radius=\"0.6\" width=\"0\" layer=\"52\"/>\n<smd name=\"1\" x=\"0\" y=\"0\" dx=\"1.9\" dy=\"1.9\" layer=\"1\" roundness=\"100\"/>\n<smd name=\"2\" x=\"0\" y=\"0\" dx=\"1.9\" dy=\"1.9\" layer=\"16\" roundness=\"100\"/>\n<text x=\"-1.27\" y=\"0.9525\" size=\"1.27\" layer=\"25\">&gt;NAME</text>\n<text x=\"-1.27\" y=\"-2.2225\" size=\"1.27\" layer=\"27\">&gt;VALUE</text>\n<hole x=\"0\" y=\"0\" drill=\"1.3\"/>\n</package>\n<package name=\"R0201\">\n<description>&lt;b&gt;RESISTOR&lt;/b&gt; chip&lt;p&gt;\nSource: http://www.vishay.com/docs/20008/dcrcw.pdf</description>\n<smd name=\"1\" x=\"-0.255\" y=\"0\" dx=\"0.28\" dy=\"0.43\" layer=\"1\"/>\n<smd name=\"2\" x=\"0.255\" y=\"0\" dx=\"0.28\" dy=\"0.43\" layer=\"1\"/>\n<text x=\"-0.635\" y=\"0.635\" size=\"1.27\" layer=\"25\">&gt;NAME</text>\n<text x=\"-0.635\" y=\"-1.905\" size=\"1.27\" layer=\"27\">&gt;VALUE</text>\n<rectangle x1=\"-0.3\" y1=\"-0.15\" x2=\"-0.15\" y2=\"0.15\" layer=\"51\"/>\n<rectangle x1=\"0.15\" y1=\"-0.15\" x2=\"0.3\" y2=\"0.15\" layer=\"51\"/>\n<rectangle x1=\"-0.15\" y1=\"-0.15\" x2=\"0.15\" y2=\"0.15\" layer=\"21\"/>\n</package>\n<package name=\"VTA52\">\n<description>&lt;b&gt;Bulk Metal® Foil Technology&lt;/b&gt;, Tubular Axial Lead Resistors, Meets or Exceeds MIL-R-39005 Requirements&lt;p&gt;\nMIL SIZE RBR52&lt;br&gt;\nSource: VISHAY .. vta56.pdf</description>\n<wire x1=\"-15.24\" y1=\"0\" x2=\"-13.97\" y2=\"0\" width=\"0.6096\" layer=\"51\"/>\n<wire x1=\"12.6225\" y1=\"0.025\" x2=\"12.6225\" y2=\"4.725\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"12.6225\" y1=\"4.725\" x2=\"-12.6225\" y2=\"4.725\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-12.6225\" y1=\"4.725\" x2=\"-12.6225\" y2=\"0.025\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-12.6225\" y1=\"0.025\" x2=\"-12.6225\" y2=\"-4.65\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-12.6225\" y1=\"-4.65\" x2=\"12.6225\" y2=\"-4.65\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"12.6225\" y1=\"-4.65\" x2=\"12.6225\" y2=\"0.025\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"13.97\" y1=\"0\" x2=\"15.24\" y2=\"0\" width=\"0.6096\" layer=\"51\"/>\n<pad name=\"1\" x=\"-15.24\" y=\"0\" drill=\"1.1\" shape=\"octagon\"/>\n<pad name=\"2\" x=\"15.24\" y=\"0\" drill=\"1.1\" shape=\"octagon\"/>\n<text x=\"-3.81\" y=\"5.08\" size=\"1.27\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-3.175\" y=\"-0.635\" size=\"1.27\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n<rectangle x1=\"-13.97\" y1=\"-0.3048\" x2=\"-12.5675\" y2=\"0.3048\" layer=\"21\"/>\n<rectangle x1=\"12.5675\" y1=\"-0.3048\" x2=\"13.97\" y2=\"0.3048\" layer=\"21\"/>\n</package>\n<package name=\"VTA53\">\n<description>&lt;b&gt;Bulk Metal® Foil Technology&lt;/b&gt;, Tubular Axial Lead Resistors, Meets or Exceeds MIL-R-39005 Requirements&lt;p&gt;\nMIL SIZE RBR53&lt;br&gt;\nSource: VISHAY .. vta56.pdf</description>\n<wire x1=\"-12.065\" y1=\"0\" x2=\"-10.795\" y2=\"0\" width=\"0.6096\" layer=\"51\"/>\n<wire x1=\"9.8975\" y1=\"0\" x2=\"9.8975\" y2=\"4.7\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"9.8975\" y1=\"4.7\" x2=\"-9.8975\" y2=\"4.7\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-9.8975\" y1=\"4.7\" x2=\"-9.8975\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-9.8975\" y1=\"0\" x2=\"-9.8975\" y2=\"-4.675\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-9.8975\" y1=\"-4.675\" x2=\"9.8975\" y2=\"-4.675\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"9.8975\" y1=\"-4.675\" x2=\"9.8975\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"10.795\" y1=\"0\" x2=\"12.065\" y2=\"0\" width=\"0.6096\" layer=\"51\"/>\n<pad name=\"1\" x=\"-12.065\" y=\"0\" drill=\"1.1\" shape=\"octagon\"/>\n<pad name=\"2\" x=\"12.065\" y=\"0\" drill=\"1.1\" shape=\"octagon\"/>\n<text x=\"-3.81\" y=\"5.08\" size=\"1.27\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-3.175\" y=\"-0.635\" size=\"1.27\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n<rectangle x1=\"-10.795\" y1=\"-0.3048\" x2=\"-9.8425\" y2=\"0.3048\" layer=\"21\"/>\n<rectangle x1=\"9.8425\" y1=\"-0.3048\" x2=\"10.795\" y2=\"0.3048\" layer=\"21\"/>\n</package>\n<package name=\"VTA54\">\n<description>&lt;b&gt;Bulk Metal® Foil Technology&lt;/b&gt;, Tubular Axial Lead Resistors, Meets or Exceeds MIL-R-39005 Requirements&lt;p&gt;\nMIL SIZE RBR54&lt;br&gt;\nSource: VISHAY .. vta56.pdf</description>\n<wire x1=\"-12.065\" y1=\"0\" x2=\"-10.795\" y2=\"0\" width=\"0.6096\" layer=\"51\"/>\n<wire x1=\"9.8975\" y1=\"0\" x2=\"9.8975\" y2=\"3.3\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"9.8975\" y1=\"3.3\" x2=\"-9.8975\" y2=\"3.3\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-9.8975\" y1=\"3.3\" x2=\"-9.8975\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-9.8975\" y1=\"0\" x2=\"-9.8975\" y2=\"-3.3\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-9.8975\" y1=\"-3.3\" x2=\"9.8975\" y2=\"-3.3\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"9.8975\" y1=\"-3.3\" x2=\"9.8975\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"10.795\" y1=\"0\" x2=\"12.065\" y2=\"0\" width=\"0.6096\" layer=\"51\"/>\n<pad name=\"1\" x=\"-12.065\" y=\"0\" drill=\"1.1\" shape=\"octagon\"/>\n<pad name=\"2\" x=\"12.065\" y=\"0\" drill=\"1.1\" shape=\"octagon\"/>\n<text x=\"-3.81\" y=\"3.81\" size=\"1.27\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-3.175\" y=\"-0.635\" size=\"1.27\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n<rectangle x1=\"-10.795\" y1=\"-0.3048\" x2=\"-9.8425\" y2=\"0.3048\" layer=\"21\"/>\n<rectangle x1=\"9.8425\" y1=\"-0.3048\" x2=\"10.795\" y2=\"0.3048\" layer=\"21\"/>\n</package>\n<package name=\"VTA55\">\n<description>&lt;b&gt;Bulk Metal® Foil Technology&lt;/b&gt;, Tubular Axial Lead Resistors, Meets or Exceeds MIL-R-39005 Requirements&lt;p&gt;\nMIL SIZE RBR55&lt;br&gt;\nSource: VISHAY .. vta56.pdf</description>\n<wire x1=\"-8.255\" y1=\"0\" x2=\"-6.985\" y2=\"0\" width=\"0.6096\" layer=\"51\"/>\n<wire x1=\"6.405\" y1=\"0\" x2=\"6.405\" y2=\"3.3\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"6.405\" y1=\"3.3\" x2=\"-6.405\" y2=\"3.3\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-6.405\" y1=\"3.3\" x2=\"-6.405\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-6.405\" y1=\"0\" x2=\"-6.405\" y2=\"-3.3\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-6.405\" y1=\"-3.3\" x2=\"6.405\" y2=\"-3.3\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"6.405\" y1=\"-3.3\" x2=\"6.405\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"6.985\" y1=\"0\" x2=\"8.255\" y2=\"0\" width=\"0.6096\" layer=\"51\"/>\n<pad name=\"1\" x=\"-8.255\" y=\"0\" drill=\"1.1\" shape=\"octagon\"/>\n<pad name=\"2\" x=\"8.255\" y=\"0\" drill=\"1.1\" shape=\"octagon\"/>\n<text x=\"-3.81\" y=\"3.81\" size=\"1.27\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-3.175\" y=\"-0.635\" size=\"1.27\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n<rectangle x1=\"-6.985\" y1=\"-0.3048\" x2=\"-6.35\" y2=\"0.3048\" layer=\"21\"/>\n<rectangle x1=\"6.35\" y1=\"-0.3048\" x2=\"6.985\" y2=\"0.3048\" layer=\"21\"/>\n</package>\n<package name=\"VTA56\">\n<description>&lt;b&gt;Bulk Metal® Foil Technology&lt;/b&gt;, Tubular Axial Lead Resistors, Meets or Exceeds MIL-R-39005 Requirements&lt;p&gt;\nMIL SIZE RBR56&lt;br&gt;\nSource: VISHAY .. vta56.pdf</description>\n<wire x1=\"-6.35\" y1=\"0\" x2=\"-5.08\" y2=\"0\" width=\"0.6096\" layer=\"51\"/>\n<wire x1=\"4.5\" y1=\"0\" x2=\"4.5\" y2=\"3.3\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"4.5\" y1=\"3.3\" x2=\"-4.5\" y2=\"3.3\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-4.5\" y1=\"3.3\" x2=\"-4.5\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-4.5\" y1=\"0\" x2=\"-4.5\" y2=\"-3.3\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-4.5\" y1=\"-3.3\" x2=\"4.5\" y2=\"-3.3\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"4.5\" y1=\"-3.3\" x2=\"4.5\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"5.08\" y1=\"0\" x2=\"6.35\" y2=\"0\" width=\"0.6096\" layer=\"51\"/>\n<pad name=\"1\" x=\"-6.35\" y=\"0\" drill=\"1.1\" shape=\"octagon\"/>\n<pad name=\"2\" x=\"6.35\" y=\"0\" drill=\"1.1\" shape=\"octagon\"/>\n<text x=\"-3.81\" y=\"3.81\" size=\"1.27\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-3.175\" y=\"-0.635\" size=\"1.27\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n<rectangle x1=\"-5.08\" y1=\"-0.3048\" x2=\"-4.445\" y2=\"0.3048\" layer=\"21\"/>\n<rectangle x1=\"4.445\" y1=\"-0.3048\" x2=\"5.08\" y2=\"0.3048\" layer=\"21\"/>\n</package>\n<package name=\"VMTA55\">\n<description>&lt;b&gt;Bulk Metal® Foil Technology&lt;/b&gt;, Tubular Axial Lead Resistors, Meets or Exceeds MIL-R-39005 Requirements&lt;p&gt;\nMIL SIZE RNC55&lt;br&gt;\nSource: VISHAY .. vta56.pdf</description>\n<wire x1=\"-5.08\" y1=\"0\" x2=\"-4.26\" y2=\"0\" width=\"0.6096\" layer=\"51\"/>\n<wire x1=\"3.3375\" y1=\"-1.45\" x2=\"3.3375\" y2=\"1.45\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"3.3375\" y1=\"1.45\" x2=\"-3.3625\" y2=\"1.45\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-3.3625\" y1=\"1.45\" x2=\"-3.3625\" y2=\"-1.45\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-3.3625\" y1=\"-1.45\" x2=\"3.3375\" y2=\"-1.45\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"4.235\" y1=\"0\" x2=\"5.08\" y2=\"0\" width=\"0.6096\" layer=\"51\"/>\n<pad name=\"1\" x=\"-5.08\" y=\"0\" drill=\"1.1\" shape=\"octagon\"/>\n<pad name=\"2\" x=\"5.08\" y=\"0\" drill=\"1.1\" shape=\"octagon\"/>\n<text x=\"-3.175\" y=\"1.905\" size=\"1.27\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-3.175\" y=\"-0.635\" size=\"1.27\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n<rectangle x1=\"-4.26\" y1=\"-0.3048\" x2=\"-3.3075\" y2=\"0.3048\" layer=\"21\"/>\n<rectangle x1=\"3.2825\" y1=\"-0.3048\" x2=\"4.235\" y2=\"0.3048\" layer=\"21\"/>\n</package>\n<package name=\"VMTB60\">\n<description>&lt;b&gt;Bulk Metal® Foil Technology&lt;/b&gt;, Tubular Axial Lead Resistors, Meets or Exceeds MIL-R-39005 Requirements&lt;p&gt;\nMIL SIZE RNC60&lt;br&gt;\nSource: VISHAY .. vta56.pdf</description>\n<wire x1=\"-6.35\" y1=\"0\" x2=\"-5.585\" y2=\"0\" width=\"0.6096\" layer=\"51\"/>\n<wire x1=\"4.6875\" y1=\"-1.95\" x2=\"4.6875\" y2=\"1.95\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"4.6875\" y1=\"1.95\" x2=\"-4.6875\" y2=\"1.95\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-4.6875\" y1=\"1.95\" x2=\"-4.6875\" y2=\"-1.95\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-4.6875\" y1=\"-1.95\" x2=\"4.6875\" y2=\"-1.95\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"5.585\" y1=\"0\" x2=\"6.35\" y2=\"0\" width=\"0.6096\" layer=\"51\"/>\n<pad name=\"1\" x=\"-6.35\" y=\"0\" drill=\"1.1\" shape=\"octagon\"/>\n<pad name=\"2\" x=\"6.35\" y=\"0\" drill=\"1.1\" shape=\"octagon\"/>\n<text x=\"-4.445\" y=\"2.54\" size=\"1.27\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-4.445\" y=\"-0.635\" size=\"1.27\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n<rectangle x1=\"-5.585\" y1=\"-0.3048\" x2=\"-4.6325\" y2=\"0.3048\" layer=\"21\"/>\n<rectangle x1=\"4.6325\" y1=\"-0.3048\" x2=\"5.585\" y2=\"0.3048\" layer=\"21\"/>\n</package>\n<package name=\"R4527\">\n<description>&lt;b&gt;Package 4527&lt;/b&gt;&lt;p&gt;\nSource: http://www.vishay.com/docs/31059/wsrhigh.pdf</description>\n<wire x1=\"-5.675\" y1=\"-3.375\" x2=\"5.65\" y2=\"-3.375\" width=\"0.2032\" layer=\"21\"/>\n<wire x1=\"5.65\" y1=\"-3.375\" x2=\"5.65\" y2=\"3.375\" width=\"0.2032\" layer=\"51\"/>\n<wire x1=\"5.65\" y1=\"3.375\" x2=\"-5.675\" y2=\"3.375\" width=\"0.2032\" layer=\"21\"/>\n<wire x1=\"-5.675\" y1=\"3.375\" x2=\"-5.675\" y2=\"-3.375\" width=\"0.2032\" layer=\"51\"/>\n<smd name=\"1\" x=\"-4.575\" y=\"0\" dx=\"3.94\" dy=\"5.84\" layer=\"1\"/>\n<smd name=\"2\" x=\"4.575\" y=\"0\" dx=\"3.94\" dy=\"5.84\" layer=\"1\"/>\n<text x=\"-5.715\" y=\"3.81\" size=\"1.27\" layer=\"25\">&gt;NAME</text>\n<text x=\"-5.715\" y=\"-5.08\" size=\"1.27\" layer=\"27\">&gt;VALUE</text>\n</package>\n<package name=\"WSC0001\">\n<description>&lt;b&gt;Wirewound Resistors, Precision Power&lt;/b&gt;&lt;p&gt;\nSource: VISHAY wscwsn.pdf</description>\n<wire x1=\"-3.075\" y1=\"1.8\" x2=\"-3.075\" y2=\"-1.8\" width=\"0.2032\" layer=\"51\"/>\n<wire x1=\"-3.075\" y1=\"-1.8\" x2=\"3.075\" y2=\"-1.8\" width=\"0.2032\" layer=\"21\"/>\n<wire x1=\"3.075\" y1=\"-1.8\" x2=\"3.075\" y2=\"1.8\" width=\"0.2032\" layer=\"51\"/>\n<wire x1=\"3.075\" y1=\"1.8\" x2=\"-3.075\" y2=\"1.8\" width=\"0.2032\" layer=\"21\"/>\n<wire x1=\"-3.075\" y1=\"1.8\" x2=\"-3.075\" y2=\"1.606\" width=\"0.2032\" layer=\"21\"/>\n<wire x1=\"-3.075\" y1=\"-1.606\" x2=\"-3.075\" y2=\"-1.8\" width=\"0.2032\" layer=\"21\"/>\n<wire x1=\"3.075\" y1=\"1.606\" x2=\"3.075\" y2=\"1.8\" width=\"0.2032\" layer=\"21\"/>\n<wire x1=\"3.075\" y1=\"-1.8\" x2=\"3.075\" y2=\"-1.606\" width=\"0.2032\" layer=\"21\"/>\n<smd name=\"1\" x=\"-2.675\" y=\"0\" dx=\"2.29\" dy=\"2.92\" layer=\"1\"/>\n<smd name=\"2\" x=\"2.675\" y=\"0\" dx=\"2.29\" dy=\"2.92\" layer=\"1\"/>\n<text x=\"-2.544\" y=\"2.229\" size=\"1.27\" layer=\"25\">&gt;NAME</text>\n<text x=\"-2.544\" y=\"-3.501\" size=\"1.27\" layer=\"27\">&gt;VALUE</text>\n</package>\n<package name=\"WSC0002\">\n<description>&lt;b&gt;Wirewound Resistors, Precision Power&lt;/b&gt;&lt;p&gt;\nSource: VISHAY wscwsn.pdf</description>\n<wire x1=\"-5.55\" y1=\"3.375\" x2=\"-5.55\" y2=\"-3.375\" width=\"0.2032\" layer=\"51\"/>\n<wire x1=\"-5.55\" y1=\"-3.375\" x2=\"5.55\" y2=\"-3.375\" width=\"0.2032\" layer=\"21\"/>\n<wire x1=\"5.55\" y1=\"-3.375\" x2=\"5.55\" y2=\"3.375\" width=\"0.2032\" layer=\"51\"/>\n<wire x1=\"5.55\" y1=\"3.375\" x2=\"-5.55\" y2=\"3.375\" width=\"0.2032\" layer=\"21\"/>\n<smd name=\"1\" x=\"-4.575\" y=\"0.025\" dx=\"3.94\" dy=\"5.84\" layer=\"1\"/>\n<smd name=\"2\" x=\"4.575\" y=\"0\" dx=\"3.94\" dy=\"5.84\" layer=\"1\"/>\n<text x=\"-5.65\" y=\"3.9\" size=\"1.27\" layer=\"25\">&gt;NAME</text>\n<text x=\"-5.65\" y=\"-5.15\" size=\"1.27\" layer=\"27\">&gt;VALUE</text>\n</package>\n<package name=\"WSC01/2\">\n<description>&lt;b&gt;Wirewound Resistors, Precision Power&lt;/b&gt;&lt;p&gt;\nSource: VISHAY wscwsn.pdf</description>\n<wire x1=\"-2.45\" y1=\"1.475\" x2=\"-2.45\" y2=\"-1.475\" width=\"0.2032\" layer=\"51\"/>\n<wire x1=\"-2.45\" y1=\"-1.475\" x2=\"2.45\" y2=\"-1.475\" width=\"0.2032\" layer=\"21\"/>\n<wire x1=\"2.45\" y1=\"-1.475\" x2=\"2.45\" y2=\"1.475\" width=\"0.2032\" layer=\"51\"/>\n<wire x1=\"2.45\" y1=\"1.475\" x2=\"-2.45\" y2=\"1.475\" width=\"0.2032\" layer=\"21\"/>\n<wire x1=\"-2.45\" y1=\"1.475\" x2=\"-2.45\" y2=\"1.106\" width=\"0.2032\" layer=\"21\"/>\n<wire x1=\"-2.45\" y1=\"-1.106\" x2=\"-2.45\" y2=\"-1.475\" width=\"0.2032\" layer=\"21\"/>\n<wire x1=\"2.45\" y1=\"1.106\" x2=\"2.45\" y2=\"1.475\" width=\"0.2032\" layer=\"21\"/>\n<wire x1=\"2.45\" y1=\"-1.475\" x2=\"2.45\" y2=\"-1.106\" width=\"0.2032\" layer=\"21\"/>\n<smd name=\"1\" x=\"-2.1\" y=\"0\" dx=\"2.16\" dy=\"1.78\" layer=\"1\"/>\n<smd name=\"2\" x=\"2.1\" y=\"0\" dx=\"2.16\" dy=\"1.78\" layer=\"1\"/>\n<text x=\"-2.544\" y=\"1.904\" size=\"1.27\" layer=\"25\">&gt;NAME</text>\n<text x=\"-2.544\" y=\"-3.176\" size=\"1.27\" layer=\"27\">&gt;VALUE</text>\n</package>\n<package name=\"WSC2515\">\n<description>&lt;b&gt;Wirewound Resistors, Precision Power&lt;/b&gt;&lt;p&gt;\nSource: VISHAY wscwsn.pdf</description>\n<wire x1=\"-3.075\" y1=\"1.8\" x2=\"-3.075\" y2=\"-1.8\" width=\"0.2032\" layer=\"51\"/>\n<wire x1=\"-3.075\" y1=\"-1.8\" x2=\"3.05\" y2=\"-1.8\" width=\"0.2032\" layer=\"21\"/>\n<wire x1=\"3.05\" y1=\"-1.8\" x2=\"3.05\" y2=\"1.8\" width=\"0.2032\" layer=\"51\"/>\n<wire x1=\"3.05\" y1=\"1.8\" x2=\"-3.075\" y2=\"1.8\" width=\"0.2032\" layer=\"21\"/>\n<wire x1=\"-3.075\" y1=\"1.8\" x2=\"-3.075\" y2=\"1.606\" width=\"0.2032\" layer=\"21\"/>\n<wire x1=\"-3.075\" y1=\"-1.606\" x2=\"-3.075\" y2=\"-1.8\" width=\"0.2032\" layer=\"21\"/>\n<wire x1=\"3.05\" y1=\"1.606\" x2=\"3.05\" y2=\"1.8\" width=\"0.2032\" layer=\"21\"/>\n<wire x1=\"3.05\" y1=\"-1.8\" x2=\"3.05\" y2=\"-1.606\" width=\"0.2032\" layer=\"21\"/>\n<smd name=\"1\" x=\"-2.675\" y=\"0\" dx=\"2.29\" dy=\"2.92\" layer=\"1\"/>\n<smd name=\"2\" x=\"2.675\" y=\"0\" dx=\"2.29\" dy=\"2.92\" layer=\"1\"/>\n<text x=\"-3.2\" y=\"2.15\" size=\"1.27\" layer=\"25\">&gt;NAME</text>\n<text x=\"-3.2\" y=\"-3.4\" size=\"1.27\" layer=\"27\">&gt;VALUE</text>\n</package>\n<package name=\"WSC4527\">\n<description>&lt;b&gt;Wirewound Resistors, Precision Power&lt;/b&gt;&lt;p&gt;\nSource: VISHAY wscwsn.pdf</description>\n<wire x1=\"-5.675\" y1=\"3.4\" x2=\"-5.675\" y2=\"-3.375\" width=\"0.2032\" layer=\"51\"/>\n<wire x1=\"-5.675\" y1=\"-3.375\" x2=\"5.675\" y2=\"-3.375\" width=\"0.2032\" layer=\"21\"/>\n<wire x1=\"5.675\" y1=\"-3.375\" x2=\"5.675\" y2=\"3.4\" width=\"0.2032\" layer=\"51\"/>\n<wire x1=\"5.675\" y1=\"3.4\" x2=\"-5.675\" y2=\"3.4\" width=\"0.2032\" layer=\"21\"/>\n<smd name=\"1\" x=\"-4.575\" y=\"0.025\" dx=\"3.94\" dy=\"5.84\" layer=\"1\"/>\n<smd name=\"2\" x=\"4.575\" y=\"0\" dx=\"3.94\" dy=\"5.84\" layer=\"1\"/>\n<text x=\"-5.775\" y=\"3.925\" size=\"1.27\" layer=\"25\">&gt;NAME</text>\n<text x=\"-5.775\" y=\"-5.15\" size=\"1.27\" layer=\"27\">&gt;VALUE</text>\n</package>\n<package name=\"WSC6927\">\n<description>&lt;b&gt;Wirewound Resistors, Precision Power&lt;/b&gt;&lt;p&gt;\nSource: VISHAY wscwsn.pdf</description>\n<wire x1=\"-8.65\" y1=\"3.375\" x2=\"-8.65\" y2=\"-3.375\" width=\"0.2032\" layer=\"51\"/>\n<wire x1=\"-8.65\" y1=\"-3.375\" x2=\"8.65\" y2=\"-3.375\" width=\"0.2032\" layer=\"21\"/>\n<wire x1=\"8.65\" y1=\"-3.375\" x2=\"8.65\" y2=\"3.375\" width=\"0.2032\" layer=\"51\"/>\n<wire x1=\"8.65\" y1=\"3.375\" x2=\"-8.65\" y2=\"3.375\" width=\"0.2032\" layer=\"21\"/>\n<smd name=\"1\" x=\"-7.95\" y=\"0.025\" dx=\"3.94\" dy=\"5.97\" layer=\"1\"/>\n<smd name=\"2\" x=\"7.95\" y=\"0\" dx=\"3.94\" dy=\"5.97\" layer=\"1\"/>\n<text x=\"-8.75\" y=\"3.9\" size=\"1.27\" layer=\"25\">&gt;NAME</text>\n<text x=\"-8.75\" y=\"-5.15\" size=\"1.27\" layer=\"27\">&gt;VALUE</text>\n</package>\n<package name=\"R1218\">\n<description>&lt;b&gt;CRCW1218 Thick Film, Rectangular Chip Resistors&lt;/b&gt;&lt;p&gt;\nSource: http://www.vishay.com .. dcrcw.pdf</description>\n<wire x1=\"-0.913\" y1=\"-2.219\" x2=\"0.939\" y2=\"-2.219\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"0.913\" y1=\"2.219\" x2=\"-0.939\" y2=\"2.219\" width=\"0.1524\" layer=\"51\"/>\n<smd name=\"1\" x=\"-1.475\" y=\"0\" dx=\"1.05\" dy=\"4.9\" layer=\"1\"/>\n<smd name=\"2\" x=\"1.475\" y=\"0\" dx=\"1.05\" dy=\"4.9\" layer=\"1\"/>\n<text x=\"-2.54\" y=\"2.54\" size=\"1.27\" layer=\"25\">&gt;NAME</text>\n<text x=\"-2.54\" y=\"-3.81\" size=\"1.27\" layer=\"27\">&gt;VALUE</text>\n<rectangle x1=\"-1.651\" y1=\"-2.3\" x2=\"-0.9009\" y2=\"2.3\" layer=\"51\"/>\n<rectangle x1=\"0.9144\" y1=\"-2.3\" x2=\"1.6645\" y2=\"2.3\" layer=\"51\"/>\n</package>\n<package name=\"1812X7R\">\n<description>&lt;b&gt;Chip Monolithic Ceramic Capacitors&lt;/b&gt; Medium Voltage High Capacitance for General Use&lt;p&gt;\nSource: http://www.murata.com .. GRM43DR72E224KW01.pdf</description>\n<wire x1=\"-1.1\" y1=\"1.5\" x2=\"1.1\" y2=\"1.5\" width=\"0.2032\" layer=\"51\"/>\n<wire x1=\"1.1\" y1=\"-1.5\" x2=\"-1.1\" y2=\"-1.5\" width=\"0.2032\" layer=\"51\"/>\n<wire x1=\"-0.6\" y1=\"1.5\" x2=\"0.6\" y2=\"1.5\" width=\"0.2032\" layer=\"21\"/>\n<wire x1=\"0.6\" y1=\"-1.5\" x2=\"-0.6\" y2=\"-1.5\" width=\"0.2032\" layer=\"21\"/>\n<smd name=\"1\" x=\"-1.425\" y=\"0\" dx=\"0.8\" dy=\"3.5\" layer=\"1\"/>\n<smd name=\"2\" x=\"1.425\" y=\"0\" dx=\"0.8\" dy=\"3.5\" layer=\"1\" rot=\"R180\"/>\n<text x=\"-1.9456\" y=\"1.9958\" size=\"1.27\" layer=\"25\">&gt;NAME</text>\n<text x=\"-1.9456\" y=\"-3.7738\" size=\"1.27\" layer=\"27\">&gt;VALUE</text>\n<rectangle x1=\"-1.4\" y1=\"-1.6\" x2=\"-1.1\" y2=\"1.6\" layer=\"51\"/>\n<rectangle x1=\"1.1\" y1=\"-1.6\" x2=\"1.4\" y2=\"1.6\" layer=\"51\" rot=\"R180\"/>\n</package>\n<package name=\"PRL1632\">\n<description>&lt;b&gt;PRL1632 are realized as 1W for 3.2 × 1.6mm(1206)&lt;/b&gt;&lt;p&gt;\nSource: http://www.mouser.com/ds/2/392/products_18-2245.pdf</description>\n<wire x1=\"0.7275\" y1=\"-1.5228\" x2=\"-0.7277\" y2=\"-1.5228\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"0.7275\" y1=\"1.5228\" x2=\"-0.7152\" y2=\"1.5228\" width=\"0.1524\" layer=\"51\"/>\n<smd name=\"2\" x=\"0.822\" y=\"0\" dx=\"1\" dy=\"3.2\" layer=\"1\"/>\n<smd name=\"1\" x=\"-0.822\" y=\"0\" dx=\"1\" dy=\"3.2\" layer=\"1\"/>\n<text x=\"-1.4\" y=\"1.8\" size=\"1.27\" layer=\"25\">&gt;NAME</text>\n<text x=\"-1.4\" y=\"-3\" size=\"1.27\" layer=\"27\">&gt;VALUE</text>\n<rectangle x1=\"-0.8\" y1=\"-1.6\" x2=\"-0.4\" y2=\"1.6\" layer=\"51\"/>\n<rectangle x1=\"0.4\" y1=\"-1.6\" x2=\"0.8\" y2=\"1.6\" layer=\"51\"/>\n</package>\n<package name=\"R01005\">\n<smd name=\"1\" x=\"-0.1625\" y=\"0\" dx=\"0.2\" dy=\"0.25\" layer=\"1\"/>\n<smd name=\"2\" x=\"0.1625\" y=\"0\" dx=\"0.2\" dy=\"0.25\" layer=\"1\"/>\n<text x=\"-0.4\" y=\"0.3\" size=\"1.27\" layer=\"25\">&gt;NAME</text>\n<text x=\"-0.4\" y=\"-1.6\" size=\"1.27\" layer=\"27\">&gt;VALUE</text>\n<rectangle x1=\"-0.2\" y1=\"-0.1\" x2=\"-0.075\" y2=\"0.1\" layer=\"51\"/>\n<rectangle x1=\"0.075\" y1=\"-0.1\" x2=\"0.2\" y2=\"0.1\" layer=\"51\"/>\n<rectangle x1=\"-0.15\" y1=\"0.05\" x2=\"0.15\" y2=\"0.1\" layer=\"51\"/>\n<rectangle x1=\"-0.15\" y1=\"-0.1\" x2=\"0.15\" y2=\"-0.05\" layer=\"51\"/>\n</package>\n<package name=\"C0402\">\n<description>&lt;b&gt;CAPACITOR&lt;/b&gt;</description>\n<wire x1=\"-0.245\" y1=\"0.224\" x2=\"0.245\" y2=\"0.224\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"0.245\" y1=\"-0.224\" x2=\"-0.245\" y2=\"-0.224\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"-1.473\" y1=\"0.483\" x2=\"1.473\" y2=\"0.483\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"1.473\" y1=\"0.483\" x2=\"1.473\" y2=\"-0.483\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"1.473\" y1=\"-0.483\" x2=\"-1.473\" y2=\"-0.483\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"-1.473\" y1=\"-0.483\" x2=\"-1.473\" y2=\"0.483\" width=\"0.0508\" layer=\"39\"/>\n<smd name=\"1\" x=\"-0.65\" y=\"0\" dx=\"0.7\" dy=\"0.9\" layer=\"1\"/>\n<smd name=\"2\" x=\"0.65\" y=\"0\" dx=\"0.7\" dy=\"0.9\" layer=\"1\"/>\n<text x=\"-0.635\" y=\"0.635\" size=\"1.27\" layer=\"25\">&gt;NAME</text>\n<text x=\"-0.635\" y=\"-1.905\" size=\"1.27\" layer=\"27\">&gt;VALUE</text>\n<rectangle x1=\"-0.554\" y1=\"-0.3048\" x2=\"-0.254\" y2=\"0.2951\" layer=\"51\"/>\n<rectangle x1=\"0.2588\" y1=\"-0.3048\" x2=\"0.5588\" y2=\"0.2951\" layer=\"51\"/>\n<rectangle x1=\"-0.1999\" y1=\"-0.3\" x2=\"0.1999\" y2=\"0.3\" layer=\"35\"/>\n</package>\n<package name=\"C0504\">\n<description>&lt;b&gt;CAPACITOR&lt;/b&gt;</description>\n<wire x1=\"-1.473\" y1=\"0.983\" x2=\"1.473\" y2=\"0.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"1.473\" y1=\"0.983\" x2=\"1.473\" y2=\"-0.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"1.473\" y1=\"-0.983\" x2=\"-1.473\" y2=\"-0.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"-1.473\" y1=\"-0.983\" x2=\"-1.473\" y2=\"0.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"-0.294\" y1=\"0.559\" x2=\"0.294\" y2=\"0.559\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"-0.294\" y1=\"-0.559\" x2=\"0.294\" y2=\"-0.559\" width=\"0.1016\" layer=\"51\"/>\n<smd name=\"1\" x=\"-0.7\" y=\"0\" dx=\"1\" dy=\"1.3\" layer=\"1\"/>\n<smd name=\"2\" x=\"0.7\" y=\"0\" dx=\"1\" dy=\"1.3\" layer=\"1\"/>\n<text x=\"-0.635\" y=\"1.27\" size=\"1.27\" layer=\"25\">&gt;NAME</text>\n<text x=\"-0.635\" y=\"-2.54\" size=\"1.27\" layer=\"27\">&gt;VALUE</text>\n<rectangle x1=\"-0.6604\" y1=\"-0.6223\" x2=\"-0.2804\" y2=\"0.6276\" layer=\"51\"/>\n<rectangle x1=\"0.2794\" y1=\"-0.6223\" x2=\"0.6594\" y2=\"0.6276\" layer=\"51\"/>\n<rectangle x1=\"-0.1001\" y1=\"-0.4001\" x2=\"0.1001\" y2=\"0.4001\" layer=\"35\"/>\n</package>\n<package name=\"C0603\">\n<description>&lt;b&gt;CAPACITOR&lt;/b&gt;</description>\n<wire x1=\"-1.473\" y1=\"0.983\" x2=\"1.473\" y2=\"0.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"1.473\" y1=\"0.983\" x2=\"1.473\" y2=\"-0.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"1.473\" y1=\"-0.983\" x2=\"-1.473\" y2=\"-0.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"-1.473\" y1=\"-0.983\" x2=\"-1.473\" y2=\"0.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"-0.356\" y1=\"0.432\" x2=\"0.356\" y2=\"0.432\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"-0.356\" y1=\"-0.419\" x2=\"0.356\" y2=\"-0.419\" width=\"0.1016\" layer=\"51\"/>\n<smd name=\"1\" x=\"-0.85\" y=\"0\" dx=\"1.1\" dy=\"1\" layer=\"1\"/>\n<smd name=\"2\" x=\"0.85\" y=\"0\" dx=\"1.1\" dy=\"1\" layer=\"1\"/>\n<text x=\"-0.635\" y=\"0.635\" size=\"1.27\" layer=\"25\">&gt;NAME</text>\n<text x=\"-0.635\" y=\"-1.905\" size=\"1.27\" layer=\"27\">&gt;VALUE</text>\n<rectangle x1=\"-0.8382\" y1=\"-0.4699\" x2=\"-0.3381\" y2=\"0.4801\" layer=\"51\"/>\n<rectangle x1=\"0.3302\" y1=\"-0.4699\" x2=\"0.8303\" y2=\"0.4801\" layer=\"51\"/>\n<rectangle x1=\"-0.1999\" y1=\"-0.3\" x2=\"0.1999\" y2=\"0.3\" layer=\"35\"/>\n</package>\n<package name=\"C0805\">\n<description>&lt;b&gt;CAPACITOR&lt;/b&gt;&lt;p&gt;</description>\n<wire x1=\"-1.973\" y1=\"0.983\" x2=\"1.973\" y2=\"0.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"1.973\" y1=\"-0.983\" x2=\"-1.973\" y2=\"-0.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"-1.973\" y1=\"-0.983\" x2=\"-1.973\" y2=\"0.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"-0.381\" y1=\"0.66\" x2=\"0.381\" y2=\"0.66\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"-0.356\" y1=\"-0.66\" x2=\"0.381\" y2=\"-0.66\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"1.973\" y1=\"0.983\" x2=\"1.973\" y2=\"-0.983\" width=\"0.0508\" layer=\"39\"/>\n<smd name=\"1\" x=\"-0.95\" y=\"0\" dx=\"1.3\" dy=\"1.5\" layer=\"1\"/>\n<smd name=\"2\" x=\"0.95\" y=\"0\" dx=\"1.3\" dy=\"1.5\" layer=\"1\"/>\n<text x=\"-1.27\" y=\"1.27\" size=\"1.27\" layer=\"25\">&gt;NAME</text>\n<text x=\"-1.27\" y=\"-2.54\" size=\"1.27\" layer=\"27\">&gt;VALUE</text>\n<rectangle x1=\"-1.0922\" y1=\"-0.7239\" x2=\"-0.3421\" y2=\"0.7262\" layer=\"51\"/>\n<rectangle x1=\"0.3556\" y1=\"-0.7239\" x2=\"1.1057\" y2=\"0.7262\" layer=\"51\"/>\n<rectangle x1=\"-0.1001\" y1=\"-0.4001\" x2=\"0.1001\" y2=\"0.4001\" layer=\"35\"/>\n</package>\n<package name=\"C1206\">\n<description>&lt;b&gt;CAPACITOR&lt;/b&gt;</description>\n<wire x1=\"-2.473\" y1=\"0.983\" x2=\"2.473\" y2=\"0.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"2.473\" y1=\"-0.983\" x2=\"-2.473\" y2=\"-0.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"-2.473\" y1=\"-0.983\" x2=\"-2.473\" y2=\"0.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"2.473\" y1=\"0.983\" x2=\"2.473\" y2=\"-0.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"-0.965\" y1=\"0.787\" x2=\"0.965\" y2=\"0.787\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"-0.965\" y1=\"-0.787\" x2=\"0.965\" y2=\"-0.787\" width=\"0.1016\" layer=\"51\"/>\n<smd name=\"1\" x=\"-1.4\" y=\"0\" dx=\"1.6\" dy=\"1.8\" layer=\"1\"/>\n<smd name=\"2\" x=\"1.4\" y=\"0\" dx=\"1.6\" dy=\"1.8\" layer=\"1\"/>\n<text x=\"-1.27\" y=\"1.27\" size=\"1.27\" layer=\"25\">&gt;NAME</text>\n<text x=\"-1.27\" y=\"-2.54\" size=\"1.27\" layer=\"27\">&gt;VALUE</text>\n<rectangle x1=\"-1.7018\" y1=\"-0.8509\" x2=\"-0.9517\" y2=\"0.8491\" layer=\"51\"/>\n<rectangle x1=\"0.9517\" y1=\"-0.8491\" x2=\"1.7018\" y2=\"0.8509\" layer=\"51\"/>\n<rectangle x1=\"-0.1999\" y1=\"-0.4001\" x2=\"0.1999\" y2=\"0.4001\" layer=\"35\"/>\n</package>\n<package name=\"C1210\">\n<description>&lt;b&gt;CAPACITOR&lt;/b&gt;</description>\n<wire x1=\"-2.473\" y1=\"1.483\" x2=\"2.473\" y2=\"1.483\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"2.473\" y1=\"-1.483\" x2=\"-2.473\" y2=\"-1.483\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"-2.473\" y1=\"-1.483\" x2=\"-2.473\" y2=\"1.483\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"-0.9652\" y1=\"1.2446\" x2=\"0.9652\" y2=\"1.2446\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"-0.9652\" y1=\"-1.2446\" x2=\"0.9652\" y2=\"-1.2446\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"2.473\" y1=\"1.483\" x2=\"2.473\" y2=\"-1.483\" width=\"0.0508\" layer=\"39\"/>\n<smd name=\"1\" x=\"-1.4\" y=\"0\" dx=\"1.6\" dy=\"2.7\" layer=\"1\"/>\n<smd name=\"2\" x=\"1.4\" y=\"0\" dx=\"1.6\" dy=\"2.7\" layer=\"1\"/>\n<text x=\"-1.905\" y=\"1.905\" size=\"1.27\" layer=\"25\">&gt;NAME</text>\n<text x=\"-1.905\" y=\"-3.175\" size=\"1.27\" layer=\"27\">&gt;VALUE</text>\n<rectangle x1=\"-1.7018\" y1=\"-1.2954\" x2=\"-0.9517\" y2=\"1.3045\" layer=\"51\"/>\n<rectangle x1=\"0.9517\" y1=\"-1.3045\" x2=\"1.7018\" y2=\"1.2954\" layer=\"51\"/>\n<rectangle x1=\"-0.1999\" y1=\"-0.4001\" x2=\"0.1999\" y2=\"0.4001\" layer=\"35\"/>\n</package>\n<package name=\"C1310\">\n<description>&lt;b&gt;CAPACITOR&lt;/b&gt;</description>\n<wire x1=\"-1.473\" y1=\"0.983\" x2=\"1.473\" y2=\"0.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"1.473\" y1=\"0.983\" x2=\"1.473\" y2=\"-0.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"1.473\" y1=\"-0.983\" x2=\"-1.473\" y2=\"-0.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"-1.473\" y1=\"-0.983\" x2=\"-1.473\" y2=\"0.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"-0.294\" y1=\"0.559\" x2=\"0.294\" y2=\"0.559\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"-0.294\" y1=\"-0.559\" x2=\"0.294\" y2=\"-0.559\" width=\"0.1016\" layer=\"51\"/>\n<smd name=\"1\" x=\"-0.7\" y=\"0\" dx=\"1\" dy=\"1.3\" layer=\"1\"/>\n<smd name=\"2\" x=\"0.7\" y=\"0\" dx=\"1\" dy=\"1.3\" layer=\"1\"/>\n<text x=\"-0.635\" y=\"1.27\" size=\"1.27\" layer=\"25\">&gt;NAME</text>\n<text x=\"-0.635\" y=\"-2.54\" size=\"1.27\" layer=\"27\">&gt;VALUE</text>\n<rectangle x1=\"-0.6604\" y1=\"-0.6223\" x2=\"-0.2804\" y2=\"0.6276\" layer=\"51\"/>\n<rectangle x1=\"0.2794\" y1=\"-0.6223\" x2=\"0.6594\" y2=\"0.6276\" layer=\"51\"/>\n<rectangle x1=\"-0.1001\" y1=\"-0.3\" x2=\"0.1001\" y2=\"0.3\" layer=\"35\"/>\n</package>\n<package name=\"C1608\">\n<description>&lt;b&gt;CAPACITOR&lt;/b&gt;</description>\n<wire x1=\"-1.473\" y1=\"0.983\" x2=\"1.473\" y2=\"0.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"1.473\" y1=\"0.983\" x2=\"1.473\" y2=\"-0.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"1.473\" y1=\"-0.983\" x2=\"-1.473\" y2=\"-0.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"-1.473\" y1=\"-0.983\" x2=\"-1.473\" y2=\"0.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"-0.356\" y1=\"0.432\" x2=\"0.356\" y2=\"0.432\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"-0.356\" y1=\"-0.419\" x2=\"0.356\" y2=\"-0.419\" width=\"0.1016\" layer=\"51\"/>\n<smd name=\"1\" x=\"-0.85\" y=\"0\" dx=\"1.1\" dy=\"1\" layer=\"1\"/>\n<smd name=\"2\" x=\"0.85\" y=\"0\" dx=\"1.1\" dy=\"1\" layer=\"1\"/>\n<text x=\"-0.635\" y=\"0.635\" size=\"1.27\" layer=\"25\">&gt;NAME</text>\n<text x=\"-0.635\" y=\"-1.905\" size=\"1.27\" layer=\"27\">&gt;VALUE</text>\n<rectangle x1=\"-0.8382\" y1=\"-0.4699\" x2=\"-0.3381\" y2=\"0.4801\" layer=\"51\"/>\n<rectangle x1=\"0.3302\" y1=\"-0.4699\" x2=\"0.8303\" y2=\"0.4801\" layer=\"51\"/>\n<rectangle x1=\"-0.1999\" y1=\"-0.3\" x2=\"0.1999\" y2=\"0.3\" layer=\"35\"/>\n</package>\n<package name=\"C1812\">\n<description>&lt;b&gt;CAPACITOR&lt;/b&gt;</description>\n<wire x1=\"-2.973\" y1=\"1.983\" x2=\"2.973\" y2=\"1.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"2.973\" y1=\"-1.983\" x2=\"-2.973\" y2=\"-1.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"-2.973\" y1=\"-1.983\" x2=\"-2.973\" y2=\"1.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"-1.4732\" y1=\"1.6002\" x2=\"1.4732\" y2=\"1.6002\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"-1.4478\" y1=\"-1.6002\" x2=\"1.4732\" y2=\"-1.6002\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"2.973\" y1=\"1.983\" x2=\"2.973\" y2=\"-1.983\" width=\"0.0508\" layer=\"39\"/>\n<smd name=\"1\" x=\"-1.95\" y=\"0\" dx=\"1.9\" dy=\"3.4\" layer=\"1\"/>\n<smd name=\"2\" x=\"1.95\" y=\"0\" dx=\"1.9\" dy=\"3.4\" layer=\"1\"/>\n<text x=\"-1.905\" y=\"2.54\" size=\"1.27\" layer=\"25\">&gt;NAME</text>\n<text x=\"-1.905\" y=\"-3.81\" size=\"1.27\" layer=\"27\">&gt;VALUE</text>\n<rectangle x1=\"-2.3876\" y1=\"-1.651\" x2=\"-1.4376\" y2=\"1.649\" layer=\"51\"/>\n<rectangle x1=\"1.4478\" y1=\"-1.651\" x2=\"2.3978\" y2=\"1.649\" layer=\"51\"/>\n<rectangle x1=\"-0.3\" y1=\"-0.4001\" x2=\"0.3\" y2=\"0.4001\" layer=\"35\"/>\n</package>\n<package name=\"C1825\">\n<description>&lt;b&gt;CAPACITOR&lt;/b&gt;</description>\n<wire x1=\"-2.973\" y1=\"3.483\" x2=\"2.973\" y2=\"3.483\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"2.973\" y1=\"-3.483\" x2=\"-2.973\" y2=\"-3.483\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"-2.973\" y1=\"-3.483\" x2=\"-2.973\" y2=\"3.483\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"-1.4986\" y1=\"3.2766\" x2=\"1.4732\" y2=\"3.2766\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"-1.4732\" y1=\"-3.2766\" x2=\"1.4986\" y2=\"-3.2766\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"2.973\" y1=\"3.483\" x2=\"2.973\" y2=\"-3.483\" width=\"0.0508\" layer=\"39\"/>\n<smd name=\"1\" x=\"-1.95\" y=\"0\" dx=\"1.9\" dy=\"6.8\" layer=\"1\"/>\n<smd name=\"2\" x=\"1.95\" y=\"0\" dx=\"1.9\" dy=\"6.8\" layer=\"1\"/>\n<text x=\"-1.905\" y=\"3.81\" size=\"1.27\" layer=\"25\">&gt;NAME</text>\n<text x=\"-1.905\" y=\"-5.08\" size=\"1.27\" layer=\"27\">&gt;VALUE</text>\n<rectangle x1=\"-2.413\" y1=\"-3.3528\" x2=\"-1.463\" y2=\"3.3472\" layer=\"51\"/>\n<rectangle x1=\"1.4478\" y1=\"-3.3528\" x2=\"2.3978\" y2=\"3.3472\" layer=\"51\"/>\n<rectangle x1=\"-0.7\" y1=\"-0.7\" x2=\"0.7\" y2=\"0.7\" layer=\"35\"/>\n</package>\n<package name=\"C2012\">\n<description>&lt;b&gt;CAPACITOR&lt;/b&gt;</description>\n<wire x1=\"-1.973\" y1=\"0.983\" x2=\"1.973\" y2=\"0.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"1.973\" y1=\"0.983\" x2=\"1.973\" y2=\"-0.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"1.973\" y1=\"-0.983\" x2=\"-1.973\" y2=\"-0.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"-1.973\" y1=\"-0.983\" x2=\"-1.973\" y2=\"0.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"-0.381\" y1=\"0.66\" x2=\"0.381\" y2=\"0.66\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"-0.356\" y1=\"-0.66\" x2=\"0.381\" y2=\"-0.66\" width=\"0.1016\" layer=\"51\"/>\n<smd name=\"1\" x=\"-0.85\" y=\"0\" dx=\"1.3\" dy=\"1.5\" layer=\"1\"/>\n<smd name=\"2\" x=\"0.85\" y=\"0\" dx=\"1.3\" dy=\"1.5\" layer=\"1\"/>\n<text x=\"-1.27\" y=\"1.27\" size=\"1.27\" layer=\"25\">&gt;NAME</text>\n<text x=\"-1.27\" y=\"-2.54\" size=\"1.27\" layer=\"27\">&gt;VALUE</text>\n<rectangle x1=\"-1.0922\" y1=\"-0.7239\" x2=\"-0.3421\" y2=\"0.7262\" layer=\"51\"/>\n<rectangle x1=\"0.3556\" y1=\"-0.7239\" x2=\"1.1057\" y2=\"0.7262\" layer=\"51\"/>\n<rectangle x1=\"-0.1001\" y1=\"-0.4001\" x2=\"0.1001\" y2=\"0.4001\" layer=\"35\"/>\n</package>\n<package name=\"C3216\">\n<description>&lt;b&gt;CAPACITOR&lt;/b&gt;</description>\n<wire x1=\"-2.473\" y1=\"0.983\" x2=\"2.473\" y2=\"0.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"2.473\" y1=\"-0.983\" x2=\"-2.473\" y2=\"-0.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"-2.473\" y1=\"-0.983\" x2=\"-2.473\" y2=\"0.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"2.473\" y1=\"0.983\" x2=\"2.473\" y2=\"-0.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"-0.965\" y1=\"0.787\" x2=\"0.965\" y2=\"0.787\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"-0.965\" y1=\"-0.787\" x2=\"0.965\" y2=\"-0.787\" width=\"0.1016\" layer=\"51\"/>\n<smd name=\"1\" x=\"-1.4\" y=\"0\" dx=\"1.6\" dy=\"1.8\" layer=\"1\"/>\n<smd name=\"2\" x=\"1.4\" y=\"0\" dx=\"1.6\" dy=\"1.8\" layer=\"1\"/>\n<text x=\"-1.27\" y=\"1.27\" size=\"1.27\" layer=\"25\">&gt;NAME</text>\n<text x=\"-1.27\" y=\"-2.54\" size=\"1.27\" layer=\"27\">&gt;VALUE</text>\n<rectangle x1=\"-1.7018\" y1=\"-0.8509\" x2=\"-0.9517\" y2=\"0.8491\" layer=\"51\"/>\n<rectangle x1=\"0.9517\" y1=\"-0.8491\" x2=\"1.7018\" y2=\"0.8509\" layer=\"51\"/>\n<rectangle x1=\"-0.3\" y1=\"-0.5001\" x2=\"0.3\" y2=\"0.5001\" layer=\"35\"/>\n</package>\n<package name=\"C3225\">\n<description>&lt;b&gt;CAPACITOR&lt;/b&gt;</description>\n<wire x1=\"-2.473\" y1=\"1.483\" x2=\"2.473\" y2=\"1.483\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"2.473\" y1=\"-1.483\" x2=\"-2.473\" y2=\"-1.483\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"-2.473\" y1=\"-1.483\" x2=\"-2.473\" y2=\"1.483\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"-0.9652\" y1=\"1.2446\" x2=\"0.9652\" y2=\"1.2446\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"-0.9652\" y1=\"-1.2446\" x2=\"0.9652\" y2=\"-1.2446\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"2.473\" y1=\"1.483\" x2=\"2.473\" y2=\"-1.483\" width=\"0.0508\" layer=\"39\"/>\n<smd name=\"1\" x=\"-1.4\" y=\"0\" dx=\"1.6\" dy=\"2.7\" layer=\"1\"/>\n<smd name=\"2\" x=\"1.4\" y=\"0\" dx=\"1.6\" dy=\"2.7\" layer=\"1\"/>\n<text x=\"-1.905\" y=\"1.905\" size=\"1.27\" layer=\"25\">&gt;NAME</text>\n<text x=\"-1.905\" y=\"-3.175\" size=\"1.27\" layer=\"27\">&gt;VALUE</text>\n<rectangle x1=\"-1.7018\" y1=\"-1.2954\" x2=\"-0.9517\" y2=\"1.3045\" layer=\"51\"/>\n<rectangle x1=\"0.9517\" y1=\"-1.3045\" x2=\"1.7018\" y2=\"1.2954\" layer=\"51\"/>\n<rectangle x1=\"-0.1999\" y1=\"-0.5001\" x2=\"0.1999\" y2=\"0.5001\" layer=\"35\"/>\n</package>\n<package name=\"C4532\">\n<description>&lt;b&gt;CAPACITOR&lt;/b&gt;</description>\n<wire x1=\"-2.973\" y1=\"1.983\" x2=\"2.973\" y2=\"1.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"2.973\" y1=\"-1.983\" x2=\"-2.973\" y2=\"-1.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"-2.973\" y1=\"-1.983\" x2=\"-2.973\" y2=\"1.983\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"-1.4732\" y1=\"1.6002\" x2=\"1.4732\" y2=\"1.6002\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"-1.4478\" y1=\"-1.6002\" x2=\"1.4732\" y2=\"-1.6002\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"2.973\" y1=\"1.983\" x2=\"2.973\" y2=\"-1.983\" width=\"0.0508\" layer=\"39\"/>\n<smd name=\"1\" x=\"-1.95\" y=\"0\" dx=\"1.9\" dy=\"3.4\" layer=\"1\"/>\n<smd name=\"2\" x=\"1.95\" y=\"0\" dx=\"1.9\" dy=\"3.4\" layer=\"1\"/>\n<text x=\"-1.905\" y=\"2.54\" size=\"1.27\" layer=\"25\">&gt;NAME</text>\n<text x=\"-1.905\" y=\"-3.81\" size=\"1.27\" layer=\"27\">&gt;VALUE</text>\n<rectangle x1=\"-2.3876\" y1=\"-1.651\" x2=\"-1.4376\" y2=\"1.649\" layer=\"51\"/>\n<rectangle x1=\"1.4478\" y1=\"-1.651\" x2=\"2.3978\" y2=\"1.649\" layer=\"51\"/>\n<rectangle x1=\"-0.4001\" y1=\"-0.7\" x2=\"0.4001\" y2=\"0.7\" layer=\"35\"/>\n</package>\n<package name=\"C4564\">\n<description>&lt;b&gt;CAPACITOR&lt;/b&gt;</description>\n<wire x1=\"-2.973\" y1=\"3.483\" x2=\"2.973\" y2=\"3.483\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"2.973\" y1=\"-3.483\" x2=\"-2.973\" y2=\"-3.483\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"-2.973\" y1=\"-3.483\" x2=\"-2.973\" y2=\"3.483\" width=\"0.0508\" layer=\"39\"/>\n<wire x1=\"-1.4986\" y1=\"3.2766\" x2=\"1.4732\" y2=\"3.2766\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"-1.4732\" y1=\"-3.2766\" x2=\"1.4986\" y2=\"-3.2766\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"2.973\" y1=\"3.483\" x2=\"2.973\" y2=\"-3.483\" width=\"0.0508\" layer=\"39\"/>\n<smd name=\"1\" x=\"-1.95\" y=\"0\" dx=\"1.9\" dy=\"6.8\" layer=\"1\"/>\n<smd name=\"2\" x=\"1.95\" y=\"0\" dx=\"1.9\" dy=\"6.8\" layer=\"1\"/>\n<text x=\"-1.905\" y=\"3.81\" size=\"1.27\" layer=\"25\">&gt;NAME</text>\n<text x=\"-1.905\" y=\"-5.08\" size=\"1.27\" layer=\"27\">&gt;VALUE</text>\n<rectangle x1=\"-2.413\" y1=\"-3.3528\" x2=\"-1.463\" y2=\"3.3472\" layer=\"51\"/>\n<rectangle x1=\"1.4478\" y1=\"-3.3528\" x2=\"2.3978\" y2=\"3.3472\" layer=\"51\"/>\n<rectangle x1=\"-0.5001\" y1=\"-1\" x2=\"0.5001\" y2=\"1\" layer=\"35\"/>\n</package>\n<package name=\"C025-024X044\">\n<description>&lt;b&gt;CAPACITOR&lt;/b&gt;&lt;p&gt;\ngrid 2.5 mm, outline 2.4 x 4.4 mm</description>\n<wire x1=\"-2.159\" y1=\"-0.635\" x2=\"-2.159\" y2=\"0.635\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-2.159\" y1=\"0.635\" x2=\"-1.651\" y2=\"1.143\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"-2.159\" y1=\"-0.635\" x2=\"-1.651\" y2=\"-1.143\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"1.651\" y1=\"1.143\" x2=\"-1.651\" y2=\"1.143\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.159\" y1=\"-0.635\" x2=\"2.159\" y2=\"0.635\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"1.651\" y1=\"-1.143\" x2=\"-1.651\" y2=\"-1.143\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"1.651\" y1=\"1.143\" x2=\"2.159\" y2=\"0.635\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"1.651\" y1=\"-1.143\" x2=\"2.159\" y2=\"-0.635\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"-0.3048\" y1=\"0.762\" x2=\"-0.3048\" y2=\"-0.762\" width=\"0.3048\" layer=\"21\"/>\n<wire x1=\"0.3302\" y1=\"0.762\" x2=\"0.3302\" y2=\"-0.762\" width=\"0.3048\" layer=\"21\"/>\n<wire x1=\"1.27\" y1=\"0\" x2=\"0.3302\" y2=\"0\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"-1.27\" y1=\"0\" x2=\"-0.3048\" y2=\"0\" width=\"0.1524\" layer=\"51\"/>\n<pad name=\"1\" x=\"-1.27\" y=\"0\" drill=\"0.8128\" shape=\"octagon\"/>\n<pad name=\"2\" x=\"1.27\" y=\"0\" drill=\"0.8128\" shape=\"octagon\"/>\n<text x=\"-1.778\" y=\"1.397\" size=\"1.27\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-1.778\" y=\"-2.667\" size=\"1.27\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n</package>\n<package name=\"C025-025X050\">\n<description>&lt;b&gt;CAPACITOR&lt;/b&gt;&lt;p&gt;\ngrid 2.5 mm, outline 2.5 x 5 mm</description>\n<wire x1=\"-2.159\" y1=\"1.27\" x2=\"2.159\" y2=\"1.27\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.159\" y1=\"-1.27\" x2=\"-2.159\" y2=\"-1.27\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.413\" y1=\"1.016\" x2=\"2.413\" y2=\"-1.016\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-2.413\" y1=\"1.016\" x2=\"-2.413\" y2=\"-1.016\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.159\" y1=\"1.27\" x2=\"2.413\" y2=\"1.016\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"-2.413\" y1=\"1.016\" x2=\"-2.159\" y2=\"1.27\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"2.159\" y1=\"-1.27\" x2=\"2.413\" y2=\"-1.016\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"-2.413\" y1=\"-1.016\" x2=\"-2.159\" y2=\"-1.27\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"0.762\" y1=\"0\" x2=\"0.381\" y2=\"0\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"0.381\" y1=\"0\" x2=\"0.254\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"0.254\" y1=\"0\" x2=\"0.254\" y2=\"0.762\" width=\"0.254\" layer=\"21\"/>\n<wire x1=\"0.254\" y1=\"0\" x2=\"0.254\" y2=\"-0.762\" width=\"0.254\" layer=\"21\"/>\n<wire x1=\"-0.254\" y1=\"0.762\" x2=\"-0.254\" y2=\"0\" width=\"0.254\" layer=\"21\"/>\n<wire x1=\"-0.254\" y1=\"0\" x2=\"-0.254\" y2=\"-0.762\" width=\"0.254\" layer=\"21\"/>\n<wire x1=\"-0.254\" y1=\"0\" x2=\"-0.381\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-0.381\" y1=\"0\" x2=\"-0.762\" y2=\"0\" width=\"0.1524\" layer=\"51\"/>\n<pad name=\"1\" x=\"-1.27\" y=\"0\" drill=\"0.8128\" shape=\"octagon\"/>\n<pad name=\"2\" x=\"1.27\" y=\"0\" drill=\"0.8128\" shape=\"octagon\"/>\n<text x=\"-2.286\" y=\"1.524\" size=\"1.27\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-2.286\" y=\"-2.794\" size=\"1.27\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n</package>\n<package name=\"C025-030X050\">\n<description>&lt;b&gt;CAPACITOR&lt;/b&gt;&lt;p&gt;\ngrid 2.5 mm, outline 3 x 5 mm</description>\n<wire x1=\"-2.159\" y1=\"1.524\" x2=\"2.159\" y2=\"1.524\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.159\" y1=\"-1.524\" x2=\"-2.159\" y2=\"-1.524\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.413\" y1=\"1.27\" x2=\"2.413\" y2=\"-1.27\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-2.413\" y1=\"1.27\" x2=\"-2.413\" y2=\"-1.27\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.159\" y1=\"1.524\" x2=\"2.413\" y2=\"1.27\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"-2.413\" y1=\"1.27\" x2=\"-2.159\" y2=\"1.524\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"2.159\" y1=\"-1.524\" x2=\"2.413\" y2=\"-1.27\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"-2.413\" y1=\"-1.27\" x2=\"-2.159\" y2=\"-1.524\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"0.762\" y1=\"0\" x2=\"0.381\" y2=\"0\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"0.381\" y1=\"0\" x2=\"0.254\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"0.254\" y1=\"0\" x2=\"0.254\" y2=\"0.762\" width=\"0.254\" layer=\"21\"/>\n<wire x1=\"0.254\" y1=\"0\" x2=\"0.254\" y2=\"-0.762\" width=\"0.254\" layer=\"21\"/>\n<wire x1=\"-0.254\" y1=\"0.762\" x2=\"-0.254\" y2=\"0\" width=\"0.254\" layer=\"21\"/>\n<wire x1=\"-0.254\" y1=\"0\" x2=\"-0.254\" y2=\"-0.762\" width=\"0.254\" layer=\"21\"/>\n<wire x1=\"-0.254\" y1=\"0\" x2=\"-0.381\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-0.381\" y1=\"0\" x2=\"-0.762\" y2=\"0\" width=\"0.1524\" layer=\"51\"/>\n<pad name=\"1\" x=\"-1.27\" y=\"0\" drill=\"0.8128\" shape=\"octagon\"/>\n<pad name=\"2\" x=\"1.27\" y=\"0\" drill=\"0.8128\" shape=\"octagon\"/>\n<text x=\"-2.286\" y=\"1.905\" size=\"1.27\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-2.286\" y=\"-3.048\" size=\"1.27\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n</package>\n<package name=\"C025-040X050\">\n<description>&lt;b&gt;CAPACITOR&lt;/b&gt;&lt;p&gt;\ngrid 2.5 mm, outline 4 x 5 mm</description>\n<wire x1=\"-2.159\" y1=\"1.905\" x2=\"2.159\" y2=\"1.905\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.159\" y1=\"-1.905\" x2=\"-2.159\" y2=\"-1.905\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.413\" y1=\"1.651\" x2=\"2.413\" y2=\"-1.651\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-2.413\" y1=\"1.651\" x2=\"-2.413\" y2=\"-1.651\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.159\" y1=\"1.905\" x2=\"2.413\" y2=\"1.651\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"-2.413\" y1=\"1.651\" x2=\"-2.159\" y2=\"1.905\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"2.159\" y1=\"-1.905\" x2=\"2.413\" y2=\"-1.651\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"-2.413\" y1=\"-1.651\" x2=\"-2.159\" y2=\"-1.905\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"0.762\" y1=\"0\" x2=\"0.381\" y2=\"0\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"0.381\" y1=\"0\" x2=\"0.254\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"0.254\" y1=\"0\" x2=\"0.254\" y2=\"0.762\" width=\"0.254\" layer=\"21\"/>\n<wire x1=\"0.254\" y1=\"0\" x2=\"0.254\" y2=\"-0.762\" width=\"0.254\" layer=\"21\"/>\n<wire x1=\"-0.254\" y1=\"0.762\" x2=\"-0.254\" y2=\"0\" width=\"0.254\" layer=\"21\"/>\n<wire x1=\"-0.254\" y1=\"0\" x2=\"-0.254\" y2=\"-0.762\" width=\"0.254\" layer=\"21\"/>\n<wire x1=\"-0.254\" y1=\"0\" x2=\"-0.381\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-0.381\" y1=\"0\" x2=\"-0.762\" y2=\"0\" width=\"0.1524\" layer=\"51\"/>\n<pad name=\"1\" x=\"-1.27\" y=\"0\" drill=\"0.8128\" shape=\"octagon\"/>\n<pad name=\"2\" x=\"1.27\" y=\"0\" drill=\"0.8128\" shape=\"octagon\"/>\n<text x=\"-2.286\" y=\"2.159\" size=\"1.27\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-2.286\" y=\"-3.429\" size=\"1.27\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n</package>\n<package name=\"C025-050X050\">\n<description>&lt;b&gt;CAPACITOR&lt;/b&gt;&lt;p&gt;\ngrid 2.5 mm, outline 5 x 5 mm</description>\n<wire x1=\"-2.159\" y1=\"2.286\" x2=\"2.159\" y2=\"2.286\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.159\" y1=\"-2.286\" x2=\"-2.159\" y2=\"-2.286\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.413\" y1=\"2.032\" x2=\"2.413\" y2=\"-2.032\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-2.413\" y1=\"2.032\" x2=\"-2.413\" y2=\"-2.032\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.159\" y1=\"2.286\" x2=\"2.413\" y2=\"2.032\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"-2.413\" y1=\"2.032\" x2=\"-2.159\" y2=\"2.286\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"2.159\" y1=\"-2.286\" x2=\"2.413\" y2=\"-2.032\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"-2.413\" y1=\"-2.032\" x2=\"-2.159\" y2=\"-2.286\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"0.762\" y1=\"0\" x2=\"0.381\" y2=\"0\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"0.381\" y1=\"0\" x2=\"0.254\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"0.254\" y1=\"0\" x2=\"0.254\" y2=\"0.762\" width=\"0.254\" layer=\"21\"/>\n<wire x1=\"0.254\" y1=\"0\" x2=\"0.254\" y2=\"-0.762\" width=\"0.254\" layer=\"21\"/>\n<wire x1=\"-0.254\" y1=\"0.762\" x2=\"-0.254\" y2=\"0\" width=\"0.254\" layer=\"21\"/>\n<wire x1=\"-0.254\" y1=\"0\" x2=\"-0.254\" y2=\"-0.762\" width=\"0.254\" layer=\"21\"/>\n<wire x1=\"-0.254\" y1=\"0\" x2=\"-0.381\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-0.381\" y1=\"0\" x2=\"-0.762\" y2=\"0\" width=\"0.1524\" layer=\"51\"/>\n<pad name=\"1\" x=\"-1.27\" y=\"0\" drill=\"0.8128\" shape=\"octagon\"/>\n<pad name=\"2\" x=\"1.27\" y=\"0\" drill=\"0.8128\" shape=\"octagon\"/>\n<text x=\"-2.286\" y=\"2.54\" size=\"1.27\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-2.286\" y=\"-3.81\" size=\"1.27\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n</package>\n<package name=\"C025-060X050\">\n<description>&lt;b&gt;CAPACITOR&lt;/b&gt;&lt;p&gt;\ngrid 2.5 mm, outline 6 x 5 mm</description>\n<wire x1=\"-2.159\" y1=\"2.794\" x2=\"2.159\" y2=\"2.794\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.159\" y1=\"-2.794\" x2=\"-2.159\" y2=\"-2.794\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.413\" y1=\"2.54\" x2=\"2.413\" y2=\"-2.54\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-2.413\" y1=\"2.54\" x2=\"-2.413\" y2=\"-2.54\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.159\" y1=\"2.794\" x2=\"2.413\" y2=\"2.54\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"-2.413\" y1=\"2.54\" x2=\"-2.159\" y2=\"2.794\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"2.159\" y1=\"-2.794\" x2=\"2.413\" y2=\"-2.54\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"-2.413\" y1=\"-2.54\" x2=\"-2.159\" y2=\"-2.794\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"0.762\" y1=\"0\" x2=\"0.381\" y2=\"0\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"0.381\" y1=\"0\" x2=\"0.254\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"0.254\" y1=\"0\" x2=\"0.254\" y2=\"0.762\" width=\"0.254\" layer=\"21\"/>\n<wire x1=\"0.254\" y1=\"0\" x2=\"0.254\" y2=\"-0.762\" width=\"0.254\" layer=\"21\"/>\n<wire x1=\"-0.254\" y1=\"0.762\" x2=\"-0.254\" y2=\"0\" width=\"0.254\" layer=\"21\"/>\n<wire x1=\"-0.254\" y1=\"0\" x2=\"-0.254\" y2=\"-0.762\" width=\"0.254\" layer=\"21\"/>\n<wire x1=\"-0.254\" y1=\"0\" x2=\"-0.381\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-0.381\" y1=\"0\" x2=\"-0.762\" y2=\"0\" width=\"0.1524\" layer=\"51\"/>\n<pad name=\"1\" x=\"-1.27\" y=\"0\" drill=\"0.8128\" shape=\"octagon\"/>\n<pad name=\"2\" x=\"1.27\" y=\"0\" drill=\"0.8128\" shape=\"octagon\"/>\n<text x=\"-2.286\" y=\"3.048\" size=\"1.27\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-2.032\" y=\"-2.413\" size=\"1.27\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n</package>\n<package name=\"C025_050-024X070\">\n<description>&lt;b&gt;CAPACITOR&lt;/b&gt;&lt;p&gt;\ngrid 2.5 mm + 5 mm, outline 2.4 x 7 mm</description>\n<wire x1=\"-2.159\" y1=\"-0.635\" x2=\"-2.159\" y2=\"0.635\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"-2.159\" y1=\"0.635\" x2=\"-1.651\" y2=\"1.143\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"-2.159\" y1=\"-0.635\" x2=\"-1.651\" y2=\"-1.143\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"1.651\" y1=\"1.143\" x2=\"-1.651\" y2=\"1.143\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.159\" y1=\"-0.635\" x2=\"2.159\" y2=\"0.635\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"1.651\" y1=\"-1.143\" x2=\"-1.651\" y2=\"-1.143\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"1.651\" y1=\"1.143\" x2=\"2.159\" y2=\"0.635\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"-4.191\" y1=\"-1.143\" x2=\"-3.9624\" y2=\"-1.143\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-4.191\" y1=\"1.143\" x2=\"-3.9624\" y2=\"1.143\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-4.699\" y1=\"-0.635\" x2=\"-4.191\" y2=\"-1.143\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"1.651\" y1=\"-1.143\" x2=\"2.159\" y2=\"-0.635\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"-4.699\" y1=\"0.635\" x2=\"-4.191\" y2=\"1.143\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"-4.699\" y1=\"-0.635\" x2=\"-4.699\" y2=\"0.635\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-3.429\" y1=\"1.143\" x2=\"-2.5654\" y2=\"1.143\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-3.429\" y1=\"-1.143\" x2=\"-2.5654\" y2=\"-1.143\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-0.3048\" y1=\"0.762\" x2=\"-0.3048\" y2=\"-0.762\" width=\"0.3048\" layer=\"21\"/>\n<wire x1=\"0.3302\" y1=\"0.762\" x2=\"0.3302\" y2=\"-0.762\" width=\"0.3048\" layer=\"21\"/>\n<wire x1=\"1.27\" y1=\"0\" x2=\"0.3302\" y2=\"0\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"-1.27\" y1=\"0\" x2=\"-0.3048\" y2=\"0\" width=\"0.1524\" layer=\"51\"/>\n<pad name=\"1\" x=\"-3.81\" y=\"0\" drill=\"0.8128\" shape=\"octagon\"/>\n<pad name=\"2\" x=\"-1.27\" y=\"0\" drill=\"0.8128\" shape=\"octagon\"/>\n<pad name=\"3\" x=\"1.27\" y=\"0\" drill=\"0.8128\" shape=\"octagon\"/>\n<text x=\"-3.81\" y=\"1.397\" size=\"1.27\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-3.81\" y=\"-2.667\" size=\"1.27\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n</package>\n<package name=\"C025_050-025X075\">\n<description>&lt;b&gt;CAPACITOR&lt;/b&gt;&lt;p&gt;\ngrid 2.5 + 5 mm, outline 2.5 x 7.5 mm</description>\n<wire x1=\"-2.159\" y1=\"1.27\" x2=\"2.159\" y2=\"1.27\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.159\" y1=\"-1.27\" x2=\"-2.159\" y2=\"-1.27\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-2.413\" y1=\"1.016\" x2=\"-2.413\" y2=\"-1.016\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.159\" y1=\"1.27\" x2=\"2.413\" y2=\"1.016\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"-2.413\" y1=\"1.016\" x2=\"-2.159\" y2=\"1.27\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"2.159\" y1=\"-1.27\" x2=\"2.413\" y2=\"-1.016\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"-2.413\" y1=\"-1.016\" x2=\"-2.159\" y2=\"-1.27\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"0.381\" y1=\"0\" x2=\"0.254\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"0.254\" y1=\"0\" x2=\"0.254\" y2=\"0.762\" width=\"0.254\" layer=\"21\"/>\n<wire x1=\"0.254\" y1=\"0\" x2=\"0.254\" y2=\"-0.762\" width=\"0.254\" layer=\"21\"/>\n<wire x1=\"-0.254\" y1=\"0.762\" x2=\"-0.254\" y2=\"0\" width=\"0.254\" layer=\"21\"/>\n<wire x1=\"-0.254\" y1=\"0\" x2=\"-0.254\" y2=\"-0.762\" width=\"0.254\" layer=\"21\"/>\n<wire x1=\"-0.254\" y1=\"0\" x2=\"-0.381\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-0.381\" y1=\"0\" x2=\"-0.762\" y2=\"0\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"4.953\" y1=\"1.016\" x2=\"4.953\" y2=\"-1.016\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"4.699\" y1=\"1.27\" x2=\"4.953\" y2=\"1.016\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"4.699\" y1=\"-1.27\" x2=\"4.953\" y2=\"-1.016\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"2.794\" y1=\"1.27\" x2=\"4.699\" y2=\"1.27\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"4.699\" y1=\"-1.27\" x2=\"2.794\" y2=\"-1.27\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.413\" y1=\"1.016\" x2=\"2.413\" y2=\"0.762\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.413\" y1=\"-0.762\" x2=\"2.413\" y2=\"-1.016\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.413\" y1=\"0.254\" x2=\"2.413\" y2=\"-0.254\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"1.778\" y1=\"0\" x2=\"2.286\" y2=\"0\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"2.286\" y1=\"0\" x2=\"2.794\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.794\" y1=\"0\" x2=\"3.302\" y2=\"0\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"0.762\" y1=\"0\" x2=\"0.381\" y2=\"0\" width=\"0.1524\" layer=\"51\"/>\n<pad name=\"1\" x=\"-1.27\" y=\"0\" drill=\"0.8128\" shape=\"octagon\"/>\n<pad name=\"3\" x=\"3.81\" y=\"0\" drill=\"0.8128\" shape=\"octagon\"/>\n<pad name=\"2\" x=\"1.27\" y=\"0\" drill=\"0.8128\" shape=\"octagon\"/>\n<text x=\"-2.159\" y=\"1.651\" size=\"1.27\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-2.159\" y=\"-2.794\" size=\"1.27\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n</package>\n<package name=\"C025_050-035X075\">\n<description>&lt;b&gt;CAPACITOR&lt;/b&gt;&lt;p&gt;\ngrid 2.5 + 5 mm, outline 3.5 x 7.5 mm</description>\n<wire x1=\"-2.159\" y1=\"1.778\" x2=\"2.159\" y2=\"1.778\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.159\" y1=\"-1.778\" x2=\"-2.159\" y2=\"-1.778\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-2.413\" y1=\"1.524\" x2=\"-2.413\" y2=\"-1.524\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.159\" y1=\"1.778\" x2=\"2.413\" y2=\"1.524\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"-2.413\" y1=\"1.524\" x2=\"-2.159\" y2=\"1.778\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"2.159\" y1=\"-1.778\" x2=\"2.413\" y2=\"-1.524\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"-2.413\" y1=\"-1.524\" x2=\"-2.159\" y2=\"-1.778\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"0.381\" y1=\"0\" x2=\"0.254\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"0.254\" y1=\"0\" x2=\"0.254\" y2=\"0.762\" width=\"0.254\" layer=\"21\"/>\n<wire x1=\"0.254\" y1=\"0\" x2=\"0.254\" y2=\"-0.762\" width=\"0.254\" layer=\"21\"/>\n<wire x1=\"-0.254\" y1=\"0.762\" x2=\"-0.254\" y2=\"0\" width=\"0.254\" layer=\"21\"/>\n<wire x1=\"-0.254\" y1=\"0\" x2=\"-0.254\" y2=\"-0.762\" width=\"0.254\" layer=\"21\"/>\n<wire x1=\"-0.254\" y1=\"0\" x2=\"-0.381\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-0.381\" y1=\"0\" x2=\"-0.762\" y2=\"0\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"4.953\" y1=\"1.524\" x2=\"4.953\" y2=\"-1.524\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"4.699\" y1=\"1.778\" x2=\"4.953\" y2=\"1.524\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"4.699\" y1=\"-1.778\" x2=\"4.953\" y2=\"-1.524\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"2.794\" y1=\"1.778\" x2=\"4.699\" y2=\"1.778\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"4.699\" y1=\"-1.778\" x2=\"2.794\" y2=\"-1.778\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.413\" y1=\"1.524\" x2=\"2.413\" y2=\"1.016\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.413\" y1=\"-1.016\" x2=\"2.413\" y2=\"-1.524\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.413\" y1=\"0.508\" x2=\"2.413\" y2=\"-0.508\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"0.381\" y1=\"0\" x2=\"0.762\" y2=\"0\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"2.286\" y1=\"0\" x2=\"2.794\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.794\" y1=\"0\" x2=\"3.302\" y2=\"0\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"2.286\" y1=\"0\" x2=\"1.778\" y2=\"0\" width=\"0.1524\" layer=\"51\"/>\n<pad name=\"1\" x=\"-1.27\" y=\"0\" drill=\"0.8128\" shape=\"octagon\"/>\n<pad name=\"3\" x=\"3.81\" y=\"0\" drill=\"0.8128\" shape=\"octagon\"/>\n<pad name=\"2\" x=\"1.27\" y=\"0\" drill=\"0.8128\" shape=\"octagon\"/>\n<text x=\"-2.286\" y=\"2.159\" size=\"1.27\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-2.286\" y=\"-3.302\" size=\"1.27\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n</package>\n<package name=\"C025_050-045X075\">\n<description>&lt;b&gt;CAPACITOR&lt;/b&gt;&lt;p&gt;\ngrid 2.5 + 5 mm, outline 4.5 x 7.5 mm</description>\n<wire x1=\"-2.159\" y1=\"2.286\" x2=\"2.159\" y2=\"2.286\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.159\" y1=\"-2.286\" x2=\"-2.159\" y2=\"-2.286\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-2.413\" y1=\"2.032\" x2=\"-2.413\" y2=\"-2.032\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.159\" y1=\"2.286\" x2=\"2.413\" y2=\"2.032\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"-2.413\" y1=\"2.032\" x2=\"-2.159\" y2=\"2.286\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"2.159\" y1=\"-2.286\" x2=\"2.413\" y2=\"-2.032\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"-2.413\" y1=\"-2.032\" x2=\"-2.159\" y2=\"-2.286\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"0.381\" y1=\"0\" x2=\"0.254\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"0.254\" y1=\"0\" x2=\"0.254\" y2=\"0.762\" width=\"0.254\" layer=\"21\"/>\n<wire x1=\"0.254\" y1=\"0\" x2=\"0.254\" y2=\"-0.762\" width=\"0.254\" layer=\"21\"/>\n<wire x1=\"-0.254\" y1=\"0.762\" x2=\"-0.254\" y2=\"0\" width=\"0.254\" layer=\"21\"/>\n<wire x1=\"-0.254\" y1=\"0\" x2=\"-0.254\" y2=\"-0.762\" width=\"0.254\" layer=\"21\"/>\n<wire x1=\"-0.254\" y1=\"0\" x2=\"-0.381\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-0.381\" y1=\"0\" x2=\"-0.762\" y2=\"0\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"4.953\" y1=\"2.032\" x2=\"4.953\" y2=\"-2.032\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"4.699\" y1=\"2.286\" x2=\"4.953\" y2=\"2.032\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"4.699\" y1=\"-2.286\" x2=\"4.953\" y2=\"-2.032\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"2.794\" y1=\"2.286\" x2=\"4.699\" y2=\"2.286\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"4.699\" y1=\"-2.286\" x2=\"2.794\" y2=\"-2.286\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.413\" y1=\"2.032\" x2=\"2.413\" y2=\"1.397\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.413\" y1=\"-1.397\" x2=\"2.413\" y2=\"-2.032\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.413\" y1=\"0.762\" x2=\"2.413\" y2=\"-0.762\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.286\" y1=\"0\" x2=\"2.794\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.794\" y1=\"0\" x2=\"3.302\" y2=\"0\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"0.381\" y1=\"0\" x2=\"0.762\" y2=\"0\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"2.286\" y1=\"0\" x2=\"1.778\" y2=\"0\" width=\"0.1524\" layer=\"51\"/>\n<pad name=\"1\" x=\"-1.27\" y=\"0\" drill=\"0.8128\" shape=\"octagon\"/>\n<pad name=\"3\" x=\"3.81\" y=\"0\" drill=\"0.8128\" shape=\"octagon\"/>\n<pad name=\"2\" x=\"1.27\" y=\"0\" drill=\"0.8128\" shape=\"octagon\"/>\n<text x=\"-2.286\" y=\"2.667\" size=\"1.27\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-2.286\" y=\"-3.81\" size=\"1.27\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n</package>\n<package name=\"C025_050-055X075\">\n<description>&lt;b&gt;CAPACITOR&lt;/b&gt;&lt;p&gt;\ngrid 2.5 + 5 mm, outline 5.5 x 7.5 mm</description>\n<wire x1=\"-2.159\" y1=\"2.794\" x2=\"2.159\" y2=\"2.794\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.159\" y1=\"-2.794\" x2=\"-2.159\" y2=\"-2.794\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-2.413\" y1=\"2.54\" x2=\"-2.413\" y2=\"-2.54\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.159\" y1=\"2.794\" x2=\"2.413\" y2=\"2.54\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"-2.413\" y1=\"2.54\" x2=\"-2.159\" y2=\"2.794\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"2.159\" y1=\"-2.794\" x2=\"2.413\" y2=\"-2.54\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"-2.413\" y1=\"-2.54\" x2=\"-2.159\" y2=\"-2.794\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"0.381\" y1=\"0\" x2=\"0.254\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"0.254\" y1=\"0\" x2=\"0.254\" y2=\"0.762\" width=\"0.254\" layer=\"21\"/>\n<wire x1=\"0.254\" y1=\"0\" x2=\"0.254\" y2=\"-0.762\" width=\"0.254\" layer=\"21\"/>\n<wire x1=\"-0.254\" y1=\"0.762\" x2=\"-0.254\" y2=\"0\" width=\"0.254\" layer=\"21\"/>\n<wire x1=\"-0.254\" y1=\"0\" x2=\"-0.254\" y2=\"-0.762\" width=\"0.254\" layer=\"21\"/>\n<wire x1=\"-0.254\" y1=\"0\" x2=\"-0.381\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-0.381\" y1=\"0\" x2=\"-0.762\" y2=\"0\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"4.953\" y1=\"2.54\" x2=\"4.953\" y2=\"-2.54\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"4.699\" y1=\"2.794\" x2=\"4.953\" y2=\"2.54\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"4.699\" y1=\"-2.794\" x2=\"4.953\" y2=\"-2.54\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"2.794\" y1=\"2.794\" x2=\"4.699\" y2=\"2.794\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"4.699\" y1=\"-2.794\" x2=\"2.794\" y2=\"-2.794\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.413\" y1=\"2.54\" x2=\"2.413\" y2=\"2.032\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.413\" y1=\"-2.032\" x2=\"2.413\" y2=\"-2.54\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.413\" y1=\"0.762\" x2=\"2.413\" y2=\"-0.762\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"1.778\" y1=\"0\" x2=\"2.286\" y2=\"0\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"2.286\" y1=\"0\" x2=\"2.794\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.794\" y1=\"0\" x2=\"3.302\" y2=\"0\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"0.381\" y1=\"0\" x2=\"0.762\" y2=\"0\" width=\"0.1524\" layer=\"51\"/>\n<pad name=\"1\" x=\"-1.27\" y=\"0\" drill=\"0.8128\" shape=\"octagon\"/>\n<pad name=\"3\" x=\"3.81\" y=\"0\" drill=\"0.8128\" shape=\"octagon\"/>\n<pad name=\"2\" x=\"1.27\" y=\"0\" drill=\"0.8128\" shape=\"octagon\"/>\n<text x=\"-2.286\" y=\"3.175\" size=\"1.27\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-2.032\" y=\"-2.286\" size=\"1.27\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n</package>\n<package name=\"C050-024X044\">\n<description>&lt;b&gt;CAPACITOR&lt;/b&gt;&lt;p&gt;\ngrid 5 mm, outline 2.4 x 4.4 mm</description>\n<wire x1=\"-2.159\" y1=\"-0.635\" x2=\"-2.159\" y2=\"0.635\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"-2.159\" y1=\"0.635\" x2=\"-1.651\" y2=\"1.143\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"-2.159\" y1=\"-0.635\" x2=\"-1.651\" y2=\"-1.143\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"1.651\" y1=\"1.143\" x2=\"-1.651\" y2=\"1.143\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.159\" y1=\"-0.635\" x2=\"2.159\" y2=\"0.635\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"1.651\" y1=\"-1.143\" x2=\"-1.651\" y2=\"-1.143\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"1.651\" y1=\"1.143\" x2=\"2.159\" y2=\"0.635\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"1.651\" y1=\"-1.143\" x2=\"2.159\" y2=\"-0.635\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"-0.3048\" y1=\"0.762\" x2=\"-0.3048\" y2=\"0\" width=\"0.3048\" layer=\"21\"/>\n<wire x1=\"-0.3048\" y1=\"0\" x2=\"-0.3048\" y2=\"-0.762\" width=\"0.3048\" layer=\"21\"/>\n<wire x1=\"0.3302\" y1=\"0.762\" x2=\"0.3302\" y2=\"0\" width=\"0.3048\" layer=\"21\"/>\n<wire x1=\"0.3302\" y1=\"0\" x2=\"0.3302\" y2=\"-0.762\" width=\"0.3048\" layer=\"21\"/>\n<wire x1=\"1.27\" y1=\"0\" x2=\"0.3302\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-1.27\" y1=\"0\" x2=\"-0.3048\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<pad name=\"1\" x=\"-2.54\" y=\"0\" drill=\"0.8128\" shape=\"octagon\"/>\n<pad name=\"2\" x=\"2.54\" y=\"0\" drill=\"0.8128\" shape=\"octagon\"/>\n<text x=\"-2.159\" y=\"1.397\" size=\"1.27\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-2.159\" y=\"-2.667\" size=\"1.27\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n<rectangle x1=\"2.159\" y1=\"-0.381\" x2=\"2.54\" y2=\"0.381\" layer=\"51\"/>\n<rectangle x1=\"-2.54\" y1=\"-0.381\" x2=\"-2.159\" y2=\"0.381\" layer=\"51\"/>\n</package>\n<package name=\"C050-025X075\">\n<description>&lt;b&gt;CAPACITOR&lt;/b&gt;&lt;p&gt;\ngrid 5 mm, outline 2.5 x 7.5 mm</description>\n<wire x1=\"-0.3048\" y1=\"0.635\" x2=\"-0.3048\" y2=\"0\" width=\"0.3048\" layer=\"21\"/>\n<wire x1=\"-0.3048\" y1=\"0\" x2=\"-0.3048\" y2=\"-0.635\" width=\"0.3048\" layer=\"21\"/>\n<wire x1=\"-0.3048\" y1=\"0\" x2=\"-1.524\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"0.3302\" y1=\"0.635\" x2=\"0.3302\" y2=\"0\" width=\"0.3048\" layer=\"21\"/>\n<wire x1=\"0.3302\" y1=\"0\" x2=\"0.3302\" y2=\"-0.635\" width=\"0.3048\" layer=\"21\"/>\n<wire x1=\"0.3302\" y1=\"0\" x2=\"1.524\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-3.683\" y1=\"1.016\" x2=\"-3.683\" y2=\"-1.016\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-3.429\" y1=\"-1.27\" x2=\"3.429\" y2=\"-1.27\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"3.683\" y1=\"-1.016\" x2=\"3.683\" y2=\"1.016\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"3.429\" y1=\"1.27\" x2=\"-3.429\" y2=\"1.27\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"3.429\" y1=\"1.27\" x2=\"3.683\" y2=\"1.016\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"3.429\" y1=\"-1.27\" x2=\"3.683\" y2=\"-1.016\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"-3.683\" y1=\"-1.016\" x2=\"-3.429\" y2=\"-1.27\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"-3.683\" y1=\"1.016\" x2=\"-3.429\" y2=\"1.27\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<pad name=\"1\" x=\"-2.54\" y=\"0\" drill=\"0.8128\" shape=\"octagon\"/>\n<pad name=\"2\" x=\"2.54\" y=\"0\" drill=\"0.8128\" shape=\"octagon\"/>\n<text x=\"-3.429\" y=\"1.651\" size=\"1.27\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-3.429\" y=\"-2.794\" size=\"1.27\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n</package>\n<package name=\"C050-045X075\">\n<description>&lt;b&gt;CAPACITOR&lt;/b&gt;&lt;p&gt;\ngrid 5 mm, outline 4.5 x 7.5 mm</description>\n<wire x1=\"-0.3048\" y1=\"0.635\" x2=\"-0.3048\" y2=\"0\" width=\"0.3048\" layer=\"21\"/>\n<wire x1=\"-0.3048\" y1=\"0\" x2=\"-0.3048\" y2=\"-0.635\" width=\"0.3048\" layer=\"21\"/>\n<wire x1=\"-0.3048\" y1=\"0\" x2=\"-1.524\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"0.3302\" y1=\"0.635\" x2=\"0.3302\" y2=\"0\" width=\"0.3048\" layer=\"21\"/>\n<wire x1=\"0.3302\" y1=\"0\" x2=\"0.3302\" y2=\"-0.635\" width=\"0.3048\" layer=\"21\"/>\n<wire x1=\"0.3302\" y1=\"0\" x2=\"1.524\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-3.683\" y1=\"2.032\" x2=\"-3.683\" y2=\"-2.032\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-3.429\" y1=\"-2.286\" x2=\"3.429\" y2=\"-2.286\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"3.683\" y1=\"-2.032\" x2=\"3.683\" y2=\"2.032\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"3.429\" y1=\"2.286\" x2=\"-3.429\" y2=\"2.286\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"3.429\" y1=\"2.286\" x2=\"3.683\" y2=\"2.032\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"3.429\" y1=\"-2.286\" x2=\"3.683\" y2=\"-2.032\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"-3.683\" y1=\"-2.032\" x2=\"-3.429\" y2=\"-2.286\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"-3.683\" y1=\"2.032\" x2=\"-3.429\" y2=\"2.286\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<pad name=\"1\" x=\"-2.54\" y=\"0\" drill=\"0.8128\" shape=\"octagon\"/>\n<pad name=\"2\" x=\"2.54\" y=\"0\" drill=\"0.8128\" shape=\"octagon\"/>\n<text x=\"-3.556\" y=\"2.667\" size=\"1.27\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-3.556\" y=\"-3.81\" size=\"1.27\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n</package>\n<package name=\"C050-030X075\">\n<description>&lt;b&gt;CAPACITOR&lt;/b&gt;&lt;p&gt;\ngrid 5 mm, outline 3 x 7.5 mm</description>\n<wire x1=\"-0.3048\" y1=\"0.635\" x2=\"-0.3048\" y2=\"0\" width=\"0.3048\" layer=\"21\"/>\n<wire x1=\"-0.3048\" y1=\"0\" x2=\"-0.3048\" y2=\"-0.635\" width=\"0.3048\" layer=\"21\"/>\n<wire x1=\"-0.3048\" y1=\"0\" x2=\"-1.524\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"0.3302\" y1=\"0.635\" x2=\"0.3302\" y2=\"0\" width=\"0.3048\" layer=\"21\"/>\n<wire x1=\"0.3302\" y1=\"0\" x2=\"0.3302\" y2=\"-0.635\" width=\"0.3048\" layer=\"21\"/>\n<wire x1=\"0.3302\" y1=\"0\" x2=\"1.524\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-3.683\" y1=\"1.27\" x2=\"-3.683\" y2=\"-1.27\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-3.429\" y1=\"-1.524\" x2=\"3.429\" y2=\"-1.524\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"3.683\" y1=\"-1.27\" x2=\"3.683\" y2=\"1.27\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"3.429\" y1=\"1.524\" x2=\"-3.429\" y2=\"1.524\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"3.429\" y1=\"1.524\" x2=\"3.683\" y2=\"1.27\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"3.429\" y1=\"-1.524\" x2=\"3.683\" y2=\"-1.27\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"-3.683\" y1=\"-1.27\" x2=\"-3.429\" y2=\"-1.524\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"-3.683\" y1=\"1.27\" x2=\"-3.429\" y2=\"1.524\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<pad name=\"1\" x=\"-2.54\" y=\"0\" drill=\"0.8128\" shape=\"octagon\"/>\n<pad name=\"2\" x=\"2.54\" y=\"0\" drill=\"0.8128\" shape=\"octagon\"/>\n<text x=\"-3.556\" y=\"1.905\" size=\"1.27\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-3.556\" y=\"-3.048\" size=\"1.27\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n</package>\n<package name=\"C050-050X075\">\n<description>&lt;b&gt;CAPACITOR&lt;/b&gt;&lt;p&gt;\ngrid 5 mm, outline 5 x 7.5 mm</description>\n<wire x1=\"-0.3048\" y1=\"0.635\" x2=\"-0.3048\" y2=\"0\" width=\"0.3048\" layer=\"21\"/>\n<wire x1=\"-0.3048\" y1=\"0\" x2=\"-0.3048\" y2=\"-0.635\" width=\"0.3048\" layer=\"21\"/>\n<wire x1=\"-0.3048\" y1=\"0\" x2=\"-1.524\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"0.3302\" y1=\"0.635\" x2=\"0.3302\" y2=\"0\" width=\"0.3048\" layer=\"21\"/>\n<wire x1=\"0.3302\" y1=\"0\" x2=\"0.3302\" y2=\"-0.635\" width=\"0.3048\" layer=\"21\"/>\n<wire x1=\"0.3302\" y1=\"0\" x2=\"1.524\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-3.683\" y1=\"2.286\" x2=\"-3.683\" y2=\"-2.286\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-3.429\" y1=\"-2.54\" x2=\"3.429\" y2=\"-2.54\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"3.683\" y1=\"-2.286\" x2=\"3.683\" y2=\"2.286\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"3.429\" y1=\"2.54\" x2=\"-3.429\" y2=\"2.54\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"3.429\" y1=\"2.54\" x2=\"3.683\" y2=\"2.286\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"3.429\" y1=\"-2.54\" x2=\"3.683\" y2=\"-2.286\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"-3.683\" y1=\"-2.286\" x2=\"-3.429\" y2=\"-2.54\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"-3.683\" y1=\"2.286\" x2=\"-3.429\" y2=\"2.54\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<pad name=\"1\" x=\"-2.54\" y=\"0\" drill=\"0.8128\" shape=\"octagon\"/>\n<pad name=\"2\" x=\"2.54\" y=\"0\" drill=\"0.8128\" shape=\"octagon\"/>\n<text x=\"-3.429\" y=\"2.921\" size=\"1.27\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-3.175\" y=\"-2.159\" size=\"1.27\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n</package>\n<package name=\"C050-055X075\">\n<description>&lt;b&gt;CAPACITOR&lt;/b&gt;&lt;p&gt;\ngrid 5 mm, outline 5.5 x 7.5 mm</description>\n<wire x1=\"-0.3048\" y1=\"0.635\" x2=\"-0.3048\" y2=\"0\" width=\"0.3048\" layer=\"21\"/>\n<wire x1=\"-0.3048\" y1=\"0\" x2=\"-0.3048\" y2=\"-0.635\" width=\"0.3048\" layer=\"21\"/>\n<wire x1=\"-0.3048\" y1=\"0\" x2=\"-1.524\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"0.3302\" y1=\"0.635\" x2=\"0.3302\" y2=\"0\" width=\"0.3048\" layer=\"21\"/>\n<wire x1=\"0.3302\" y1=\"0\" x2=\"0.3302\" y2=\"-0.635\" width=\"0.3048\" layer=\"21\"/>\n<wire x1=\"0.3302\" y1=\"0\" x2=\"1.524\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-3.683\" y1=\"2.54\" x2=\"-3.683\" y2=\"-2.54\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-3.429\" y1=\"-2.794\" x2=\"3.429\" y2=\"-2.794\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"3.683\" y1=\"-2.54\" x2=\"3.683\" y2=\"2.54\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"3.429\" y1=\"2.794\" x2=\"-3.429\" y2=\"2.794\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"3.429\" y1=\"2.794\" x2=\"3.683\" y2=\"2.54\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"3.429\" y1=\"-2.794\" x2=\"3.683\" y2=\"-2.54\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"-3.683\" y1=\"-2.54\" x2=\"-3.429\" y2=\"-2.794\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"-3.683\" y1=\"2.54\" x2=\"-3.429\" y2=\"2.794\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<pad name=\"1\" x=\"-2.54\" y=\"0\" drill=\"0.8128\" shape=\"octagon\"/>\n<pad name=\"2\" x=\"2.54\" y=\"0\" drill=\"0.8128\" shape=\"octagon\"/>\n<text x=\"-3.429\" y=\"3.175\" size=\"1.27\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-3.302\" y=\"-2.286\" size=\"1.27\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n</package>\n<package name=\"C050-075X075\">\n<description>&lt;b&gt;CAPACITOR&lt;/b&gt;&lt;p&gt;\ngrid 5 mm, outline 7.5 x 7.5 mm</description>\n<wire x1=\"-1.524\" y1=\"0\" x2=\"-0.4572\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-0.4572\" y1=\"0\" x2=\"-0.4572\" y2=\"0.762\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-0.4572\" y1=\"0\" x2=\"-0.4572\" y2=\"-0.762\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"0.4318\" y1=\"0.762\" x2=\"0.4318\" y2=\"0\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"0.4318\" y1=\"0\" x2=\"1.524\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"0.4318\" y1=\"0\" x2=\"0.4318\" y2=\"-0.762\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-3.683\" y1=\"3.429\" x2=\"-3.683\" y2=\"-3.429\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-3.429\" y1=\"-3.683\" x2=\"3.429\" y2=\"-3.683\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"3.683\" y1=\"-3.429\" x2=\"3.683\" y2=\"3.429\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"3.429\" y1=\"3.683\" x2=\"-3.429\" y2=\"3.683\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"3.429\" y1=\"3.683\" x2=\"3.683\" y2=\"3.429\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"3.429\" y1=\"-3.683\" x2=\"3.683\" y2=\"-3.429\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"-3.683\" y1=\"-3.429\" x2=\"-3.429\" y2=\"-3.683\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"-3.683\" y1=\"3.429\" x2=\"-3.429\" y2=\"3.683\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<pad name=\"1\" x=\"-2.54\" y=\"0\" drill=\"0.8128\" shape=\"octagon\"/>\n<pad name=\"2\" x=\"2.54\" y=\"0\" drill=\"0.8128\" shape=\"octagon\"/>\n<text x=\"-3.429\" y=\"4.064\" size=\"1.27\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-3.175\" y=\"-2.921\" size=\"1.27\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n</package>\n<package name=\"C050H075X075\">\n<description>&lt;b&gt;CAPACITOR&lt;/b&gt;&lt;p&gt;\nHorizontal, grid 5 mm, outline 7.5 x 7.5 mm</description>\n<wire x1=\"-3.683\" y1=\"7.112\" x2=\"-3.683\" y2=\"0.508\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-3.683\" y1=\"0.508\" x2=\"-3.302\" y2=\"0.508\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-3.302\" y1=\"0.508\" x2=\"-1.778\" y2=\"0.508\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"-1.778\" y1=\"0.508\" x2=\"1.778\" y2=\"0.508\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"1.778\" y1=\"0.508\" x2=\"3.302\" y2=\"0.508\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"3.302\" y1=\"0.508\" x2=\"3.683\" y2=\"0.508\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"3.683\" y1=\"0.508\" x2=\"3.683\" y2=\"7.112\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"3.175\" y1=\"7.62\" x2=\"-3.175\" y2=\"7.62\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-0.3048\" y1=\"2.413\" x2=\"-0.3048\" y2=\"1.778\" width=\"0.3048\" layer=\"21\"/>\n<wire x1=\"-0.3048\" y1=\"1.778\" x2=\"-0.3048\" y2=\"1.143\" width=\"0.3048\" layer=\"21\"/>\n<wire x1=\"-0.3048\" y1=\"1.778\" x2=\"-1.651\" y2=\"1.778\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"0.3302\" y1=\"2.413\" x2=\"0.3302\" y2=\"1.778\" width=\"0.3048\" layer=\"21\"/>\n<wire x1=\"0.3302\" y1=\"1.778\" x2=\"0.3302\" y2=\"1.143\" width=\"0.3048\" layer=\"21\"/>\n<wire x1=\"0.3302\" y1=\"1.778\" x2=\"1.651\" y2=\"1.778\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-3.683\" y1=\"7.112\" x2=\"-3.175\" y2=\"7.62\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"3.175\" y1=\"7.62\" x2=\"3.683\" y2=\"7.112\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"-2.54\" y1=\"0\" x2=\"-2.54\" y2=\"0.254\" width=\"0.508\" layer=\"51\"/>\n<wire x1=\"2.54\" y1=\"0\" x2=\"2.54\" y2=\"0.254\" width=\"0.508\" layer=\"51\"/>\n<pad name=\"1\" x=\"-2.54\" y=\"0\" drill=\"0.8128\" shape=\"octagon\"/>\n<pad name=\"2\" x=\"2.54\" y=\"0\" drill=\"0.8128\" shape=\"octagon\"/>\n<text x=\"-3.302\" y=\"8.001\" size=\"1.27\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-3.175\" y=\"3.175\" size=\"1.27\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n<rectangle x1=\"-2.794\" y1=\"0.127\" x2=\"-2.286\" y2=\"0.508\" layer=\"51\"/>\n<rectangle x1=\"2.286\" y1=\"0.127\" x2=\"2.794\" y2=\"0.508\" layer=\"51\"/>\n</package>\n<package name=\"C075-032X103\">\n<description>&lt;b&gt;CAPACITOR&lt;/b&gt;&lt;p&gt;\ngrid 7.5 mm, outline 3.2 x 10.3 mm</description>\n<wire x1=\"4.826\" y1=\"1.524\" x2=\"-4.826\" y2=\"1.524\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-5.08\" y1=\"1.27\" x2=\"-5.08\" y2=\"-1.27\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-4.826\" y1=\"-1.524\" x2=\"4.826\" y2=\"-1.524\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"5.08\" y1=\"-1.27\" x2=\"5.08\" y2=\"1.27\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"4.826\" y1=\"1.524\" x2=\"5.08\" y2=\"1.27\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"4.826\" y1=\"-1.524\" x2=\"5.08\" y2=\"-1.27\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"-5.08\" y1=\"-1.27\" x2=\"-4.826\" y2=\"-1.524\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"-5.08\" y1=\"1.27\" x2=\"-4.826\" y2=\"1.524\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"0.508\" y1=\"0\" x2=\"2.54\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-2.54\" y1=\"0\" x2=\"-0.508\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-0.508\" y1=\"0.889\" x2=\"-0.508\" y2=\"0\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-0.508\" y1=\"0\" x2=\"-0.508\" y2=\"-0.889\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"0.508\" y1=\"0.889\" x2=\"0.508\" y2=\"0\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"0.508\" y1=\"0\" x2=\"0.508\" y2=\"-0.889\" width=\"0.4064\" layer=\"21\"/>\n<pad name=\"1\" x=\"-3.81\" y=\"0\" drill=\"0.9144\" shape=\"octagon\"/>\n<pad name=\"2\" x=\"3.81\" y=\"0\" drill=\"0.9144\" shape=\"octagon\"/>\n<text x=\"-4.826\" y=\"1.905\" size=\"1.27\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-4.826\" y=\"-3.048\" size=\"1.27\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n</package>\n<package name=\"C075-042X103\">\n<description>&lt;b&gt;CAPACITOR&lt;/b&gt;&lt;p&gt;\ngrid 7.5 mm, outline 4.2 x 10.3 mm</description>\n<wire x1=\"4.826\" y1=\"2.032\" x2=\"-4.826\" y2=\"2.032\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-5.08\" y1=\"1.778\" x2=\"-5.08\" y2=\"-1.778\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-4.826\" y1=\"-2.032\" x2=\"4.826\" y2=\"-2.032\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"5.08\" y1=\"-1.778\" x2=\"5.08\" y2=\"1.778\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"4.826\" y1=\"2.032\" x2=\"5.08\" y2=\"1.778\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"4.826\" y1=\"-2.032\" x2=\"5.08\" y2=\"-1.778\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"-5.08\" y1=\"-1.778\" x2=\"-4.826\" y2=\"-2.032\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"-5.08\" y1=\"1.778\" x2=\"-4.826\" y2=\"2.032\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"-1.27\" y1=\"0\" x2=\"2.667\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-2.667\" y1=\"0\" x2=\"-2.159\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-2.159\" y1=\"1.27\" x2=\"-2.159\" y2=\"0\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-2.159\" y1=\"0\" x2=\"-2.159\" y2=\"-1.27\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-1.27\" y1=\"1.27\" x2=\"-1.27\" y2=\"0\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-1.27\" y1=\"0\" x2=\"-1.27\" y2=\"-1.27\" width=\"0.4064\" layer=\"21\"/>\n<pad name=\"1\" x=\"-3.81\" y=\"0\" drill=\"0.9144\" shape=\"octagon\"/>\n<pad name=\"2\" x=\"3.81\" y=\"0\" drill=\"0.9144\" shape=\"octagon\"/>\n<text x=\"-4.699\" y=\"2.413\" size=\"1.27\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-0.635\" y=\"-1.651\" size=\"1.27\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n</package>\n<package name=\"C075-052X106\">\n<description>&lt;b&gt;CAPACITOR&lt;/b&gt;&lt;p&gt;\ngrid 7.5 mm, outline 5.2 x 10.6 mm</description>\n<wire x1=\"4.953\" y1=\"2.54\" x2=\"-4.953\" y2=\"2.54\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-5.207\" y1=\"2.286\" x2=\"-5.207\" y2=\"-2.286\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-4.953\" y1=\"-2.54\" x2=\"4.953\" y2=\"-2.54\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"5.207\" y1=\"-2.286\" x2=\"5.207\" y2=\"2.286\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"4.953\" y1=\"2.54\" x2=\"5.207\" y2=\"2.286\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"4.953\" y1=\"-2.54\" x2=\"5.207\" y2=\"-2.286\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"-5.207\" y1=\"-2.286\" x2=\"-4.953\" y2=\"-2.54\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"-5.207\" y1=\"2.286\" x2=\"-4.953\" y2=\"2.54\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"-1.27\" y1=\"0\" x2=\"2.667\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-2.667\" y1=\"0\" x2=\"-2.159\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-2.159\" y1=\"1.27\" x2=\"-2.159\" y2=\"0\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-2.159\" y1=\"0\" x2=\"-2.159\" y2=\"-1.27\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-1.27\" y1=\"1.27\" x2=\"-1.27\" y2=\"0\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-1.27\" y1=\"0\" x2=\"-1.27\" y2=\"-1.27\" width=\"0.4064\" layer=\"21\"/>\n<pad name=\"1\" x=\"-3.81\" y=\"0\" drill=\"0.9144\" shape=\"octagon\"/>\n<pad name=\"2\" x=\"3.81\" y=\"0\" drill=\"0.9144\" shape=\"octagon\"/>\n<text x=\"-4.826\" y=\"2.921\" size=\"1.27\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-0.635\" y=\"-2.032\" size=\"1.27\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n</package>\n<package name=\"C102-043X133\">\n<description>&lt;b&gt;CAPACITOR&lt;/b&gt;&lt;p&gt;\ngrid 10.2 mm, outline 4.3 x 13.3 mm</description>\n<wire x1=\"-3.175\" y1=\"1.27\" x2=\"-3.175\" y2=\"0\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-2.286\" y1=\"1.27\" x2=\"-2.286\" y2=\"0\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"3.81\" y1=\"0\" x2=\"-2.286\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-2.286\" y1=\"0\" x2=\"-2.286\" y2=\"-1.27\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-3.81\" y1=\"0\" x2=\"-3.175\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-3.175\" y1=\"0\" x2=\"-3.175\" y2=\"-1.27\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-6.096\" y1=\"2.032\" x2=\"6.096\" y2=\"2.032\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"6.604\" y1=\"1.524\" x2=\"6.604\" y2=\"-1.524\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"6.096\" y1=\"-2.032\" x2=\"-6.096\" y2=\"-2.032\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-6.604\" y1=\"-1.524\" x2=\"-6.604\" y2=\"1.524\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"6.096\" y1=\"2.032\" x2=\"6.604\" y2=\"1.524\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"6.096\" y1=\"-2.032\" x2=\"6.604\" y2=\"-1.524\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"-6.604\" y1=\"-1.524\" x2=\"-6.096\" y2=\"-2.032\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"-6.604\" y1=\"1.524\" x2=\"-6.096\" y2=\"2.032\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<pad name=\"1\" x=\"-5.08\" y=\"0\" drill=\"1.016\" shape=\"octagon\"/>\n<pad name=\"2\" x=\"5.08\" y=\"0\" drill=\"1.016\" shape=\"octagon\"/>\n<text x=\"-6.096\" y=\"2.413\" size=\"1.27\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-1.524\" y=\"-1.651\" size=\"1.27\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n</package>\n<package name=\"C102-054X133\">\n<description>&lt;b&gt;CAPACITOR&lt;/b&gt;&lt;p&gt;\ngrid 10.2 mm, outline 5.4 x 13.3 mm</description>\n<wire x1=\"-3.175\" y1=\"1.27\" x2=\"-3.175\" y2=\"0\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-2.286\" y1=\"1.27\" x2=\"-2.286\" y2=\"0\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"3.81\" y1=\"0\" x2=\"-2.286\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-2.286\" y1=\"0\" x2=\"-2.286\" y2=\"-1.27\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-3.81\" y1=\"0\" x2=\"-3.175\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-3.175\" y1=\"0\" x2=\"-3.175\" y2=\"-1.27\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-6.096\" y1=\"2.54\" x2=\"6.096\" y2=\"2.54\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"6.604\" y1=\"2.032\" x2=\"6.604\" y2=\"-2.032\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"6.096\" y1=\"-2.54\" x2=\"-6.096\" y2=\"-2.54\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-6.604\" y1=\"-2.032\" x2=\"-6.604\" y2=\"2.032\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"6.096\" y1=\"2.54\" x2=\"6.604\" y2=\"2.032\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"6.096\" y1=\"-2.54\" x2=\"6.604\" y2=\"-2.032\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"-6.604\" y1=\"-2.032\" x2=\"-6.096\" y2=\"-2.54\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"-6.604\" y1=\"2.032\" x2=\"-6.096\" y2=\"2.54\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<pad name=\"1\" x=\"-5.08\" y=\"0\" drill=\"1.016\" shape=\"octagon\"/>\n<pad name=\"2\" x=\"5.08\" y=\"0\" drill=\"1.016\" shape=\"octagon\"/>\n<text x=\"-6.096\" y=\"2.921\" size=\"1.27\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-1.524\" y=\"-1.905\" size=\"1.27\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n</package>\n<package name=\"C102-064X133\">\n<description>&lt;b&gt;CAPACITOR&lt;/b&gt;&lt;p&gt;\ngrid 10.2 mm, outline 6.4 x 13.3 mm</description>\n<wire x1=\"-3.175\" y1=\"1.27\" x2=\"-3.175\" y2=\"0\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-2.286\" y1=\"1.27\" x2=\"-2.286\" y2=\"0\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"3.81\" y1=\"0\" x2=\"-2.286\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-2.286\" y1=\"0\" x2=\"-2.286\" y2=\"-1.27\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-3.81\" y1=\"0\" x2=\"-3.175\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-3.175\" y1=\"0\" x2=\"-3.175\" y2=\"-1.27\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-6.096\" y1=\"3.048\" x2=\"6.096\" y2=\"3.048\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"6.604\" y1=\"2.54\" x2=\"6.604\" y2=\"-2.54\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"6.096\" y1=\"-3.048\" x2=\"-6.096\" y2=\"-3.048\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-6.604\" y1=\"-2.54\" x2=\"-6.604\" y2=\"2.54\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"6.096\" y1=\"3.048\" x2=\"6.604\" y2=\"2.54\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"6.096\" y1=\"-3.048\" x2=\"6.604\" y2=\"-2.54\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"-6.604\" y1=\"-2.54\" x2=\"-6.096\" y2=\"-3.048\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"-6.604\" y1=\"2.54\" x2=\"-6.096\" y2=\"3.048\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<pad name=\"1\" x=\"-5.08\" y=\"0\" drill=\"1.016\" shape=\"octagon\"/>\n<pad name=\"2\" x=\"5.08\" y=\"0\" drill=\"1.016\" shape=\"octagon\"/>\n<text x=\"-6.096\" y=\"3.429\" size=\"1.27\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-1.524\" y=\"-2.032\" size=\"1.27\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n</package>\n<package name=\"C102_152-062X184\">\n<description>&lt;b&gt;CAPACITOR&lt;/b&gt;&lt;p&gt;\ngrid 10.2 mm + 15.2 mm, outline 6.2 x 18.4 mm</description>\n<wire x1=\"-2.286\" y1=\"1.27\" x2=\"-2.286\" y2=\"0\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-2.286\" y1=\"0\" x2=\"-2.286\" y2=\"-1.27\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-3.175\" y1=\"1.27\" x2=\"-3.175\" y2=\"0\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-3.175\" y1=\"0\" x2=\"-3.175\" y2=\"-1.27\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-3.683\" y1=\"0\" x2=\"-3.175\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-2.286\" y1=\"0\" x2=\"3.683\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"6.477\" y1=\"0\" x2=\"8.636\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-6.096\" y1=\"3.048\" x2=\"6.223\" y2=\"3.048\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"6.223\" y1=\"-3.048\" x2=\"-6.096\" y2=\"-3.048\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-6.604\" y1=\"-2.54\" x2=\"-6.604\" y2=\"2.54\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"6.223\" y1=\"3.048\" x2=\"6.731\" y2=\"2.54\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"6.223\" y1=\"-3.048\" x2=\"6.731\" y2=\"-2.54\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"-6.604\" y1=\"-2.54\" x2=\"-6.096\" y2=\"-3.048\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"-6.604\" y1=\"2.54\" x2=\"-6.096\" y2=\"3.048\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"6.731\" y1=\"2.54\" x2=\"6.731\" y2=\"-2.54\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"11.176\" y1=\"3.048\" x2=\"11.684\" y2=\"2.54\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"11.176\" y1=\"-3.048\" x2=\"11.684\" y2=\"-2.54\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"11.176\" y1=\"-3.048\" x2=\"7.112\" y2=\"-3.048\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"7.112\" y1=\"3.048\" x2=\"11.176\" y2=\"3.048\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"11.684\" y1=\"2.54\" x2=\"11.684\" y2=\"-2.54\" width=\"0.1524\" layer=\"21\"/>\n<pad name=\"1\" x=\"-5.08\" y=\"0\" drill=\"1.016\" shape=\"octagon\"/>\n<pad name=\"2\" x=\"5.08\" y=\"0\" drill=\"1.016\" shape=\"octagon\"/>\n<pad name=\"3\" x=\"10.033\" y=\"0\" drill=\"1.016\" shape=\"octagon\"/>\n<text x=\"-5.969\" y=\"3.429\" size=\"1.27\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-1.524\" y=\"-2.286\" size=\"1.27\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n</package>\n<package name=\"C150-054X183\">\n<description>&lt;b&gt;CAPACITOR&lt;/b&gt;&lt;p&gt;\ngrid 15 mm, outline 5.4 x 18.3 mm</description>\n<wire x1=\"-5.08\" y1=\"1.27\" x2=\"-5.08\" y2=\"0\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-5.08\" y1=\"0\" x2=\"-5.08\" y2=\"-1.27\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-4.191\" y1=\"1.27\" x2=\"-4.191\" y2=\"0\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-4.191\" y1=\"0\" x2=\"-4.191\" y2=\"-1.27\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-4.191\" y1=\"0\" x2=\"6.096\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-5.08\" y1=\"0\" x2=\"-6.096\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"9.017\" y1=\"2.032\" x2=\"9.017\" y2=\"-2.032\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"8.509\" y1=\"-2.54\" x2=\"-8.509\" y2=\"-2.54\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-9.017\" y1=\"-2.032\" x2=\"-9.017\" y2=\"2.032\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-8.509\" y1=\"2.54\" x2=\"8.509\" y2=\"2.54\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"8.509\" y1=\"2.54\" x2=\"9.017\" y2=\"2.032\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"8.509\" y1=\"-2.54\" x2=\"9.017\" y2=\"-2.032\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"-9.017\" y1=\"-2.032\" x2=\"-8.509\" y2=\"-2.54\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"-9.017\" y1=\"2.032\" x2=\"-8.509\" y2=\"2.54\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<pad name=\"1\" x=\"-7.493\" y=\"0\" drill=\"1.016\" shape=\"octagon\"/>\n<pad name=\"2\" x=\"7.493\" y=\"0\" drill=\"1.016\" shape=\"octagon\"/>\n<text x=\"-8.382\" y=\"2.921\" size=\"1.27\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-3.429\" y=\"-2.032\" size=\"1.27\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n</package>\n<package name=\"C150-064X183\">\n<description>&lt;b&gt;CAPACITOR&lt;/b&gt;&lt;p&gt;\ngrid 15 mm, outline 6.4 x 18.3 mm</description>\n<wire x1=\"-5.08\" y1=\"1.27\" x2=\"-5.08\" y2=\"0\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-5.08\" y1=\"0\" x2=\"-5.08\" y2=\"-1.27\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-4.191\" y1=\"1.27\" x2=\"-4.191\" y2=\"0\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-4.191\" y1=\"0\" x2=\"-4.191\" y2=\"-1.27\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-4.191\" y1=\"0\" x2=\"6.096\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-5.08\" y1=\"0\" x2=\"-6.096\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"9.017\" y1=\"2.54\" x2=\"9.017\" y2=\"-2.54\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"8.509\" y1=\"-3.048\" x2=\"-8.509\" y2=\"-3.048\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-9.017\" y1=\"-2.54\" x2=\"-9.017\" y2=\"2.54\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-8.509\" y1=\"3.048\" x2=\"8.509\" y2=\"3.048\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"8.509\" y1=\"3.048\" x2=\"9.017\" y2=\"2.54\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"8.509\" y1=\"-3.048\" x2=\"9.017\" y2=\"-2.54\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"-9.017\" y1=\"-2.54\" x2=\"-8.509\" y2=\"-3.048\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"-9.017\" y1=\"2.54\" x2=\"-8.509\" y2=\"3.048\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<pad name=\"1\" x=\"-7.493\" y=\"0\" drill=\"1.016\" shape=\"octagon\"/>\n<pad name=\"2\" x=\"7.493\" y=\"0\" drill=\"1.016\" shape=\"octagon\"/>\n<text x=\"-8.509\" y=\"3.429\" size=\"1.27\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-3.429\" y=\"-2.032\" size=\"1.27\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n</package>\n<package name=\"C150-072X183\">\n<description>&lt;b&gt;CAPACITOR&lt;/b&gt;&lt;p&gt;\ngrid 15 mm, outline 7.2 x 18.3 mm</description>\n<wire x1=\"-5.08\" y1=\"1.27\" x2=\"-5.08\" y2=\"0\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-5.08\" y1=\"0\" x2=\"-5.08\" y2=\"-1.27\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-4.191\" y1=\"1.27\" x2=\"-4.191\" y2=\"0\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-4.191\" y1=\"0\" x2=\"-4.191\" y2=\"-1.27\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-4.191\" y1=\"0\" x2=\"6.096\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-5.08\" y1=\"0\" x2=\"-6.096\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"9.017\" y1=\"3.048\" x2=\"9.017\" y2=\"-3.048\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"8.509\" y1=\"-3.556\" x2=\"-8.509\" y2=\"-3.556\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-9.017\" y1=\"-3.048\" x2=\"-9.017\" y2=\"3.048\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-8.509\" y1=\"3.556\" x2=\"8.509\" y2=\"3.556\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"8.509\" y1=\"3.556\" x2=\"9.017\" y2=\"3.048\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"8.509\" y1=\"-3.556\" x2=\"9.017\" y2=\"-3.048\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"-9.017\" y1=\"-3.048\" x2=\"-8.509\" y2=\"-3.556\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"-9.017\" y1=\"3.048\" x2=\"-8.509\" y2=\"3.556\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<pad name=\"1\" x=\"-7.493\" y=\"0\" drill=\"1.016\" shape=\"octagon\"/>\n<pad name=\"2\" x=\"7.493\" y=\"0\" drill=\"1.016\" shape=\"octagon\"/>\n<text x=\"-8.509\" y=\"3.937\" size=\"1.27\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-3.429\" y=\"-2.286\" size=\"1.27\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n</package>\n<package name=\"C150-084X183\">\n<description>&lt;b&gt;CAPACITOR&lt;/b&gt;&lt;p&gt;\ngrid 15 mm, outline 8.4 x 18.3 mm</description>\n<wire x1=\"-5.08\" y1=\"1.27\" x2=\"-5.08\" y2=\"0\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-5.08\" y1=\"0\" x2=\"-5.08\" y2=\"-1.27\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-4.191\" y1=\"1.27\" x2=\"-4.191\" y2=\"0\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-4.191\" y1=\"0\" x2=\"-4.191\" y2=\"-1.27\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-4.191\" y1=\"0\" x2=\"6.096\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-5.08\" y1=\"0\" x2=\"-6.096\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"9.017\" y1=\"3.556\" x2=\"9.017\" y2=\"-3.556\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"8.509\" y1=\"-4.064\" x2=\"-8.509\" y2=\"-4.064\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-9.017\" y1=\"-3.556\" x2=\"-9.017\" y2=\"3.556\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-8.509\" y1=\"4.064\" x2=\"8.509\" y2=\"4.064\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"8.509\" y1=\"4.064\" x2=\"9.017\" y2=\"3.556\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"8.509\" y1=\"-4.064\" x2=\"9.017\" y2=\"-3.556\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"-9.017\" y1=\"-3.556\" x2=\"-8.509\" y2=\"-4.064\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"-9.017\" y1=\"3.556\" x2=\"-8.509\" y2=\"4.064\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<pad name=\"1\" x=\"-7.493\" y=\"0\" drill=\"1.016\" shape=\"octagon\"/>\n<pad name=\"2\" x=\"7.493\" y=\"0\" drill=\"1.016\" shape=\"octagon\"/>\n<text x=\"-8.509\" y=\"4.445\" size=\"1.27\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-3.429\" y=\"-2.54\" size=\"1.27\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n</package>\n<package name=\"C150-091X182\">\n<description>&lt;b&gt;CAPACITOR&lt;/b&gt;&lt;p&gt;\ngrid 15 mm, outline 9.1 x 18.2 mm</description>\n<wire x1=\"-5.08\" y1=\"1.27\" x2=\"-5.08\" y2=\"0\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-5.08\" y1=\"0\" x2=\"-5.08\" y2=\"-1.27\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-4.191\" y1=\"1.27\" x2=\"-4.191\" y2=\"0\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-4.191\" y1=\"0\" x2=\"-4.191\" y2=\"-1.27\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-4.191\" y1=\"0\" x2=\"6.096\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-5.08\" y1=\"0\" x2=\"-6.096\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"9.017\" y1=\"3.937\" x2=\"9.017\" y2=\"-3.937\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"8.509\" y1=\"-4.445\" x2=\"-8.509\" y2=\"-4.445\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-9.017\" y1=\"-3.937\" x2=\"-9.017\" y2=\"3.937\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-8.509\" y1=\"4.445\" x2=\"8.509\" y2=\"4.445\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"8.509\" y1=\"4.445\" x2=\"9.017\" y2=\"3.937\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"8.509\" y1=\"-4.445\" x2=\"9.017\" y2=\"-3.937\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"-9.017\" y1=\"-3.937\" x2=\"-8.509\" y2=\"-4.445\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"-9.017\" y1=\"3.937\" x2=\"-8.509\" y2=\"4.445\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<pad name=\"1\" x=\"-7.493\" y=\"0\" drill=\"1.016\" shape=\"octagon\"/>\n<pad name=\"2\" x=\"7.493\" y=\"0\" drill=\"1.016\" shape=\"octagon\"/>\n<text x=\"-8.509\" y=\"4.826\" size=\"1.27\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-3.429\" y=\"-2.54\" size=\"1.27\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n</package>\n<package name=\"C225-062X268\">\n<description>&lt;b&gt;CAPACITOR&lt;/b&gt;&lt;p&gt;\ngrid 22.5 mm, outline 6.2 x 26.8 mm</description>\n<wire x1=\"-12.827\" y1=\"3.048\" x2=\"12.827\" y2=\"3.048\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"13.335\" y1=\"2.54\" x2=\"13.335\" y2=\"-2.54\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"12.827\" y1=\"-3.048\" x2=\"-12.827\" y2=\"-3.048\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-13.335\" y1=\"-2.54\" x2=\"-13.335\" y2=\"2.54\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-6.731\" y1=\"1.905\" x2=\"-6.731\" y2=\"0\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-6.731\" y1=\"0\" x2=\"-6.731\" y2=\"-1.905\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-7.62\" y1=\"1.905\" x2=\"-7.62\" y2=\"0\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-7.62\" y1=\"0\" x2=\"-7.62\" y2=\"-1.905\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"12.827\" y1=\"3.048\" x2=\"13.335\" y2=\"2.54\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"12.827\" y1=\"-3.048\" x2=\"13.335\" y2=\"-2.54\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"-13.335\" y1=\"-2.54\" x2=\"-12.827\" y2=\"-3.048\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"-13.335\" y1=\"2.54\" x2=\"-12.827\" y2=\"3.048\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"-9.652\" y1=\"0\" x2=\"-7.62\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-6.731\" y1=\"0\" x2=\"9.652\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<pad name=\"1\" x=\"-11.303\" y=\"0\" drill=\"1.016\" shape=\"octagon\"/>\n<pad name=\"2\" x=\"11.303\" y=\"0\" drill=\"1.016\" shape=\"octagon\"/>\n<text x=\"-12.7\" y=\"3.429\" size=\"1.778\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-5.08\" y=\"-2.54\" size=\"1.778\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n</package>\n<package name=\"C225-074X268\">\n<description>&lt;b&gt;CAPACITOR&lt;/b&gt;&lt;p&gt;\ngrid 22.5 mm, outline 7.4 x 26.8 mm</description>\n<wire x1=\"-12.827\" y1=\"3.556\" x2=\"12.827\" y2=\"3.556\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"13.335\" y1=\"3.048\" x2=\"13.335\" y2=\"-3.048\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"12.827\" y1=\"-3.556\" x2=\"-12.827\" y2=\"-3.556\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-13.335\" y1=\"-3.048\" x2=\"-13.335\" y2=\"3.048\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-6.731\" y1=\"1.905\" x2=\"-6.731\" y2=\"0\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-6.731\" y1=\"0\" x2=\"-6.731\" y2=\"-1.905\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-7.62\" y1=\"1.905\" x2=\"-7.62\" y2=\"0\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-7.62\" y1=\"0\" x2=\"-7.62\" y2=\"-1.905\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"12.827\" y1=\"3.556\" x2=\"13.335\" y2=\"3.048\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"12.827\" y1=\"-3.556\" x2=\"13.335\" y2=\"-3.048\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"-13.335\" y1=\"-3.048\" x2=\"-12.827\" y2=\"-3.556\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"-13.335\" y1=\"3.048\" x2=\"-12.827\" y2=\"3.556\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"-9.652\" y1=\"0\" x2=\"-7.62\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-6.731\" y1=\"0\" x2=\"9.652\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<pad name=\"1\" x=\"-11.303\" y=\"0\" drill=\"1.016\" shape=\"octagon\"/>\n<pad name=\"2\" x=\"11.303\" y=\"0\" drill=\"1.016\" shape=\"octagon\"/>\n<text x=\"-12.827\" y=\"3.937\" size=\"1.778\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-5.08\" y=\"-2.54\" size=\"1.778\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n</package>\n<package name=\"C225-087X268\">\n<description>&lt;b&gt;CAPACITOR&lt;/b&gt;&lt;p&gt;\ngrid 22.5 mm, outline 8.7 x 26.8 mm</description>\n<wire x1=\"-12.827\" y1=\"4.318\" x2=\"12.827\" y2=\"4.318\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"13.335\" y1=\"3.81\" x2=\"13.335\" y2=\"-3.81\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"12.827\" y1=\"-4.318\" x2=\"-12.827\" y2=\"-4.318\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-13.335\" y1=\"-3.81\" x2=\"-13.335\" y2=\"3.81\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-6.731\" y1=\"1.905\" x2=\"-6.731\" y2=\"0\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-6.731\" y1=\"0\" x2=\"-6.731\" y2=\"-1.905\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-7.62\" y1=\"1.905\" x2=\"-7.62\" y2=\"0\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-7.62\" y1=\"0\" x2=\"-7.62\" y2=\"-1.905\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"12.827\" y1=\"4.318\" x2=\"13.335\" y2=\"3.81\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"12.827\" y1=\"-4.318\" x2=\"13.335\" y2=\"-3.81\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"-13.335\" y1=\"-3.81\" x2=\"-12.827\" y2=\"-4.318\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"-13.335\" y1=\"3.81\" x2=\"-12.827\" y2=\"4.318\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"-9.652\" y1=\"0\" x2=\"-7.62\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-6.731\" y1=\"0\" x2=\"9.652\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<pad name=\"1\" x=\"-11.303\" y=\"0\" drill=\"1.016\" shape=\"octagon\"/>\n<pad name=\"2\" x=\"11.303\" y=\"0\" drill=\"1.016\" shape=\"octagon\"/>\n<text x=\"-12.827\" y=\"4.699\" size=\"1.778\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-5.08\" y=\"-2.54\" size=\"1.778\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n</package>\n<package name=\"C225-108X268\">\n<description>&lt;b&gt;CAPACITOR&lt;/b&gt;&lt;p&gt;\ngrid 22.5 mm, outline 10.8 x 26.8 mm</description>\n<wire x1=\"-12.827\" y1=\"5.334\" x2=\"12.827\" y2=\"5.334\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"13.335\" y1=\"4.826\" x2=\"13.335\" y2=\"-4.826\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"12.827\" y1=\"-5.334\" x2=\"-12.827\" y2=\"-5.334\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-13.335\" y1=\"-4.826\" x2=\"-13.335\" y2=\"4.826\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-6.731\" y1=\"1.905\" x2=\"-6.731\" y2=\"0\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-6.731\" y1=\"0\" x2=\"-6.731\" y2=\"-1.905\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-7.62\" y1=\"1.905\" x2=\"-7.62\" y2=\"0\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-7.62\" y1=\"0\" x2=\"-7.62\" y2=\"-1.905\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"12.827\" y1=\"5.334\" x2=\"13.335\" y2=\"4.826\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"12.827\" y1=\"-5.334\" x2=\"13.335\" y2=\"-4.826\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"-13.335\" y1=\"-4.826\" x2=\"-12.827\" y2=\"-5.334\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"-13.335\" y1=\"4.826\" x2=\"-12.827\" y2=\"5.334\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"-9.652\" y1=\"0\" x2=\"-7.62\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-6.731\" y1=\"0\" x2=\"9.652\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<pad name=\"1\" x=\"-11.303\" y=\"0\" drill=\"1.016\" shape=\"octagon\"/>\n<pad name=\"2\" x=\"11.303\" y=\"0\" drill=\"1.016\" shape=\"octagon\"/>\n<text x=\"-12.954\" y=\"5.715\" size=\"1.778\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-5.08\" y=\"-2.54\" size=\"1.778\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n</package>\n<package name=\"C225-113X268\">\n<description>&lt;b&gt;CAPACITOR&lt;/b&gt;&lt;p&gt;\ngrid 22.5 mm, outline 11.3 x 26.8 mm</description>\n<wire x1=\"-12.827\" y1=\"5.588\" x2=\"12.827\" y2=\"5.588\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"13.335\" y1=\"5.08\" x2=\"13.335\" y2=\"-5.08\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"12.827\" y1=\"-5.588\" x2=\"-12.827\" y2=\"-5.588\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-13.335\" y1=\"-5.08\" x2=\"-13.335\" y2=\"5.08\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-6.731\" y1=\"1.905\" x2=\"-6.731\" y2=\"0\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-6.731\" y1=\"0\" x2=\"-6.731\" y2=\"-1.905\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-7.62\" y1=\"1.905\" x2=\"-7.62\" y2=\"0\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-7.62\" y1=\"0\" x2=\"-7.62\" y2=\"-1.905\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"12.827\" y1=\"5.588\" x2=\"13.335\" y2=\"5.08\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"12.827\" y1=\"-5.588\" x2=\"13.335\" y2=\"-5.08\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"-13.335\" y1=\"-5.08\" x2=\"-12.827\" y2=\"-5.588\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"-13.335\" y1=\"5.08\" x2=\"-12.827\" y2=\"5.588\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"-9.652\" y1=\"0\" x2=\"-7.62\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-6.731\" y1=\"0\" x2=\"9.652\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<pad name=\"1\" x=\"-11.303\" y=\"0\" drill=\"1.016\" shape=\"octagon\"/>\n<pad name=\"2\" x=\"11.303\" y=\"0\" drill=\"1.016\" shape=\"octagon\"/>\n<text x=\"-12.954\" y=\"5.969\" size=\"1.778\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-5.08\" y=\"-2.54\" size=\"1.778\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n</package>\n<package name=\"C275-093X316\">\n<description>&lt;b&gt;CAPACITOR&lt;/b&gt;&lt;p&gt;\ngrid 27.5 mm, outline 9.3 x 31.6 mm</description>\n<wire x1=\"-15.24\" y1=\"4.572\" x2=\"15.24\" y2=\"4.572\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"15.748\" y1=\"4.064\" x2=\"15.748\" y2=\"-4.064\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"15.24\" y1=\"-4.572\" x2=\"-15.24\" y2=\"-4.572\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-15.748\" y1=\"-4.064\" x2=\"-15.748\" y2=\"4.064\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-6.731\" y1=\"1.905\" x2=\"-6.731\" y2=\"0\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-6.731\" y1=\"0\" x2=\"-6.731\" y2=\"-1.905\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-7.62\" y1=\"1.905\" x2=\"-7.62\" y2=\"0\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-7.62\" y1=\"0\" x2=\"-7.62\" y2=\"-1.905\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"15.24\" y1=\"4.572\" x2=\"15.748\" y2=\"4.064\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"15.24\" y1=\"-4.572\" x2=\"15.748\" y2=\"-4.064\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"-15.748\" y1=\"-4.064\" x2=\"-15.24\" y2=\"-4.572\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"-15.748\" y1=\"4.064\" x2=\"-15.24\" y2=\"4.572\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"-11.557\" y1=\"0\" x2=\"-7.62\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-6.731\" y1=\"0\" x2=\"11.557\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<pad name=\"1\" x=\"-13.716\" y=\"0\" drill=\"1.1938\" shape=\"octagon\"/>\n<pad name=\"2\" x=\"13.716\" y=\"0\" drill=\"1.1938\" shape=\"octagon\"/>\n<text x=\"-15.24\" y=\"4.953\" size=\"1.778\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-5.08\" y=\"-2.54\" size=\"1.778\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n</package>\n<package name=\"C275-113X316\">\n<description>&lt;b&gt;CAPACITOR&lt;/b&gt;&lt;p&gt;\ngrid 27.5 mm, outline 11.3 x 31.6 mm</description>\n<wire x1=\"-15.24\" y1=\"5.588\" x2=\"15.24\" y2=\"5.588\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"15.748\" y1=\"5.08\" x2=\"15.748\" y2=\"-5.08\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"15.24\" y1=\"-5.588\" x2=\"-15.24\" y2=\"-5.588\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-15.748\" y1=\"-5.08\" x2=\"-15.748\" y2=\"5.08\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-6.731\" y1=\"1.905\" x2=\"-6.731\" y2=\"0\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-6.731\" y1=\"0\" x2=\"-6.731\" y2=\"-1.905\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-7.62\" y1=\"1.905\" x2=\"-7.62\" y2=\"0\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-7.62\" y1=\"0\" x2=\"-7.62\" y2=\"-1.905\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"15.24\" y1=\"5.588\" x2=\"15.748\" y2=\"5.08\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"15.24\" y1=\"-5.588\" x2=\"15.748\" y2=\"-5.08\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"-15.748\" y1=\"-5.08\" x2=\"-15.24\" y2=\"-5.588\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"-15.748\" y1=\"5.08\" x2=\"-15.24\" y2=\"5.588\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"-11.557\" y1=\"0\" x2=\"-7.62\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-6.731\" y1=\"0\" x2=\"11.557\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<pad name=\"1\" x=\"-13.716\" y=\"0\" drill=\"1.1938\" shape=\"octagon\"/>\n<pad name=\"2\" x=\"13.716\" y=\"0\" drill=\"1.1938\" shape=\"octagon\"/>\n<text x=\"-15.24\" y=\"5.969\" size=\"1.778\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-5.08\" y=\"-2.54\" size=\"1.778\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n</package>\n<package name=\"C275-134X316\">\n<description>&lt;b&gt;CAPACITOR&lt;/b&gt;&lt;p&gt;\ngrid 27.5 mm, outline 13.4 x 31.6 mm</description>\n<wire x1=\"-15.24\" y1=\"6.604\" x2=\"15.24\" y2=\"6.604\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"15.748\" y1=\"6.096\" x2=\"15.748\" y2=\"-6.096\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"15.24\" y1=\"-6.604\" x2=\"-15.24\" y2=\"-6.604\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-15.748\" y1=\"-6.096\" x2=\"-15.748\" y2=\"6.096\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-6.731\" y1=\"1.905\" x2=\"-6.731\" y2=\"0\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-6.731\" y1=\"0\" x2=\"-6.731\" y2=\"-1.905\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-7.62\" y1=\"1.905\" x2=\"-7.62\" y2=\"0\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-7.62\" y1=\"0\" x2=\"-7.62\" y2=\"-1.905\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"15.24\" y1=\"6.604\" x2=\"15.748\" y2=\"6.096\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"15.24\" y1=\"-6.604\" x2=\"15.748\" y2=\"-6.096\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"-15.748\" y1=\"-6.096\" x2=\"-15.24\" y2=\"-6.604\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"-15.748\" y1=\"6.096\" x2=\"-15.24\" y2=\"6.604\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"-11.557\" y1=\"0\" x2=\"-7.62\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-6.731\" y1=\"0\" x2=\"11.557\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<pad name=\"1\" x=\"-13.716\" y=\"0\" drill=\"1.1938\" shape=\"octagon\"/>\n<pad name=\"2\" x=\"13.716\" y=\"0\" drill=\"1.1938\" shape=\"octagon\"/>\n<text x=\"-15.24\" y=\"6.985\" size=\"1.778\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-5.08\" y=\"-2.54\" size=\"1.778\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n</package>\n<package name=\"C275-205X316\">\n<description>&lt;b&gt;CAPACITOR&lt;/b&gt;&lt;p&gt;\ngrid 27.5 mm, outline 20.5 x 31.6 mm</description>\n<wire x1=\"-15.24\" y1=\"10.16\" x2=\"15.24\" y2=\"10.16\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"15.748\" y1=\"9.652\" x2=\"15.748\" y2=\"-9.652\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"15.24\" y1=\"-10.16\" x2=\"-15.24\" y2=\"-10.16\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-15.748\" y1=\"-9.652\" x2=\"-15.748\" y2=\"9.652\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-6.731\" y1=\"1.905\" x2=\"-6.731\" y2=\"0\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-6.731\" y1=\"0\" x2=\"-6.731\" y2=\"-1.905\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-7.62\" y1=\"1.905\" x2=\"-7.62\" y2=\"0\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-7.62\" y1=\"0\" x2=\"-7.62\" y2=\"-1.905\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"15.24\" y1=\"10.16\" x2=\"15.748\" y2=\"9.652\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"15.24\" y1=\"-10.16\" x2=\"15.748\" y2=\"-9.652\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"-15.748\" y1=\"-9.652\" x2=\"-15.24\" y2=\"-10.16\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"-15.748\" y1=\"9.652\" x2=\"-15.24\" y2=\"10.16\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"-11.557\" y1=\"0\" x2=\"-7.62\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-6.731\" y1=\"0\" x2=\"11.557\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<pad name=\"1\" x=\"-13.716\" y=\"0\" drill=\"1.1938\" shape=\"octagon\"/>\n<pad name=\"2\" x=\"13.716\" y=\"0\" drill=\"1.1938\" shape=\"octagon\"/>\n<text x=\"-15.24\" y=\"10.541\" size=\"1.778\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-5.08\" y=\"-4.318\" size=\"1.778\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n</package>\n<package name=\"C325-137X374\">\n<description>&lt;b&gt;CAPACITOR&lt;/b&gt;&lt;p&gt;\ngrid 32.5 mm, outline 13.7 x 37.4 mm</description>\n<wire x1=\"-14.2748\" y1=\"0\" x2=\"-12.7\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-12.7\" y1=\"1.905\" x2=\"-12.7\" y2=\"0\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-11.811\" y1=\"1.905\" x2=\"-11.811\" y2=\"0\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-11.811\" y1=\"0\" x2=\"14.2748\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-11.811\" y1=\"0\" x2=\"-11.811\" y2=\"-1.905\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-12.7\" y1=\"0\" x2=\"-12.7\" y2=\"-1.905\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"18.542\" y1=\"6.731\" x2=\"18.542\" y2=\"-6.731\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-18.542\" y1=\"6.731\" x2=\"-18.542\" y2=\"-6.731\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-18.542\" y1=\"-6.731\" x2=\"18.542\" y2=\"-6.731\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"18.542\" y1=\"6.731\" x2=\"-18.542\" y2=\"6.731\" width=\"0.1524\" layer=\"21\"/>\n<pad name=\"1\" x=\"-16.256\" y=\"0\" drill=\"1.1938\" shape=\"octagon\"/>\n<pad name=\"2\" x=\"16.256\" y=\"0\" drill=\"1.1938\" shape=\"octagon\"/>\n<text x=\"-18.2372\" y=\"7.0612\" size=\"1.778\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-10.8458\" y=\"-2.8702\" size=\"1.778\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n</package>\n<package name=\"C325-162X374\">\n<description>&lt;b&gt;CAPACITOR&lt;/b&gt;&lt;p&gt;\ngrid 32.5 mm, outline 16.2 x 37.4 mm</description>\n<wire x1=\"-14.2748\" y1=\"0\" x2=\"-12.7\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-12.7\" y1=\"1.905\" x2=\"-12.7\" y2=\"0\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-11.811\" y1=\"1.905\" x2=\"-11.811\" y2=\"0\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-11.811\" y1=\"0\" x2=\"14.2748\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-11.811\" y1=\"0\" x2=\"-11.811\" y2=\"-1.905\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-12.7\" y1=\"0\" x2=\"-12.7\" y2=\"-1.905\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"18.542\" y1=\"8.001\" x2=\"18.542\" y2=\"-8.001\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-18.542\" y1=\"8.001\" x2=\"-18.542\" y2=\"-8.001\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-18.542\" y1=\"-8.001\" x2=\"18.542\" y2=\"-8.001\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"18.542\" y1=\"8.001\" x2=\"-18.542\" y2=\"8.001\" width=\"0.1524\" layer=\"21\"/>\n<pad name=\"1\" x=\"-16.256\" y=\"0\" drill=\"1.1938\" shape=\"octagon\"/>\n<pad name=\"2\" x=\"16.256\" y=\"0\" drill=\"1.1938\" shape=\"octagon\"/>\n<text x=\"-18.3642\" y=\"8.3312\" size=\"1.778\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-10.8458\" y=\"-2.8702\" size=\"1.778\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n</package>\n<package name=\"C325-182X374\">\n<description>&lt;b&gt;CAPACITOR&lt;/b&gt;&lt;p&gt;\ngrid 32.5 mm, outline 18.2 x 37.4 mm</description>\n<wire x1=\"-14.2748\" y1=\"0\" x2=\"-12.7\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-12.7\" y1=\"1.905\" x2=\"-12.7\" y2=\"0\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-11.811\" y1=\"1.905\" x2=\"-11.811\" y2=\"0\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-11.811\" y1=\"0\" x2=\"14.2748\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-11.811\" y1=\"0\" x2=\"-11.811\" y2=\"-1.905\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-12.7\" y1=\"0\" x2=\"-12.7\" y2=\"-1.905\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"18.542\" y1=\"9.017\" x2=\"18.542\" y2=\"-9.017\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-18.542\" y1=\"9.017\" x2=\"-18.542\" y2=\"-9.017\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-18.542\" y1=\"-9.017\" x2=\"18.542\" y2=\"-9.017\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"18.542\" y1=\"9.017\" x2=\"-18.542\" y2=\"9.017\" width=\"0.1524\" layer=\"21\"/>\n<pad name=\"1\" x=\"-16.256\" y=\"0\" drill=\"1.1938\" shape=\"octagon\"/>\n<pad name=\"2\" x=\"16.256\" y=\"0\" drill=\"1.1938\" shape=\"octagon\"/>\n<text x=\"-18.3642\" y=\"9.3472\" size=\"1.778\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-10.8458\" y=\"-2.8702\" size=\"1.778\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n</package>\n<package name=\"C375-192X418\">\n<description>&lt;b&gt;CAPACITOR&lt;/b&gt;&lt;p&gt;\ngrid 37.5 mm, outline 19.2 x 41.8 mm</description>\n<wire x1=\"-20.32\" y1=\"8.509\" x2=\"20.32\" y2=\"8.509\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"20.828\" y1=\"8.001\" x2=\"20.828\" y2=\"-8.001\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"20.32\" y1=\"-8.509\" x2=\"-20.32\" y2=\"-8.509\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-20.828\" y1=\"-8.001\" x2=\"-20.828\" y2=\"8.001\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-6.731\" y1=\"1.905\" x2=\"-6.731\" y2=\"0\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-6.731\" y1=\"0\" x2=\"-6.731\" y2=\"-1.905\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-7.62\" y1=\"1.905\" x2=\"-7.62\" y2=\"0\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-7.62\" y1=\"0\" x2=\"-7.62\" y2=\"-1.905\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"20.32\" y1=\"8.509\" x2=\"20.828\" y2=\"8.001\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"20.32\" y1=\"-8.509\" x2=\"20.828\" y2=\"-8.001\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"-20.828\" y1=\"-8.001\" x2=\"-20.32\" y2=\"-8.509\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"-20.828\" y1=\"8.001\" x2=\"-20.32\" y2=\"8.509\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"-16.002\" y1=\"0\" x2=\"-7.62\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-6.731\" y1=\"0\" x2=\"16.002\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<pad name=\"1\" x=\"-18.796\" y=\"0\" drill=\"1.3208\" shape=\"octagon\"/>\n<pad name=\"2\" x=\"18.796\" y=\"0\" drill=\"1.3208\" shape=\"octagon\"/>\n<text x=\"-20.447\" y=\"8.89\" size=\"1.778\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-5.08\" y=\"-2.54\" size=\"1.778\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n</package>\n<package name=\"C375-203X418\">\n<description>&lt;b&gt;CAPACITOR&lt;/b&gt;&lt;p&gt;\ngrid 37.5 mm, outline 20.3 x 41.8 mm</description>\n<wire x1=\"-20.32\" y1=\"10.16\" x2=\"20.32\" y2=\"10.16\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"20.828\" y1=\"9.652\" x2=\"20.828\" y2=\"-9.652\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"20.32\" y1=\"-10.16\" x2=\"-20.32\" y2=\"-10.16\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-20.828\" y1=\"-9.652\" x2=\"-20.828\" y2=\"9.652\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-6.731\" y1=\"1.905\" x2=\"-6.731\" y2=\"0\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-6.731\" y1=\"0\" x2=\"-6.731\" y2=\"-1.905\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-7.62\" y1=\"1.905\" x2=\"-7.62\" y2=\"0\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-7.62\" y1=\"0\" x2=\"-7.62\" y2=\"-1.905\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"20.32\" y1=\"10.16\" x2=\"20.828\" y2=\"9.652\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"20.32\" y1=\"-10.16\" x2=\"20.828\" y2=\"-9.652\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"-20.828\" y1=\"-9.652\" x2=\"-20.32\" y2=\"-10.16\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"-20.828\" y1=\"9.652\" x2=\"-20.32\" y2=\"10.16\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"-16.002\" y1=\"0\" x2=\"-7.62\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-6.731\" y1=\"0\" x2=\"16.002\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<pad name=\"1\" x=\"-18.796\" y=\"0\" drill=\"1.3208\" shape=\"octagon\"/>\n<pad name=\"2\" x=\"18.796\" y=\"0\" drill=\"1.3208\" shape=\"octagon\"/>\n<text x=\"-20.32\" y=\"10.541\" size=\"1.778\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-5.08\" y=\"-2.54\" size=\"1.778\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n</package>\n<package name=\"C050-035X075\">\n<description>&lt;b&gt;CAPACITOR&lt;/b&gt;&lt;p&gt;\ngrid 5 mm, outline 3.5 x 7.5 mm</description>\n<wire x1=\"-0.3048\" y1=\"0.635\" x2=\"-0.3048\" y2=\"0\" width=\"0.3048\" layer=\"21\"/>\n<wire x1=\"-0.3048\" y1=\"0\" x2=\"-0.3048\" y2=\"-0.635\" width=\"0.3048\" layer=\"21\"/>\n<wire x1=\"-0.3048\" y1=\"0\" x2=\"-1.524\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"0.3302\" y1=\"0.635\" x2=\"0.3302\" y2=\"0\" width=\"0.3048\" layer=\"21\"/>\n<wire x1=\"0.3302\" y1=\"0\" x2=\"0.3302\" y2=\"-0.635\" width=\"0.3048\" layer=\"21\"/>\n<wire x1=\"0.3302\" y1=\"0\" x2=\"1.524\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-3.683\" y1=\"1.524\" x2=\"-3.683\" y2=\"-1.524\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-3.429\" y1=\"-1.778\" x2=\"3.429\" y2=\"-1.778\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"3.683\" y1=\"-1.524\" x2=\"3.683\" y2=\"1.524\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"3.429\" y1=\"1.778\" x2=\"-3.429\" y2=\"1.778\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"3.429\" y1=\"1.778\" x2=\"3.683\" y2=\"1.524\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"3.429\" y1=\"-1.778\" x2=\"3.683\" y2=\"-1.524\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"-3.683\" y1=\"-1.524\" x2=\"-3.429\" y2=\"-1.778\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"-3.683\" y1=\"1.524\" x2=\"-3.429\" y2=\"1.778\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<pad name=\"1\" x=\"-2.54\" y=\"0\" drill=\"0.8128\" shape=\"octagon\"/>\n<pad name=\"2\" x=\"2.54\" y=\"0\" drill=\"0.8128\" shape=\"octagon\"/>\n<text x=\"-3.556\" y=\"2.159\" size=\"1.27\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-3.556\" y=\"-3.429\" size=\"1.27\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n</package>\n<package name=\"C375-155X418\">\n<description>&lt;b&gt;CAPACITOR&lt;/b&gt;&lt;p&gt;\ngrid 37.5 mm, outline 15.5 x 41.8 mm</description>\n<wire x1=\"-20.32\" y1=\"7.62\" x2=\"20.32\" y2=\"7.62\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"20.828\" y1=\"7.112\" x2=\"20.828\" y2=\"-7.112\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"20.32\" y1=\"-7.62\" x2=\"-20.32\" y2=\"-7.62\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-20.828\" y1=\"-7.112\" x2=\"-20.828\" y2=\"7.112\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-6.731\" y1=\"1.905\" x2=\"-6.731\" y2=\"0\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-6.731\" y1=\"0\" x2=\"-6.731\" y2=\"-1.905\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-7.62\" y1=\"1.905\" x2=\"-7.62\" y2=\"0\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-7.62\" y1=\"0\" x2=\"-7.62\" y2=\"-1.905\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"20.32\" y1=\"7.62\" x2=\"20.828\" y2=\"7.112\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"20.32\" y1=\"-7.62\" x2=\"20.828\" y2=\"-7.112\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"-20.828\" y1=\"-7.112\" x2=\"-20.32\" y2=\"-7.62\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"-20.828\" y1=\"7.112\" x2=\"-20.32\" y2=\"7.62\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"-16.002\" y1=\"0\" x2=\"-7.62\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-6.731\" y1=\"0\" x2=\"16.002\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<pad name=\"1\" x=\"-18.796\" y=\"0\" drill=\"1.3208\" shape=\"octagon\"/>\n<pad name=\"2\" x=\"18.796\" y=\"0\" drill=\"1.3208\" shape=\"octagon\"/>\n<text x=\"-20.447\" y=\"8.001\" size=\"1.778\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-5.08\" y=\"-2.54\" size=\"1.778\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n</package>\n<package name=\"C075-063X106\">\n<description>&lt;b&gt;CAPACITOR&lt;/b&gt;&lt;p&gt;\ngrid 7.5 mm, outline 6.3 x 10.6 mm</description>\n<wire x1=\"4.953\" y1=\"3.048\" x2=\"-4.953\" y2=\"3.048\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-5.207\" y1=\"2.794\" x2=\"-5.207\" y2=\"-2.794\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-4.953\" y1=\"-3.048\" x2=\"4.953\" y2=\"-3.048\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"5.207\" y1=\"-2.794\" x2=\"5.207\" y2=\"2.794\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"4.953\" y1=\"3.048\" x2=\"5.207\" y2=\"2.794\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"4.953\" y1=\"-3.048\" x2=\"5.207\" y2=\"-2.794\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"-5.207\" y1=\"-2.794\" x2=\"-4.953\" y2=\"-3.048\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"-5.207\" y1=\"2.794\" x2=\"-4.953\" y2=\"3.048\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"-1.27\" y1=\"0\" x2=\"2.667\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-2.667\" y1=\"0\" x2=\"-2.159\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-2.159\" y1=\"1.27\" x2=\"-2.159\" y2=\"0\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-2.159\" y1=\"0\" x2=\"-2.159\" y2=\"-1.27\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-1.27\" y1=\"1.27\" x2=\"-1.27\" y2=\"0\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-1.27\" y1=\"0\" x2=\"-1.27\" y2=\"-1.27\" width=\"0.4064\" layer=\"21\"/>\n<pad name=\"1\" x=\"-3.81\" y=\"0\" drill=\"0.9144\" shape=\"octagon\"/>\n<pad name=\"2\" x=\"3.81\" y=\"0\" drill=\"0.9144\" shape=\"octagon\"/>\n<text x=\"-4.826\" y=\"3.429\" size=\"1.27\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-0.635\" y=\"-2.54\" size=\"1.27\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n</package>\n<package name=\"C275-154X316\">\n<description>&lt;b&gt;CAPACITOR&lt;/b&gt;&lt;p&gt;\ngrid 27.5 mm, outline 15.4 x 31.6 mm</description>\n<wire x1=\"-15.24\" y1=\"7.62\" x2=\"15.24\" y2=\"7.62\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"15.748\" y1=\"7.112\" x2=\"15.748\" y2=\"-7.112\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"15.24\" y1=\"-7.62\" x2=\"-15.24\" y2=\"-7.62\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-15.748\" y1=\"-7.112\" x2=\"-15.748\" y2=\"7.112\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-6.731\" y1=\"1.905\" x2=\"-6.731\" y2=\"0\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-6.731\" y1=\"0\" x2=\"-6.731\" y2=\"-1.905\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-7.62\" y1=\"1.905\" x2=\"-7.62\" y2=\"0\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-7.62\" y1=\"0\" x2=\"-7.62\" y2=\"-1.905\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"15.24\" y1=\"7.62\" x2=\"15.748\" y2=\"7.112\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"15.24\" y1=\"-7.62\" x2=\"15.748\" y2=\"-7.112\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"-15.748\" y1=\"-7.112\" x2=\"-15.24\" y2=\"-7.62\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"-15.748\" y1=\"7.112\" x2=\"-15.24\" y2=\"7.62\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"-11.557\" y1=\"0\" x2=\"-7.62\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-6.731\" y1=\"0\" x2=\"11.557\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<pad name=\"1\" x=\"-13.716\" y=\"0\" drill=\"1.1938\" shape=\"octagon\"/>\n<pad name=\"2\" x=\"13.716\" y=\"0\" drill=\"1.1938\" shape=\"octagon\"/>\n<text x=\"-15.24\" y=\"8.001\" size=\"1.778\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-5.08\" y=\"-2.54\" size=\"1.778\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n</package>\n<package name=\"C275-173X316\">\n<description>&lt;b&gt;CAPACITOR&lt;/b&gt;&lt;p&gt;\ngrid 27.5 mm, outline 17.3 x 31.6 mm</description>\n<wire x1=\"-15.24\" y1=\"8.509\" x2=\"15.24\" y2=\"8.509\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"15.748\" y1=\"8.001\" x2=\"15.748\" y2=\"-8.001\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"15.24\" y1=\"-8.509\" x2=\"-15.24\" y2=\"-8.509\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-15.748\" y1=\"-8.001\" x2=\"-15.748\" y2=\"8.001\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-6.731\" y1=\"1.905\" x2=\"-6.731\" y2=\"0\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-6.731\" y1=\"0\" x2=\"-6.731\" y2=\"-1.905\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-7.62\" y1=\"1.905\" x2=\"-7.62\" y2=\"0\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"-7.62\" y1=\"0\" x2=\"-7.62\" y2=\"-1.905\" width=\"0.4064\" layer=\"21\"/>\n<wire x1=\"15.24\" y1=\"8.509\" x2=\"15.748\" y2=\"8.001\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"15.24\" y1=\"-8.509\" x2=\"15.748\" y2=\"-8.001\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"-15.748\" y1=\"-8.001\" x2=\"-15.24\" y2=\"-8.509\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"-15.748\" y1=\"8.001\" x2=\"-15.24\" y2=\"8.509\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"-11.557\" y1=\"0\" x2=\"-7.62\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-6.731\" y1=\"0\" x2=\"11.557\" y2=\"0\" width=\"0.1524\" layer=\"21\"/>\n<pad name=\"1\" x=\"-13.716\" y=\"0\" drill=\"1.1938\" shape=\"octagon\"/>\n<pad name=\"2\" x=\"13.716\" y=\"0\" drill=\"1.1938\" shape=\"octagon\"/>\n<text x=\"-15.24\" y=\"8.89\" size=\"1.778\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-5.08\" y=\"-2.54\" size=\"1.778\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n</package>\n<package name=\"C0402K\">\n<description>&lt;b&gt;Ceramic Chip Capacitor KEMET 0204 reflow solder&lt;/b&gt;&lt;p&gt;\nMetric Code Size 1005</description>\n<wire x1=\"-0.425\" y1=\"0.2\" x2=\"0.425\" y2=\"0.2\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"0.425\" y1=\"-0.2\" x2=\"-0.425\" y2=\"-0.2\" width=\"0.1016\" layer=\"51\"/>\n<smd name=\"1\" x=\"-0.6\" y=\"0\" dx=\"0.925\" dy=\"0.74\" layer=\"1\"/>\n<smd name=\"2\" x=\"0.6\" y=\"0\" dx=\"0.925\" dy=\"0.74\" layer=\"1\"/>\n<text x=\"-0.5\" y=\"0.425\" size=\"1.016\" layer=\"25\">&gt;NAME</text>\n<text x=\"-0.5\" y=\"-1.45\" size=\"1.016\" layer=\"27\">&gt;VALUE</text>\n<rectangle x1=\"-0.5\" y1=\"-0.25\" x2=\"-0.225\" y2=\"0.25\" layer=\"51\"/>\n<rectangle x1=\"0.225\" y1=\"-0.25\" x2=\"0.5\" y2=\"0.25\" layer=\"51\"/>\n</package>\n<package name=\"C0603K\">\n<description>&lt;b&gt;Ceramic Chip Capacitor KEMET 0603 reflow solder&lt;/b&gt;&lt;p&gt;\nMetric Code Size 1608</description>\n<wire x1=\"-0.725\" y1=\"0.35\" x2=\"0.725\" y2=\"0.35\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"0.725\" y1=\"-0.35\" x2=\"-0.725\" y2=\"-0.35\" width=\"0.1016\" layer=\"51\"/>\n<smd name=\"1\" x=\"-0.875\" y=\"0\" dx=\"1.05\" dy=\"1.08\" layer=\"1\"/>\n<smd name=\"2\" x=\"0.875\" y=\"0\" dx=\"1.05\" dy=\"1.08\" layer=\"1\"/>\n<text x=\"-0.8\" y=\"0.65\" size=\"1.016\" layer=\"25\">&gt;NAME</text>\n<text x=\"-0.8\" y=\"-1.65\" size=\"1.016\" layer=\"27\">&gt;VALUE</text>\n<rectangle x1=\"-0.8\" y1=\"-0.4\" x2=\"-0.45\" y2=\"0.4\" layer=\"51\"/>\n<rectangle x1=\"0.45\" y1=\"-0.4\" x2=\"0.8\" y2=\"0.4\" layer=\"51\"/>\n</package>\n<package name=\"C0805K\">\n<description>&lt;b&gt;Ceramic Chip Capacitor KEMET 0805 reflow solder&lt;/b&gt;&lt;p&gt;\nMetric Code Size 2012</description>\n<wire x1=\"-0.925\" y1=\"0.6\" x2=\"0.925\" y2=\"0.6\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"0.925\" y1=\"-0.6\" x2=\"-0.925\" y2=\"-0.6\" width=\"0.1016\" layer=\"51\"/>\n<smd name=\"1\" x=\"-1\" y=\"0\" dx=\"1.3\" dy=\"1.6\" layer=\"1\"/>\n<smd name=\"2\" x=\"1\" y=\"0\" dx=\"1.3\" dy=\"1.6\" layer=\"1\"/>\n<text x=\"-1\" y=\"0.875\" size=\"1.016\" layer=\"25\">&gt;NAME</text>\n<text x=\"-1\" y=\"-1.9\" size=\"1.016\" layer=\"27\">&gt;VALUE</text>\n<rectangle x1=\"-1\" y1=\"-0.65\" x2=\"-0.5\" y2=\"0.65\" layer=\"51\"/>\n<rectangle x1=\"0.5\" y1=\"-0.65\" x2=\"1\" y2=\"0.65\" layer=\"51\"/>\n</package>\n<package name=\"C1206K\">\n<description>&lt;b&gt;Ceramic Chip Capacitor KEMET 1206 reflow solder&lt;/b&gt;&lt;p&gt;\nMetric Code Size 3216</description>\n<wire x1=\"-1.525\" y1=\"0.75\" x2=\"1.525\" y2=\"0.75\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"1.525\" y1=\"-0.75\" x2=\"-1.525\" y2=\"-0.75\" width=\"0.1016\" layer=\"51\"/>\n<smd name=\"1\" x=\"-1.5\" y=\"0\" dx=\"1.5\" dy=\"2\" layer=\"1\"/>\n<smd name=\"2\" x=\"1.5\" y=\"0\" dx=\"1.5\" dy=\"2\" layer=\"1\"/>\n<text x=\"-1.6\" y=\"1.1\" size=\"1.016\" layer=\"25\">&gt;NAME</text>\n<text x=\"-1.6\" y=\"-2.1\" size=\"1.016\" layer=\"27\">&gt;VALUE</text>\n<rectangle x1=\"-1.6\" y1=\"-0.8\" x2=\"-1.1\" y2=\"0.8\" layer=\"51\"/>\n<rectangle x1=\"1.1\" y1=\"-0.8\" x2=\"1.6\" y2=\"0.8\" layer=\"51\"/>\n</package>\n<package name=\"C1210K\">\n<description>&lt;b&gt;Ceramic Chip Capacitor KEMET 1210 reflow solder&lt;/b&gt;&lt;p&gt;\nMetric Code Size 3225</description>\n<wire x1=\"-1.525\" y1=\"1.175\" x2=\"1.525\" y2=\"1.175\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"1.525\" y1=\"-1.175\" x2=\"-1.525\" y2=\"-1.175\" width=\"0.1016\" layer=\"51\"/>\n<smd name=\"1\" x=\"-1.5\" y=\"0\" dx=\"1.5\" dy=\"2.9\" layer=\"1\"/>\n<smd name=\"2\" x=\"1.5\" y=\"0\" dx=\"1.5\" dy=\"2.9\" layer=\"1\"/>\n<text x=\"-1.6\" y=\"1.55\" size=\"1.016\" layer=\"25\">&gt;NAME</text>\n<text x=\"-1.6\" y=\"-2.575\" size=\"1.016\" layer=\"27\">&gt;VALUE</text>\n<rectangle x1=\"-1.6\" y1=\"-1.25\" x2=\"-1.1\" y2=\"1.25\" layer=\"51\"/>\n<rectangle x1=\"1.1\" y1=\"-1.25\" x2=\"1.6\" y2=\"1.25\" layer=\"51\"/>\n</package>\n<package name=\"C1812K\">\n<description>&lt;b&gt;Ceramic Chip Capacitor KEMET 1812 reflow solder&lt;/b&gt;&lt;p&gt;\nMetric Code Size 4532</description>\n<wire x1=\"-2.175\" y1=\"1.525\" x2=\"2.175\" y2=\"1.525\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"2.175\" y1=\"-1.525\" x2=\"-2.175\" y2=\"-1.525\" width=\"0.1016\" layer=\"51\"/>\n<smd name=\"1\" x=\"-2.05\" y=\"0\" dx=\"1.8\" dy=\"3.7\" layer=\"1\"/>\n<smd name=\"2\" x=\"2.05\" y=\"0\" dx=\"1.8\" dy=\"3.7\" layer=\"1\"/>\n<text x=\"-2.25\" y=\"1.95\" size=\"1.016\" layer=\"25\">&gt;NAME</text>\n<text x=\"-2.25\" y=\"-2.975\" size=\"1.016\" layer=\"27\">&gt;VALUE</text>\n<rectangle x1=\"-2.25\" y1=\"-1.6\" x2=\"-1.65\" y2=\"1.6\" layer=\"51\"/>\n<rectangle x1=\"1.65\" y1=\"-1.6\" x2=\"2.25\" y2=\"1.6\" layer=\"51\"/>\n</package>\n<package name=\"C1825K\">\n<description>&lt;b&gt;Ceramic Chip Capacitor KEMET 1825 reflow solder&lt;/b&gt;&lt;p&gt;\nMetric Code Size 4564</description>\n<wire x1=\"-1.525\" y1=\"3.125\" x2=\"1.525\" y2=\"3.125\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"1.525\" y1=\"-3.125\" x2=\"-1.525\" y2=\"-3.125\" width=\"0.1016\" layer=\"51\"/>\n<smd name=\"1\" x=\"-1.5\" y=\"0\" dx=\"1.8\" dy=\"6.9\" layer=\"1\"/>\n<smd name=\"2\" x=\"1.5\" y=\"0\" dx=\"1.8\" dy=\"6.9\" layer=\"1\"/>\n<text x=\"-1.6\" y=\"3.55\" size=\"1.016\" layer=\"25\">&gt;NAME</text>\n<text x=\"-1.6\" y=\"-4.625\" size=\"1.016\" layer=\"27\">&gt;VALUE</text>\n<rectangle x1=\"-1.6\" y1=\"-3.2\" x2=\"-1.1\" y2=\"3.2\" layer=\"51\"/>\n<rectangle x1=\"1.1\" y1=\"-3.2\" x2=\"1.6\" y2=\"3.2\" layer=\"51\"/>\n</package>\n<package name=\"C2220K\">\n<description>&lt;b&gt;Ceramic Chip Capacitor KEMET 2220 reflow solder&lt;/b&gt;&lt;p&gt;Metric Code Size 5650</description>\n<wire x1=\"-2.725\" y1=\"2.425\" x2=\"2.725\" y2=\"2.425\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"2.725\" y1=\"-2.425\" x2=\"-2.725\" y2=\"-2.425\" width=\"0.1016\" layer=\"51\"/>\n<smd name=\"1\" x=\"-2.55\" y=\"0\" dx=\"1.85\" dy=\"5.5\" layer=\"1\"/>\n<smd name=\"2\" x=\"2.55\" y=\"0\" dx=\"1.85\" dy=\"5.5\" layer=\"1\"/>\n<text x=\"-2.8\" y=\"2.95\" size=\"1.016\" layer=\"25\">&gt;NAME</text>\n<text x=\"-2.8\" y=\"-3.975\" size=\"1.016\" layer=\"27\">&gt;VALUE</text>\n<rectangle x1=\"-2.8\" y1=\"-2.5\" x2=\"-2.2\" y2=\"2.5\" layer=\"51\"/>\n<rectangle x1=\"2.2\" y1=\"-2.5\" x2=\"2.8\" y2=\"2.5\" layer=\"51\"/>\n</package>\n<package name=\"C2225K\">\n<description>&lt;b&gt;Ceramic Chip Capacitor KEMET 2225 reflow solder&lt;/b&gt;&lt;p&gt;Metric Code Size 5664</description>\n<wire x1=\"-2.725\" y1=\"3.075\" x2=\"2.725\" y2=\"3.075\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"2.725\" y1=\"-3.075\" x2=\"-2.725\" y2=\"-3.075\" width=\"0.1016\" layer=\"51\"/>\n<smd name=\"1\" x=\"-2.55\" y=\"0\" dx=\"1.85\" dy=\"6.8\" layer=\"1\"/>\n<smd name=\"2\" x=\"2.55\" y=\"0\" dx=\"1.85\" dy=\"6.8\" layer=\"1\"/>\n<text x=\"-2.8\" y=\"3.6\" size=\"1.016\" layer=\"25\">&gt;NAME</text>\n<text x=\"-2.8\" y=\"-4.575\" size=\"1.016\" layer=\"27\">&gt;VALUE</text>\n<rectangle x1=\"-2.8\" y1=\"-3.15\" x2=\"-2.2\" y2=\"3.15\" layer=\"51\"/>\n<rectangle x1=\"2.2\" y1=\"-3.15\" x2=\"2.8\" y2=\"3.15\" layer=\"51\"/>\n</package>\n<package name=\"HPC0201\">\n<description>&lt;b&gt; &lt;/b&gt;&lt;p&gt;\nSource: http://www.vishay.com/docs/10129/hpc0201a.pdf</description>\n<smd name=\"1\" x=\"-0.18\" y=\"0\" dx=\"0.2\" dy=\"0.35\" layer=\"1\"/>\n<smd name=\"2\" x=\"0.18\" y=\"0\" dx=\"0.2\" dy=\"0.35\" layer=\"1\"/>\n<text x=\"-0.75\" y=\"0.74\" size=\"1.27\" layer=\"25\">&gt;NAME</text>\n<text x=\"-0.785\" y=\"-1.865\" size=\"1.27\" layer=\"27\">&gt;VALUE</text>\n<rectangle x1=\"-0.305\" y1=\"-0.15\" x2=\"0.305\" y2=\"0.15\" layer=\"51\"/>\n</package>\n<package name=\"C0201\">\n<description>Source: http://www.avxcorp.com/docs/catalogs/cx5r.pdf</description>\n<smd name=\"1\" x=\"-0.25\" y=\"0\" dx=\"0.25\" dy=\"0.35\" layer=\"1\"/>\n<smd name=\"2\" x=\"0.25\" y=\"0\" dx=\"0.25\" dy=\"0.35\" layer=\"1\"/>\n<text x=\"-0.635\" y=\"0.635\" size=\"1.27\" layer=\"25\">&gt;NAME</text>\n<text x=\"-0.635\" y=\"-1.905\" size=\"1.27\" layer=\"27\">&gt;VALUE</text>\n<rectangle x1=\"-0.3\" y1=\"-0.15\" x2=\"-0.15\" y2=\"0.15\" layer=\"51\"/>\n<rectangle x1=\"0.15\" y1=\"-0.15\" x2=\"0.3\" y2=\"0.15\" layer=\"51\"/>\n<rectangle x1=\"-0.15\" y1=\"0.1\" x2=\"0.15\" y2=\"0.15\" layer=\"51\"/>\n<rectangle x1=\"-0.15\" y1=\"-0.15\" x2=\"0.15\" y2=\"-0.1\" layer=\"51\"/>\n</package>\n<package name=\"C1808\">\n<description>&lt;b&gt;CAPACITOR&lt;/b&gt;&lt;p&gt;\nSource: AVX .. aphvc.pdf</description>\n<wire x1=\"-1.4732\" y1=\"0.9502\" x2=\"1.4732\" y2=\"0.9502\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"-1.4478\" y1=\"-0.9502\" x2=\"1.4732\" y2=\"-0.9502\" width=\"0.1016\" layer=\"51\"/>\n<smd name=\"1\" x=\"-1.95\" y=\"0\" dx=\"1.6\" dy=\"2.2\" layer=\"1\"/>\n<smd name=\"2\" x=\"1.95\" y=\"0\" dx=\"1.6\" dy=\"2.2\" layer=\"1\"/>\n<text x=\"-2.233\" y=\"1.827\" size=\"1.27\" layer=\"25\">&gt;NAME</text>\n<text x=\"-2.233\" y=\"-2.842\" size=\"1.27\" layer=\"27\">&gt;VALUE</text>\n<rectangle x1=\"-2.275\" y1=\"-1.015\" x2=\"-1.225\" y2=\"1.015\" layer=\"51\"/>\n<rectangle x1=\"1.225\" y1=\"-1.015\" x2=\"2.275\" y2=\"1.015\" layer=\"51\"/>\n</package>\n<package name=\"C3640\">\n<description>&lt;b&gt;CAPACITOR&lt;/b&gt;&lt;p&gt;\nSource: AVX .. aphvc.pdf</description>\n<wire x1=\"-3.8322\" y1=\"5.0496\" x2=\"3.8322\" y2=\"5.0496\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"-3.8322\" y1=\"-5.0496\" x2=\"3.8322\" y2=\"-5.0496\" width=\"0.1016\" layer=\"51\"/>\n<smd name=\"1\" x=\"-4.267\" y=\"0\" dx=\"2.6\" dy=\"10.7\" layer=\"1\"/>\n<smd name=\"2\" x=\"4.267\" y=\"0\" dx=\"2.6\" dy=\"10.7\" layer=\"1\"/>\n<text x=\"-4.647\" y=\"6.465\" size=\"1.27\" layer=\"25\">&gt;NAME</text>\n<text x=\"-4.647\" y=\"-7.255\" size=\"1.27\" layer=\"27\">&gt;VALUE</text>\n<rectangle x1=\"-4.57\" y1=\"-5.1\" x2=\"-3.05\" y2=\"5.1\" layer=\"51\"/>\n<rectangle x1=\"3.05\" y1=\"-5.1\" x2=\"4.5688\" y2=\"5.1\" layer=\"51\"/>\n</package>\n<package name=\"C01005\">\n<description>&lt;b&gt;CAPACITOR&lt;/b&gt;</description>\n<rectangle x1=\"-0.1999\" y1=\"-0.3\" x2=\"0.1999\" y2=\"0.3\" layer=\"35\"/>\n<smd name=\"1\" x=\"-0.1625\" y=\"0\" dx=\"0.2\" dy=\"0.25\" layer=\"1\"/>\n<smd name=\"2\" x=\"0.1625\" y=\"0\" dx=\"0.2\" dy=\"0.25\" layer=\"1\"/>\n<text x=\"-0.4\" y=\"0.3\" size=\"1.27\" layer=\"25\">&gt;NAME</text>\n<text x=\"-0.4\" y=\"-1.6\" size=\"1.27\" layer=\"27\">&gt;VALUE</text>\n<rectangle x1=\"-0.2\" y1=\"-0.1\" x2=\"-0.075\" y2=\"0.1\" layer=\"51\"/>\n<rectangle x1=\"0.075\" y1=\"-0.1\" x2=\"0.2\" y2=\"0.1\" layer=\"51\"/>\n<rectangle x1=\"-0.15\" y1=\"0.05\" x2=\"0.15\" y2=\"0.1\" layer=\"51\"/>\n<rectangle x1=\"-0.15\" y1=\"-0.1\" x2=\"0.15\" y2=\"-0.05\" layer=\"51\"/>\n</package>\n</packages>\n<symbols>\n<symbol name=\"R-EU\">\n<wire x1=\"-2.54\" y1=\"-0.889\" x2=\"2.54\" y2=\"-0.889\" width=\"0.254\" layer=\"94\"/>\n<wire x1=\"2.54\" y1=\"0.889\" x2=\"-2.54\" y2=\"0.889\" width=\"0.254\" layer=\"94\"/>\n<wire x1=\"2.54\" y1=\"-0.889\" x2=\"2.54\" y2=\"0.889\" width=\"0.254\" layer=\"94\"/>\n<wire x1=\"-2.54\" y1=\"-0.889\" x2=\"-2.54\" y2=\"0.889\" width=\"0.254\" layer=\"94\"/>\n<text x=\"-3.81\" y=\"1.4986\" size=\"1.778\" layer=\"95\">&gt;NAME</text>\n<text x=\"-3.81\" y=\"-3.302\" size=\"1.778\" layer=\"96\">&gt;VALUE</text>\n<pin name=\"2\" x=\"5.08\" y=\"0\" visible=\"off\" length=\"short\" direction=\"pas\" swaplevel=\"1\" rot=\"R180\"/>\n<pin name=\"1\" x=\"-5.08\" y=\"0\" visible=\"off\" length=\"short\" direction=\"pas\" swaplevel=\"1\"/>\n</symbol>\n<symbol name=\"C-EU\">\n<wire x1=\"0\" y1=\"0\" x2=\"0\" y2=\"-0.508\" width=\"0.1524\" layer=\"94\"/>\n<wire x1=\"0\" y1=\"-2.54\" x2=\"0\" y2=\"-2.032\" width=\"0.1524\" layer=\"94\"/>\n<text x=\"1.524\" y=\"0.381\" size=\"1.778\" layer=\"95\">&gt;NAME</text>\n<text x=\"1.524\" y=\"-4.699\" size=\"1.778\" layer=\"96\">&gt;VALUE</text>\n<rectangle x1=\"-2.032\" y1=\"-2.032\" x2=\"2.032\" y2=\"-1.524\" layer=\"94\"/>\n<rectangle x1=\"-2.032\" y1=\"-1.016\" x2=\"2.032\" y2=\"-0.508\" layer=\"94\"/>\n<pin name=\"1\" x=\"0\" y=\"2.54\" visible=\"off\" length=\"short\" direction=\"pas\" swaplevel=\"1\" rot=\"R270\"/>\n<pin name=\"2\" x=\"0\" y=\"-5.08\" visible=\"off\" length=\"short\" direction=\"pas\" swaplevel=\"1\" rot=\"R90\"/>\n</symbol>\n</symbols>\n<devicesets>\n<deviceset name=\"R-EU_\" prefix=\"R\" uservalue=\"yes\">\n<description>&lt;B&gt;RESISTOR&lt;/B&gt;, European symbol</description>\n<gates>\n<gate name=\"G$1\" symbol=\"R-EU\" x=\"0\" y=\"0\"/>\n</gates>\n<devices>\n<device name=\"R0402\" package=\"R0402\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"R0603\" package=\"R0603\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"R0805\" package=\"R0805\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"R0805W\" package=\"R0805W\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"R1206\" package=\"R1206\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"R1206W\" package=\"R1206W\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"R1210\" package=\"R1210\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"R1210W\" package=\"R1210W\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"R2010\" package=\"R2010\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"R2010W\" package=\"R2010W\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"R2012\" package=\"R2012\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"R2012W\" package=\"R2012W\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"R2512\" package=\"R2512\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"R2512W\" package=\"R2512W\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"R3216\" package=\"R3216\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"R3216W\" package=\"R3216W\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"R3225\" package=\"R3225\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"R3225W\" package=\"R3225W\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"R5025\" package=\"R5025\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"R5025W\" package=\"R5025W\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"R6332\" package=\"R6332\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"R6332W\" package=\"R6332W\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"M0805\" package=\"M0805\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"M1206\" package=\"M1206\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"M1406\" package=\"M1406\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"M2012\" package=\"M2012\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"M2309\" package=\"M2309\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"M3216\" package=\"M3216\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"M3516\" package=\"M3516\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"M5923\" package=\"M5923\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"0204/5\" package=\"0204/5\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"0204/7\" package=\"0204/7\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"0204/2V\" package=\"0204V\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"0207/10\" package=\"0207/10\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"0207/12\" package=\"0207/12\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"0207/15\" package=\"0207/15\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"0207/2V\" package=\"0207/2V\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"0207/5V\" package=\"0207/5V\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"0207/7\" package=\"0207/7\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"0309/10\" package=\"0309/10\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"0309/12\" package=\"0309/12\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"0309/V\" package=\"0309V\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"0411/12\" package=\"0411/12\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"0411/15\" package=\"0411/15\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"0411/3V\" package=\"0411V\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"0414/15\" package=\"0414/15\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"0414/5V\" package=\"0414V\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"0617/17\" package=\"0617/17\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"0617/22\" package=\"0617/22\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"0617/5V\" package=\"0617V\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"0922/22\" package=\"0922/22\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"0613/5V\" package=\"P0613V\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"0613/15\" package=\"P0613/15\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"0817/22\" package=\"P0817/22\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"0817/7V\" package=\"P0817V\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"V234/12\" package=\"V234/12\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"V235/17\" package=\"V235/17\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"V526-0\" package=\"V526-0\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"MELF0102R\" package=\"MINI_MELF-0102R\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"MELF0102W\" package=\"MINI_MELF-0102W\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"MELF0204R\" package=\"MINI_MELF-0204R\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"MELF0204W\" package=\"MINI_MELF-0204W\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"MELF0207R\" package=\"MINI_MELF-0207R\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"MELF0207W\" package=\"MINI_MELF-0207W\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"0922V\" package=\"0922V\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"RDH/15\" package=\"RDH/15\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"MELF0102AX\" package=\"MINI_MELF-0102AX\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"R0201\" package=\"R0201\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"VTA52\" package=\"VTA52\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"VTA53\" package=\"VTA53\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"VTA54\" package=\"VTA54\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"VTA55\" package=\"VTA55\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"VTA56\" package=\"VTA56\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"VMTA55\" package=\"VMTA55\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"VMTB60\" package=\"VMTB60\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"R4527\" package=\"R4527\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"WSC0001\" package=\"WSC0001\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"WSC0002\" package=\"WSC0002\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"WSC01/2\" package=\"WSC01/2\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"WSC2515\" package=\"WSC2515\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"WSC4527\" package=\"WSC4527\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"WSC6927\" package=\"WSC6927\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"R1218\" package=\"R1218\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"1812X7R\" package=\"1812X7R\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"PRL1632\" package=\"PRL1632\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"01005\" package=\"R01005\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n</devices>\n</deviceset>\n<deviceset name=\"C-EU\" prefix=\"C\" uservalue=\"yes\">\n<description>&lt;B&gt;CAPACITOR&lt;/B&gt;, European symbol</description>\n<gates>\n<gate name=\"G$1\" symbol=\"C-EU\" x=\"0\" y=\"0\"/>\n</gates>\n<devices>\n<device name=\"C0402\" package=\"C0402\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"C0504\" package=\"C0504\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"C0603\" package=\"C0603\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"C0805\" package=\"C0805\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"C1206\" package=\"C1206\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"C1210\" package=\"C1210\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"C1310\" package=\"C1310\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"C1608\" package=\"C1608\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"C1812\" package=\"C1812\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"C1825\" package=\"C1825\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"C2012\" package=\"C2012\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"C3216\" package=\"C3216\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"C3225\" package=\"C3225\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"C4532\" package=\"C4532\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"C4564\" package=\"C4564\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"025-024X044\" package=\"C025-024X044\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"025-025X050\" package=\"C025-025X050\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"025-030X050\" package=\"C025-030X050\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"025-040X050\" package=\"C025-040X050\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"025-050X050\" package=\"C025-050X050\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"025-060X050\" package=\"C025-060X050\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"C025_050-024X070\" package=\"C025_050-024X070\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"025_050-025X075\" package=\"C025_050-025X075\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"025_050-035X075\" package=\"C025_050-035X075\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"025_050-045X075\" package=\"C025_050-045X075\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"025_050-055X075\" package=\"C025_050-055X075\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"050-024X044\" package=\"C050-024X044\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"050-025X075\" package=\"C050-025X075\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"050-045X075\" package=\"C050-045X075\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"050-030X075\" package=\"C050-030X075\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"050-050X075\" package=\"C050-050X075\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"050-055X075\" package=\"C050-055X075\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"050-075X075\" package=\"C050-075X075\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"050H075X075\" package=\"C050H075X075\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"075-032X103\" package=\"C075-032X103\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"075-042X103\" package=\"C075-042X103\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"075-052X106\" package=\"C075-052X106\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"102-043X133\" package=\"C102-043X133\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"102-054X133\" package=\"C102-054X133\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"102-064X133\" package=\"C102-064X133\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"102_152-062X184\" package=\"C102_152-062X184\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"150-054X183\" package=\"C150-054X183\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"150-064X183\" package=\"C150-064X183\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"150-072X183\" package=\"C150-072X183\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"150-084X183\" package=\"C150-084X183\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"150-091X182\" package=\"C150-091X182\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"225-062X268\" package=\"C225-062X268\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"225-074X268\" package=\"C225-074X268\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"225-087X268\" package=\"C225-087X268\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"225-108X268\" package=\"C225-108X268\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"225-113X268\" package=\"C225-113X268\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"275-093X316\" package=\"C275-093X316\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"275-113X316\" package=\"C275-113X316\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"275-134X316\" package=\"C275-134X316\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"275-205X316\" package=\"C275-205X316\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"325-137X374\" package=\"C325-137X374\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"325-162X374\" package=\"C325-162X374\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"325-182X374\" package=\"C325-182X374\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"375-192X418\" package=\"C375-192X418\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"375-203X418\" package=\"C375-203X418\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"050-035X075\" package=\"C050-035X075\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"375-155X418\" package=\"C375-155X418\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"075-063X106\" package=\"C075-063X106\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"275-154X316\" package=\"C275-154X316\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"275-173X316\" package=\"C275-173X316\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"C0402K\" package=\"C0402K\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"C0603K\" package=\"C0603K\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"C0805K\" package=\"C0805K\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"C1206K\" package=\"C1206K\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"C1210K\" package=\"C1210K\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"C1812K\" package=\"C1812K\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"C1825K\" package=\"C1825K\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"C2220K\" package=\"C2220K\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"C2225K\" package=\"C2225K\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"HPC0201\" package=\"HPC0201\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"C0201\" package=\"C0201\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"C1808\" package=\"C1808\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"C3640\" package=\"C3640\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"01005\" package=\"C01005\">\n<connects>\n<connect gate=\"G$1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"G$1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n</devices>\n</deviceset>\n</devicesets>\n</library>\n<library name=\"linear\">\n<description>&lt;b&gt;Linear Devices&lt;/b&gt;&lt;p&gt;\nOperational amplifiers,  comparators, voltage regulators, ADCs, DACs, etc.&lt;p&gt;\n&lt;author&gt;Created by librarian@cadsoft.de&lt;/author&gt;</description>\n<packages>\n<package name=\"DIL08\">\n<description>&lt;b&gt;Dual In Line Package&lt;/b&gt;</description>\n<wire x1=\"5.08\" y1=\"2.921\" x2=\"-5.08\" y2=\"2.921\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-5.08\" y1=\"-2.921\" x2=\"5.08\" y2=\"-2.921\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"5.08\" y1=\"2.921\" x2=\"5.08\" y2=\"-2.921\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-5.08\" y1=\"2.921\" x2=\"-5.08\" y2=\"1.016\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-5.08\" y1=\"-2.921\" x2=\"-5.08\" y2=\"-1.016\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-5.08\" y1=\"1.016\" x2=\"-5.08\" y2=\"-1.016\" width=\"0.1524\" layer=\"21\" curve=\"-180\"/>\n<pad name=\"1\" x=\"-3.81\" y=\"-3.81\" drill=\"0.8128\" diameter=\"1.27\" rot=\"R90\"/>\n<pad name=\"2\" x=\"-1.27\" y=\"-3.81\" drill=\"0.8128\" diameter=\"1.27\" rot=\"R90\"/>\n<pad name=\"7\" x=\"-1.27\" y=\"3.81\" drill=\"0.8128\" diameter=\"1.27\" rot=\"R90\"/>\n<pad name=\"8\" x=\"-3.81\" y=\"3.81\" drill=\"0.8128\" diameter=\"1.27\" rot=\"R90\"/>\n<pad name=\"3\" x=\"1.27\" y=\"-3.81\" drill=\"0.8128\" diameter=\"1.27\" rot=\"R90\"/>\n<pad name=\"4\" x=\"3.81\" y=\"-3.81\" drill=\"0.8128\" diameter=\"1.27\" rot=\"R90\"/>\n<pad name=\"6\" x=\"1.27\" y=\"3.81\" drill=\"0.8128\" diameter=\"1.27\" rot=\"R90\"/>\n<pad name=\"5\" x=\"3.81\" y=\"3.81\" drill=\"0.8128\" diameter=\"1.27\" rot=\"R90\"/>\n<text x=\"-5.334\" y=\"-2.921\" size=\"1.27\" layer=\"25\" ratio=\"10\" rot=\"R90\">&gt;NAME</text>\n<text x=\"-3.556\" y=\"-0.635\" size=\"1.27\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n</package>\n<package name=\"SO08\">\n<description>&lt;b&gt;Small Outline Package 8&lt;/b&gt;&lt;br&gt;\nNS Package M08A</description>\n<wire x1=\"2.4\" y1=\"1.9\" x2=\"2.4\" y2=\"-1.4\" width=\"0.2032\" layer=\"51\"/>\n<wire x1=\"2.4\" y1=\"-1.4\" x2=\"2.4\" y2=\"-1.9\" width=\"0.2032\" layer=\"51\"/>\n<wire x1=\"2.4\" y1=\"-1.9\" x2=\"-2.4\" y2=\"-1.9\" width=\"0.2032\" layer=\"51\"/>\n<wire x1=\"-2.4\" y1=\"-1.9\" x2=\"-2.4\" y2=\"-1.4\" width=\"0.2032\" layer=\"51\"/>\n<wire x1=\"-2.4\" y1=\"-1.4\" x2=\"-2.4\" y2=\"1.9\" width=\"0.2032\" layer=\"51\"/>\n<wire x1=\"-2.4\" y1=\"1.9\" x2=\"2.4\" y2=\"1.9\" width=\"0.2032\" layer=\"51\"/>\n<wire x1=\"2.4\" y1=\"-1.4\" x2=\"-2.4\" y2=\"-1.4\" width=\"0.2032\" layer=\"51\"/>\n<smd name=\"2\" x=\"-0.635\" y=\"-2.6\" dx=\"0.6\" dy=\"2.2\" layer=\"1\"/>\n<smd name=\"7\" x=\"-0.635\" y=\"2.6\" dx=\"0.6\" dy=\"2.2\" layer=\"1\"/>\n<smd name=\"1\" x=\"-1.905\" y=\"-2.6\" dx=\"0.6\" dy=\"2.2\" layer=\"1\"/>\n<smd name=\"3\" x=\"0.635\" y=\"-2.6\" dx=\"0.6\" dy=\"2.2\" layer=\"1\"/>\n<smd name=\"4\" x=\"1.905\" y=\"-2.6\" dx=\"0.6\" dy=\"2.2\" layer=\"1\"/>\n<smd name=\"8\" x=\"-1.905\" y=\"2.6\" dx=\"0.6\" dy=\"2.2\" layer=\"1\"/>\n<smd name=\"6\" x=\"0.635\" y=\"2.6\" dx=\"0.6\" dy=\"2.2\" layer=\"1\"/>\n<smd name=\"5\" x=\"1.905\" y=\"2.6\" dx=\"0.6\" dy=\"2.2\" layer=\"1\"/>\n<text x=\"-2.667\" y=\"-1.905\" size=\"1.27\" layer=\"25\" rot=\"R90\">&gt;NAME</text>\n<text x=\"3.937\" y=\"-1.905\" size=\"1.27\" layer=\"27\" rot=\"R90\">&gt;VALUE</text>\n<rectangle x1=\"-2.15\" y1=\"-3.1\" x2=\"-1.66\" y2=\"-2\" layer=\"51\"/>\n<rectangle x1=\"-0.88\" y1=\"-3.1\" x2=\"-0.39\" y2=\"-2\" layer=\"51\"/>\n<rectangle x1=\"0.39\" y1=\"-3.1\" x2=\"0.88\" y2=\"-2\" layer=\"51\"/>\n<rectangle x1=\"1.66\" y1=\"-3.1\" x2=\"2.15\" y2=\"-2\" layer=\"51\"/>\n<rectangle x1=\"1.66\" y1=\"2\" x2=\"2.15\" y2=\"3.1\" layer=\"51\"/>\n<rectangle x1=\"0.39\" y1=\"2\" x2=\"0.88\" y2=\"3.1\" layer=\"51\"/>\n<rectangle x1=\"-0.88\" y1=\"2\" x2=\"-0.39\" y2=\"3.1\" layer=\"51\"/>\n<rectangle x1=\"-2.15\" y1=\"2\" x2=\"-1.66\" y2=\"3.1\" layer=\"51\"/>\n</package>\n</packages>\n<symbols>\n<symbol name=\"OPAMP\">\n<wire x1=\"-5.08\" y1=\"5.08\" x2=\"-5.08\" y2=\"-5.08\" width=\"0.4064\" layer=\"94\"/>\n<wire x1=\"-5.08\" y1=\"-5.08\" x2=\"5.08\" y2=\"0\" width=\"0.4064\" layer=\"94\"/>\n<wire x1=\"5.08\" y1=\"0\" x2=\"-5.08\" y2=\"5.08\" width=\"0.4064\" layer=\"94\"/>\n<wire x1=\"-3.81\" y1=\"3.175\" x2=\"-3.81\" y2=\"1.905\" width=\"0.1524\" layer=\"94\"/>\n<wire x1=\"-4.445\" y1=\"2.54\" x2=\"-3.175\" y2=\"2.54\" width=\"0.1524\" layer=\"94\"/>\n<wire x1=\"-4.445\" y1=\"-2.54\" x2=\"-3.175\" y2=\"-2.54\" width=\"0.1524\" layer=\"94\"/>\n<text x=\"2.54\" y=\"3.175\" size=\"1.778\" layer=\"95\">&gt;NAME</text>\n<text x=\"2.54\" y=\"-5.08\" size=\"1.778\" layer=\"96\">&gt;VALUE</text>\n<pin name=\"-IN\" x=\"-7.62\" y=\"-2.54\" visible=\"pad\" length=\"short\" direction=\"in\"/>\n<pin name=\"+IN\" x=\"-7.62\" y=\"2.54\" visible=\"pad\" length=\"short\" direction=\"in\"/>\n<pin name=\"OUT\" x=\"7.62\" y=\"0\" visible=\"pad\" length=\"short\" direction=\"out\" rot=\"R180\"/>\n</symbol>\n<symbol name=\"PWR+-\">\n<text x=\"1.27\" y=\"3.175\" size=\"0.8128\" layer=\"93\" rot=\"R90\">V+</text>\n<text x=\"1.27\" y=\"-4.445\" size=\"0.8128\" layer=\"93\" rot=\"R90\">V-</text>\n<pin name=\"V+\" x=\"0\" y=\"7.62\" visible=\"pad\" length=\"middle\" direction=\"pwr\" rot=\"R270\"/>\n<pin name=\"V-\" x=\"0\" y=\"-7.62\" visible=\"pad\" length=\"middle\" direction=\"pwr\" rot=\"R90\"/>\n</symbol>\n</symbols>\n<devicesets>\n<deviceset name=\"LM358\" prefix=\"IC\">\n<description>&lt;b&gt;OP AMP&lt;/b&gt; also LM158; LM258; LM2904&lt;p&gt;\nSource: http://cache.national.com/ds/LM/LM158.pdf</description>\n<gates>\n<gate name=\"A\" symbol=\"OPAMP\" x=\"15.24\" y=\"10.16\" swaplevel=\"1\"/>\n<gate name=\"B\" symbol=\"OPAMP\" x=\"15.24\" y=\"-12.7\" swaplevel=\"1\"/>\n<gate name=\"P\" symbol=\"PWR+-\" x=\"15.24\" y=\"10.16\" addlevel=\"request\"/>\n</gates>\n<devices>\n<device name=\"N\" package=\"DIL08\">\n<connects>\n<connect gate=\"A\" pin=\"+IN\" pad=\"3\"/>\n<connect gate=\"A\" pin=\"-IN\" pad=\"2\"/>\n<connect gate=\"A\" pin=\"OUT\" pad=\"1\"/>\n<connect gate=\"B\" pin=\"+IN\" pad=\"5\"/>\n<connect gate=\"B\" pin=\"-IN\" pad=\"6\"/>\n<connect gate=\"B\" pin=\"OUT\" pad=\"7\"/>\n<connect gate=\"P\" pin=\"V+\" pad=\"8\"/>\n<connect gate=\"P\" pin=\"V-\" pad=\"4\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"D\" package=\"SO08\">\n<connects>\n<connect gate=\"A\" pin=\"+IN\" pad=\"3\"/>\n<connect gate=\"A\" pin=\"-IN\" pad=\"2\"/>\n<connect gate=\"A\" pin=\"OUT\" pad=\"1\"/>\n<connect gate=\"B\" pin=\"+IN\" pad=\"5\"/>\n<connect gate=\"B\" pin=\"-IN\" pad=\"6\"/>\n<connect gate=\"B\" pin=\"OUT\" pad=\"7\"/>\n<connect gate=\"P\" pin=\"V+\" pad=\"8\"/>\n<connect gate=\"P\" pin=\"V-\" pad=\"4\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"MX\" package=\"SO08\">\n<connects>\n<connect gate=\"A\" pin=\"+IN\" pad=\"3\"/>\n<connect gate=\"A\" pin=\"-IN\" pad=\"2\"/>\n<connect gate=\"A\" pin=\"OUT\" pad=\"1\"/>\n<connect gate=\"B\" pin=\"+IN\" pad=\"5\"/>\n<connect gate=\"B\" pin=\"-IN\" pad=\"6\"/>\n<connect gate=\"B\" pin=\"OUT\" pad=\"7\"/>\n<connect gate=\"P\" pin=\"V+\" pad=\"8\"/>\n<connect gate=\"P\" pin=\"V-\" pad=\"4\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n</devices>\n</deviceset>\n</devicesets>\n</library>\n<library name=\"led\">\n<description>&lt;b&gt;LEDs&lt;/b&gt;&lt;p&gt;\n&lt;author&gt;Created by librarian@cadsoft.de&lt;/author&gt;&lt;br&gt;\nExtended by Federico Battaglin &lt;author&gt;&amp;lt;federico.rd@fdpinternational.com&amp;gt;&lt;/author&gt; with DUOLED</description>\n<packages>\n<package name=\"1206\">\n<description>&lt;b&gt;CHICAGO MINIATURE LAMP, INC.&lt;/b&gt;&lt;p&gt;\n7022X Series SMT LEDs 1206 Package Size</description>\n<wire x1=\"1.55\" y1=\"-0.75\" x2=\"-1.55\" y2=\"-0.75\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"-1.55\" y1=\"-0.75\" x2=\"-1.55\" y2=\"0.75\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"-1.55\" y1=\"0.75\" x2=\"1.55\" y2=\"0.75\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"1.55\" y1=\"0.75\" x2=\"1.55\" y2=\"-0.75\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"-0.55\" y1=\"-0.5\" x2=\"0.55\" y2=\"-0.5\" width=\"0.1016\" layer=\"21\" curve=\"95.452622\"/>\n<wire x1=\"-0.55\" y1=\"-0.5\" x2=\"-0.55\" y2=\"0.5\" width=\"0.1016\" layer=\"51\" curve=\"-84.547378\"/>\n<wire x1=\"-0.55\" y1=\"0.5\" x2=\"0.55\" y2=\"0.5\" width=\"0.1016\" layer=\"21\" curve=\"-95.452622\"/>\n<wire x1=\"0.55\" y1=\"0.5\" x2=\"0.55\" y2=\"-0.5\" width=\"0.1016\" layer=\"51\" curve=\"-84.547378\"/>\n<smd name=\"A\" x=\"-1.422\" y=\"0\" dx=\"1.6\" dy=\"1.803\" layer=\"1\"/>\n<smd name=\"C\" x=\"1.422\" y=\"0\" dx=\"1.6\" dy=\"1.803\" layer=\"1\"/>\n<text x=\"-1.27\" y=\"1.27\" size=\"1.27\" layer=\"25\">&gt;NAME</text>\n<text x=\"-1.27\" y=\"-2.54\" size=\"1.27\" layer=\"27\">&gt;VALUE</text>\n<rectangle x1=\"-0.1\" y1=\"-0.1\" x2=\"0.1\" y2=\"0.1\" layer=\"21\"/>\n<rectangle x1=\"0.45\" y1=\"-0.7\" x2=\"0.8\" y2=\"-0.45\" layer=\"51\"/>\n<rectangle x1=\"0.8\" y1=\"-0.7\" x2=\"0.9\" y2=\"0.5\" layer=\"51\"/>\n<rectangle x1=\"0.8\" y1=\"0.55\" x2=\"0.9\" y2=\"0.7\" layer=\"51\"/>\n<rectangle x1=\"-0.9\" y1=\"-0.7\" x2=\"-0.8\" y2=\"0.5\" layer=\"51\"/>\n<rectangle x1=\"-0.9\" y1=\"0.55\" x2=\"-0.8\" y2=\"0.7\" layer=\"51\"/>\n<rectangle x1=\"0.45\" y1=\"-0.7\" x2=\"0.6\" y2=\"-0.45\" layer=\"21\"/>\n</package>\n<package name=\"LD260\">\n<description>&lt;B&gt;LED&lt;/B&gt;&lt;p&gt;\n5 mm, square, Siemens</description>\n<wire x1=\"-1.27\" y1=\"-1.27\" x2=\"0\" y2=\"-1.27\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"0\" y1=\"-1.27\" x2=\"1.27\" y2=\"-1.27\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"1.27\" y1=\"1.27\" x2=\"0\" y2=\"1.27\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"0\" y1=\"1.27\" x2=\"-1.27\" y2=\"1.27\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"1.27\" y1=\"-1.27\" x2=\"1.27\" y2=\"-0.889\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"1.27\" y1=\"1.27\" x2=\"1.27\" y2=\"0.889\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"1.27\" y1=\"0.889\" x2=\"1.27\" y2=\"0\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"1.27\" y1=\"0\" x2=\"1.27\" y2=\"-0.889\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"-1.27\" y1=\"1.27\" x2=\"-1.27\" y2=\"0.889\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-1.27\" y1=\"-1.27\" x2=\"-1.27\" y2=\"-0.889\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-1.27\" y1=\"-0.889\" x2=\"-1.27\" y2=\"0\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"-1.27\" y1=\"0\" x2=\"-1.27\" y2=\"0.889\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"0\" y1=\"1.27\" x2=\"0.9917\" y2=\"0.7934\" width=\"0.1524\" layer=\"21\" curve=\"-51.33923\"/>\n<wire x1=\"-0.9917\" y1=\"0.7934\" x2=\"0\" y2=\"1.27\" width=\"0.1524\" layer=\"21\" curve=\"-51.33923\"/>\n<wire x1=\"0\" y1=\"-1.27\" x2=\"0.9917\" y2=\"-0.7934\" width=\"0.1524\" layer=\"21\" curve=\"51.33923\"/>\n<wire x1=\"-0.9917\" y1=\"-0.7934\" x2=\"0\" y2=\"-1.27\" width=\"0.1524\" layer=\"21\" curve=\"51.33923\"/>\n<wire x1=\"0.9558\" y1=\"-0.8363\" x2=\"1.27\" y2=\"0\" width=\"0.1524\" layer=\"51\" curve=\"41.185419\"/>\n<wire x1=\"0.9756\" y1=\"0.813\" x2=\"1.2699\" y2=\"0\" width=\"0.1524\" layer=\"51\" curve=\"-39.806332\"/>\n<wire x1=\"-1.27\" y1=\"0\" x2=\"-0.9643\" y2=\"-0.8265\" width=\"0.1524\" layer=\"51\" curve=\"40.600331\"/>\n<wire x1=\"-1.27\" y1=\"0\" x2=\"-0.9643\" y2=\"0.8265\" width=\"0.1524\" layer=\"51\" curve=\"-40.600331\"/>\n<wire x1=\"-0.889\" y1=\"0\" x2=\"0\" y2=\"0.889\" width=\"0.1524\" layer=\"51\" curve=\"-90\"/>\n<wire x1=\"-0.508\" y1=\"0\" x2=\"0\" y2=\"0.508\" width=\"0.1524\" layer=\"51\" curve=\"-90\"/>\n<wire x1=\"0\" y1=\"-0.508\" x2=\"0.508\" y2=\"0\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"0\" y1=\"-0.889\" x2=\"0.889\" y2=\"0\" width=\"0.1524\" layer=\"51\" curve=\"90\"/>\n<pad name=\"A\" x=\"-1.27\" y=\"0\" drill=\"0.8128\" shape=\"octagon\"/>\n<pad name=\"K\" x=\"1.27\" y=\"0\" drill=\"0.8128\" shape=\"octagon\"/>\n<text x=\"-1.2954\" y=\"1.4732\" size=\"1.016\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-1.27\" y=\"-2.4892\" size=\"1.016\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n<rectangle x1=\"1.27\" y1=\"-0.635\" x2=\"2.032\" y2=\"0.635\" layer=\"51\"/>\n<rectangle x1=\"1.905\" y1=\"-0.635\" x2=\"2.032\" y2=\"0.635\" layer=\"21\"/>\n</package>\n<package name=\"LED2X5\">\n<description>&lt;B&gt;LED&lt;/B&gt;&lt;p&gt;\n2 x 5 mm, rectangle</description>\n<wire x1=\"-2.54\" y1=\"-1.27\" x2=\"2.54\" y2=\"-1.27\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.54\" y1=\"1.27\" x2=\"2.54\" y2=\"-1.27\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.54\" y1=\"1.27\" x2=\"-2.54\" y2=\"1.27\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-2.54\" y1=\"-1.27\" x2=\"-2.54\" y2=\"1.27\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-1.905\" y1=\"0\" x2=\"0.508\" y2=\"0\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"-0.508\" y1=\"0.381\" x2=\"-0.508\" y2=\"-0.381\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"-0.508\" y1=\"0.381\" x2=\"0.508\" y2=\"0\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"0.508\" y1=\"0\" x2=\"1.778\" y2=\"0\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"0.508\" y1=\"0\" x2=\"-0.508\" y2=\"-0.381\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"0.508\" y1=\"0.381\" x2=\"0.508\" y2=\"0\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"0.508\" y1=\"0\" x2=\"0.508\" y2=\"-0.381\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"0.889\" y1=\"-0.254\" x2=\"1.143\" y2=\"-0.762\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"1.143\" y1=\"-0.762\" x2=\"1.143\" y2=\"-0.508\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"1.143\" y1=\"-0.762\" x2=\"0.9398\" y2=\"-0.6096\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"0.9398\" y1=\"-0.6096\" x2=\"1.143\" y2=\"-0.508\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"1.397\" y1=\"-0.254\" x2=\"1.651\" y2=\"-0.762\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"1.651\" y1=\"-0.762\" x2=\"1.651\" y2=\"-0.508\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"1.651\" y1=\"-0.762\" x2=\"1.4478\" y2=\"-0.6096\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"1.4478\" y1=\"-0.6096\" x2=\"1.651\" y2=\"-0.508\" width=\"0.1524\" layer=\"51\"/>\n<pad name=\"A\" x=\"-1.27\" y=\"0\" drill=\"0.8128\" shape=\"octagon\"/>\n<pad name=\"K\" x=\"1.27\" y=\"0\" drill=\"0.8128\" shape=\"octagon\"/>\n<text x=\"-2.54\" y=\"1.397\" size=\"1.016\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-2.54\" y=\"-2.413\" size=\"1.016\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n<rectangle x1=\"2.159\" y1=\"-1.27\" x2=\"2.413\" y2=\"1.27\" layer=\"21\"/>\n</package>\n<package name=\"LED3MM\">\n<description>&lt;B&gt;LED&lt;/B&gt;&lt;p&gt;\n3 mm, round</description>\n<wire x1=\"1.5748\" y1=\"-1.27\" x2=\"1.5748\" y2=\"1.27\" width=\"0.254\" layer=\"51\"/>\n<wire x1=\"-1.524\" y1=\"0\" x2=\"-1.1708\" y2=\"0.9756\" width=\"0.1524\" layer=\"51\" curve=\"-39.80361\"/>\n<wire x1=\"-1.524\" y1=\"0\" x2=\"-1.1391\" y2=\"-1.0125\" width=\"0.1524\" layer=\"51\" curve=\"41.633208\"/>\n<wire x1=\"1.1571\" y1=\"0.9918\" x2=\"1.524\" y2=\"0\" width=\"0.1524\" layer=\"51\" curve=\"-40.601165\"/>\n<wire x1=\"1.1708\" y1=\"-0.9756\" x2=\"1.524\" y2=\"0\" width=\"0.1524\" layer=\"51\" curve=\"39.80361\"/>\n<wire x1=\"0\" y1=\"1.524\" x2=\"1.2401\" y2=\"0.8858\" width=\"0.1524\" layer=\"21\" curve=\"-54.461337\"/>\n<wire x1=\"-1.2192\" y1=\"0.9144\" x2=\"0\" y2=\"1.524\" width=\"0.1524\" layer=\"21\" curve=\"-53.130102\"/>\n<wire x1=\"0\" y1=\"-1.524\" x2=\"1.203\" y2=\"-0.9356\" width=\"0.1524\" layer=\"21\" curve=\"52.126876\"/>\n<wire x1=\"-1.203\" y1=\"-0.9356\" x2=\"0\" y2=\"-1.524\" width=\"0.1524\" layer=\"21\" curve=\"52.126876\"/>\n<wire x1=\"-0.635\" y1=\"0\" x2=\"0\" y2=\"0.635\" width=\"0.1524\" layer=\"51\" curve=\"-90\"/>\n<wire x1=\"-1.016\" y1=\"0\" x2=\"0\" y2=\"1.016\" width=\"0.1524\" layer=\"51\" curve=\"-90\"/>\n<wire x1=\"0\" y1=\"-0.635\" x2=\"0.635\" y2=\"0\" width=\"0.1524\" layer=\"51\" curve=\"90\"/>\n<wire x1=\"0\" y1=\"-1.016\" x2=\"1.016\" y2=\"0\" width=\"0.1524\" layer=\"51\" curve=\"90\"/>\n<wire x1=\"0\" y1=\"2.032\" x2=\"1.561\" y2=\"1.3009\" width=\"0.254\" layer=\"21\" curve=\"-50.193108\"/>\n<wire x1=\"-1.7929\" y1=\"0.9562\" x2=\"0\" y2=\"2.032\" width=\"0.254\" layer=\"21\" curve=\"-61.926949\"/>\n<wire x1=\"0\" y1=\"-2.032\" x2=\"1.5512\" y2=\"-1.3126\" width=\"0.254\" layer=\"21\" curve=\"49.763022\"/>\n<wire x1=\"-1.7643\" y1=\"-1.0082\" x2=\"0\" y2=\"-2.032\" width=\"0.254\" layer=\"21\" curve=\"60.255215\"/>\n<wire x1=\"-2.032\" y1=\"0\" x2=\"-1.7891\" y2=\"0.9634\" width=\"0.254\" layer=\"51\" curve=\"-28.301701\"/>\n<wire x1=\"-2.032\" y1=\"0\" x2=\"-1.7306\" y2=\"-1.065\" width=\"0.254\" layer=\"51\" curve=\"31.60822\"/>\n<pad name=\"A\" x=\"-1.27\" y=\"0\" drill=\"0.8128\" shape=\"octagon\"/>\n<pad name=\"K\" x=\"1.27\" y=\"0\" drill=\"0.8128\" shape=\"octagon\"/>\n<text x=\"1.905\" y=\"0.381\" size=\"1.27\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"1.905\" y=\"-1.651\" size=\"1.27\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n</package>\n<package name=\"LED5MM\">\n<description>&lt;B&gt;LED&lt;/B&gt;&lt;p&gt;\n5 mm, round</description>\n<wire x1=\"2.54\" y1=\"-1.905\" x2=\"2.54\" y2=\"1.905\" width=\"0.2032\" layer=\"21\"/>\n<wire x1=\"2.54\" y1=\"-1.905\" x2=\"2.54\" y2=\"1.905\" width=\"0.254\" layer=\"21\" curve=\"-286.260205\"/>\n<wire x1=\"-1.143\" y1=\"0\" x2=\"0\" y2=\"1.143\" width=\"0.1524\" layer=\"51\" curve=\"-90\"/>\n<wire x1=\"0\" y1=\"-1.143\" x2=\"1.143\" y2=\"0\" width=\"0.1524\" layer=\"51\" curve=\"90\"/>\n<wire x1=\"-1.651\" y1=\"0\" x2=\"0\" y2=\"1.651\" width=\"0.1524\" layer=\"51\" curve=\"-90\"/>\n<wire x1=\"0\" y1=\"-1.651\" x2=\"1.651\" y2=\"0\" width=\"0.1524\" layer=\"51\" curve=\"90\"/>\n<wire x1=\"-2.159\" y1=\"0\" x2=\"0\" y2=\"2.159\" width=\"0.1524\" layer=\"51\" curve=\"-90\"/>\n<wire x1=\"0\" y1=\"-2.159\" x2=\"2.159\" y2=\"0\" width=\"0.1524\" layer=\"51\" curve=\"90\"/>\n<circle x=\"0\" y=\"0\" radius=\"2.54\" width=\"0.1524\" layer=\"21\"/>\n<pad name=\"A\" x=\"-1.27\" y=\"0\" drill=\"0.8128\" shape=\"octagon\"/>\n<pad name=\"K\" x=\"1.27\" y=\"0\" drill=\"0.8128\" shape=\"octagon\"/>\n<text x=\"3.175\" y=\"0.5334\" size=\"1.27\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"3.2004\" y=\"-1.8034\" size=\"1.27\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n</package>\n<package name=\"LSU260\">\n<description>&lt;B&gt;LED&lt;/B&gt;&lt;p&gt;\n1 mm, round, Siemens</description>\n<wire x1=\"0\" y1=\"-0.508\" x2=\"-1.143\" y2=\"-0.508\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"-1.143\" y1=\"-0.508\" x2=\"-1.143\" y2=\"-0.254\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"-1.143\" y1=\"0.508\" x2=\"0\" y2=\"0.508\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"-1.143\" y1=\"-0.254\" x2=\"-1.397\" y2=\"-0.254\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"-1.143\" y1=\"-0.254\" x2=\"-1.143\" y2=\"0.254\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"-1.397\" y1=\"-0.254\" x2=\"-1.397\" y2=\"0.254\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"-1.397\" y1=\"0.254\" x2=\"-1.143\" y2=\"0.254\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"-1.143\" y1=\"0.254\" x2=\"-1.143\" y2=\"0.508\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"0.508\" y1=\"-0.254\" x2=\"1.397\" y2=\"-0.254\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"1.397\" y1=\"-0.254\" x2=\"1.397\" y2=\"0.254\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"1.397\" y1=\"0.254\" x2=\"0.508\" y2=\"0.254\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"0.381\" y1=\"-0.381\" x2=\"0.254\" y2=\"-0.508\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"0.254\" y1=\"-0.508\" x2=\"-0.254\" y2=\"-0.508\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-0.381\" y1=\"-0.381\" x2=\"-0.254\" y2=\"-0.508\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"0.381\" y1=\"0.381\" x2=\"0.254\" y2=\"0.508\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"0.254\" y1=\"0.508\" x2=\"-0.254\" y2=\"0.508\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-0.381\" y1=\"0.381\" x2=\"-0.254\" y2=\"0.508\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"0\" y1=\"-0.254\" x2=\"0.254\" y2=\"0\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"-0.254\" y1=\"0\" x2=\"0\" y2=\"0.254\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"0.381\" y1=\"-0.381\" x2=\"0.381\" y2=\"0.381\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<circle x=\"0\" y=\"0\" radius=\"0.508\" width=\"0.1524\" layer=\"51\"/>\n<pad name=\"A\" x=\"-1.27\" y=\"0\" drill=\"0.8128\" shape=\"octagon\"/>\n<pad name=\"K\" x=\"1.27\" y=\"0\" drill=\"0.8128\" shape=\"octagon\"/>\n<text x=\"-1.2954\" y=\"0.8382\" size=\"1.016\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-1.27\" y=\"-1.8542\" size=\"1.016\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n<rectangle x1=\"-1.397\" y1=\"-0.254\" x2=\"-1.143\" y2=\"0.254\" layer=\"51\"/>\n<rectangle x1=\"0.508\" y1=\"-0.254\" x2=\"1.397\" y2=\"0.254\" layer=\"51\"/>\n</package>\n<package name=\"LZR181\">\n<description>&lt;B&gt;LED BLOCK&lt;/B&gt;&lt;p&gt;\n1 LED, Siemens</description>\n<wire x1=\"-1.27\" y1=\"-1.27\" x2=\"1.27\" y2=\"-1.27\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"1.27\" y1=\"-1.27\" x2=\"1.27\" y2=\"-0.889\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"1.27\" y1=\"1.27\" x2=\"1.27\" y2=\"0.889\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"1.27\" y1=\"0.889\" x2=\"1.27\" y2=\"-0.889\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"-1.27\" y1=\"1.27\" x2=\"-1.27\" y2=\"0.889\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-1.27\" y1=\"-1.27\" x2=\"-1.27\" y2=\"-0.889\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-1.27\" y1=\"-0.889\" x2=\"-1.27\" y2=\"0.889\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"-0.889\" y1=\"0\" x2=\"0\" y2=\"0.889\" width=\"0.1524\" layer=\"51\" curve=\"-90\"/>\n<wire x1=\"-0.508\" y1=\"0\" x2=\"0\" y2=\"0.508\" width=\"0.1524\" layer=\"51\" curve=\"-90\"/>\n<wire x1=\"0\" y1=\"-0.508\" x2=\"0.508\" y2=\"0\" width=\"0.1524\" layer=\"21\" curve=\"90\"/>\n<wire x1=\"0\" y1=\"-0.889\" x2=\"0.889\" y2=\"0\" width=\"0.1524\" layer=\"51\" curve=\"90\"/>\n<wire x1=\"-0.8678\" y1=\"0.7439\" x2=\"0\" y2=\"1.143\" width=\"0.1524\" layer=\"21\" curve=\"-49.396139\"/>\n<wire x1=\"0\" y1=\"1.143\" x2=\"0.8678\" y2=\"0.7439\" width=\"0.1524\" layer=\"21\" curve=\"-49.396139\"/>\n<wire x1=\"-0.8678\" y1=\"-0.7439\" x2=\"0\" y2=\"-1.143\" width=\"0.1524\" layer=\"21\" curve=\"49.396139\"/>\n<wire x1=\"0\" y1=\"-1.143\" x2=\"0.8678\" y2=\"-0.7439\" width=\"0.1524\" layer=\"21\" curve=\"49.396139\"/>\n<wire x1=\"0.8678\" y1=\"0.7439\" x2=\"1.143\" y2=\"0\" width=\"0.1524\" layer=\"51\" curve=\"-40.604135\"/>\n<wire x1=\"0.8678\" y1=\"-0.7439\" x2=\"1.143\" y2=\"0\" width=\"0.1524\" layer=\"51\" curve=\"40.604135\"/>\n<wire x1=\"-1.143\" y1=\"0\" x2=\"-0.8678\" y2=\"0.7439\" width=\"0.1524\" layer=\"51\" curve=\"-40.604135\"/>\n<wire x1=\"-1.143\" y1=\"0\" x2=\"-0.8678\" y2=\"-0.7439\" width=\"0.1524\" layer=\"51\" curve=\"40.604135\"/>\n<wire x1=\"-1.27\" y1=\"1.27\" x2=\"1.27\" y2=\"1.27\" width=\"0.1524\" layer=\"21\"/>\n<pad name=\"A\" x=\"-1.27\" y=\"0\" drill=\"0.8128\" shape=\"octagon\"/>\n<pad name=\"K\" x=\"1.27\" y=\"0\" drill=\"0.8128\" shape=\"octagon\"/>\n<text x=\"-1.2954\" y=\"1.4732\" size=\"1.016\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-1.27\" y=\"-2.4892\" size=\"1.016\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n<rectangle x1=\"1.27\" y1=\"-0.889\" x2=\"1.524\" y2=\"0.254\" layer=\"51\"/>\n<rectangle x1=\"-1.524\" y1=\"-0.254\" x2=\"-1.27\" y2=\"0.254\" layer=\"51\"/>\n</package>\n<package name=\"Q62902-B152\">\n<description>&lt;b&gt;LED HOLDER&lt;/b&gt;&lt;p&gt;\nSiemens</description>\n<wire x1=\"-2.9718\" y1=\"-1.8542\" x2=\"-2.9718\" y2=\"-0.254\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-2.9718\" y1=\"-0.254\" x2=\"-2.9718\" y2=\"0.254\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-2.9718\" y1=\"0.254\" x2=\"-2.9718\" y2=\"1.8542\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.9718\" y1=\"-1.8542\" x2=\"-2.1082\" y2=\"-1.8542\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-2.1082\" y1=\"-1.8542\" x2=\"-2.54\" y2=\"-1.8542\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-2.54\" y1=\"1.8542\" x2=\"-2.1082\" y2=\"1.8542\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-2.1082\" y1=\"1.8542\" x2=\"2.9718\" y2=\"1.8542\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-2.54\" y1=\"-1.8542\" x2=\"-2.54\" y2=\"1.8542\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-2.54\" y1=\"-1.8542\" x2=\"-2.9718\" y2=\"-1.8542\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-2.54\" y1=\"1.8542\" x2=\"-2.9718\" y2=\"1.8542\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-2.9718\" y1=\"0.254\" x2=\"-2.9718\" y2=\"-0.254\" width=\"0.1524\" layer=\"21\" curve=\"180\"/>\n<wire x1=\"-1.1486\" y1=\"0.8814\" x2=\"0\" y2=\"1.4478\" width=\"0.1524\" layer=\"21\" curve=\"-52.498642\"/>\n<wire x1=\"0\" y1=\"1.4478\" x2=\"1.1476\" y2=\"0.8827\" width=\"0.1524\" layer=\"21\" curve=\"-52.433716\"/>\n<wire x1=\"-1.1351\" y1=\"-0.8987\" x2=\"0\" y2=\"-1.4478\" width=\"0.1524\" layer=\"21\" curve=\"51.629985\"/>\n<wire x1=\"0\" y1=\"-1.4478\" x2=\"1.1305\" y2=\"-0.9044\" width=\"0.1524\" layer=\"21\" curve=\"51.339172\"/>\n<wire x1=\"1.1281\" y1=\"-0.9074\" x2=\"1.4478\" y2=\"0\" width=\"0.1524\" layer=\"51\" curve=\"38.811177\"/>\n<wire x1=\"1.1401\" y1=\"0.8923\" x2=\"1.4478\" y2=\"0\" width=\"0.1524\" layer=\"51\" curve=\"-38.048073\"/>\n<wire x1=\"-1.4478\" y1=\"0\" x2=\"-1.1305\" y2=\"-0.9044\" width=\"0.1524\" layer=\"51\" curve=\"38.659064\"/>\n<wire x1=\"-1.4478\" y1=\"0\" x2=\"-1.1456\" y2=\"0.8853\" width=\"0.1524\" layer=\"51\" curve=\"-37.696376\"/>\n<wire x1=\"0\" y1=\"1.7018\" x2=\"1.4674\" y2=\"0.8618\" width=\"0.1524\" layer=\"21\" curve=\"-59.573488\"/>\n<wire x1=\"-1.4618\" y1=\"0.8714\" x2=\"0\" y2=\"1.7018\" width=\"0.1524\" layer=\"21\" curve=\"-59.200638\"/>\n<wire x1=\"0\" y1=\"-1.7018\" x2=\"1.4571\" y2=\"-0.8793\" width=\"0.1524\" layer=\"21\" curve=\"58.891781\"/>\n<wire x1=\"-1.4571\" y1=\"-0.8793\" x2=\"0\" y2=\"-1.7018\" width=\"0.1524\" layer=\"21\" curve=\"58.891781\"/>\n<wire x1=\"-1.7018\" y1=\"0\" x2=\"-1.4447\" y2=\"0.8995\" width=\"0.1524\" layer=\"51\" curve=\"-31.907626\"/>\n<wire x1=\"-1.7018\" y1=\"0\" x2=\"-1.4502\" y2=\"-0.8905\" width=\"0.1524\" layer=\"51\" curve=\"31.551992\"/>\n<wire x1=\"1.4521\" y1=\"0.8874\" x2=\"1.7018\" y2=\"0\" width=\"0.1524\" layer=\"51\" curve=\"-31.429586\"/>\n<wire x1=\"1.4459\" y1=\"-0.8975\" x2=\"1.7018\" y2=\"0\" width=\"0.1524\" layer=\"51\" curve=\"31.828757\"/>\n<wire x1=\"-2.1082\" y1=\"1.8542\" x2=\"-2.1082\" y2=\"-1.8542\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-0.635\" y1=\"0\" x2=\"0\" y2=\"0.635\" width=\"0.1524\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"-1.016\" y1=\"0\" x2=\"0\" y2=\"1.016\" width=\"0.1524\" layer=\"51\" curve=\"-90\"/>\n<wire x1=\"0\" y1=\"-0.635\" x2=\"0.635\" y2=\"0\" width=\"0.1524\" layer=\"51\" curve=\"90\"/>\n<wire x1=\"0.0539\" y1=\"-1.0699\" x2=\"1.0699\" y2=\"-0.0539\" width=\"0.1524\" layer=\"51\" curve=\"90\"/>\n<wire x1=\"2.9718\" y1=\"1.8542\" x2=\"2.9718\" y2=\"-1.8542\" width=\"0.1524\" layer=\"21\"/>\n<pad name=\"K\" x=\"-1.27\" y=\"0\" drill=\"0.8128\" shape=\"long\" rot=\"R90\"/>\n<pad name=\"A\" x=\"1.27\" y=\"0\" drill=\"0.8128\" shape=\"long\" rot=\"R90\"/>\n<text x=\"-1.905\" y=\"2.286\" size=\"1.27\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-1.905\" y=\"-3.556\" size=\"1.27\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n</package>\n<package name=\"Q62902-B153\">\n<description>&lt;b&gt;LED HOLDER&lt;/b&gt;&lt;p&gt;\nSiemens</description>\n<wire x1=\"-5.5118\" y1=\"-3.5052\" x2=\"-5.5118\" y2=\"-0.254\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-5.5118\" y1=\"-0.254\" x2=\"-5.5118\" y2=\"0.254\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-5.5118\" y1=\"0.254\" x2=\"-5.5118\" y2=\"3.5052\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"5.5118\" y1=\"-3.5052\" x2=\"-4.6482\" y2=\"-3.5052\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-4.6482\" y1=\"-3.5052\" x2=\"-5.08\" y2=\"-3.5052\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-5.08\" y1=\"3.5052\" x2=\"-4.6482\" y2=\"3.5052\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-4.6482\" y1=\"3.5052\" x2=\"5.5118\" y2=\"3.5052\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-5.08\" y1=\"-3.5052\" x2=\"-5.08\" y2=\"3.5052\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-5.08\" y1=\"-3.5052\" x2=\"-5.5118\" y2=\"-3.5052\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-5.08\" y1=\"3.5052\" x2=\"-5.5118\" y2=\"3.5052\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-5.5118\" y1=\"0.254\" x2=\"-5.5118\" y2=\"-0.254\" width=\"0.1524\" layer=\"21\" curve=\"180\"/>\n<wire x1=\"-4.6482\" y1=\"3.5052\" x2=\"-4.6482\" y2=\"-3.5052\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"5.5118\" y1=\"3.5052\" x2=\"5.5118\" y2=\"-3.5052\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-2.54\" y1=\"1.905\" x2=\"-2.54\" y2=\"-1.905\" width=\"0.254\" layer=\"21\"/>\n<wire x1=\"0\" y1=\"-1.143\" x2=\"1.143\" y2=\"0\" width=\"0.1524\" layer=\"51\" curve=\"90\"/>\n<wire x1=\"-1.143\" y1=\"0\" x2=\"0\" y2=\"1.143\" width=\"0.1524\" layer=\"51\" curve=\"-90\"/>\n<wire x1=\"0\" y1=\"-1.651\" x2=\"1.651\" y2=\"0\" width=\"0.1524\" layer=\"51\" curve=\"90\"/>\n<wire x1=\"-1.651\" y1=\"0\" x2=\"0\" y2=\"1.651\" width=\"0.1524\" layer=\"51\" curve=\"-90\"/>\n<wire x1=\"0\" y1=\"-2.159\" x2=\"2.159\" y2=\"0\" width=\"0.1524\" layer=\"51\" curve=\"90\"/>\n<wire x1=\"-2.2129\" y1=\"0.0539\" x2=\"-0.0539\" y2=\"2.2129\" width=\"0.1524\" layer=\"51\" curve=\"-90.010616\"/>\n<circle x=\"0\" y=\"0\" radius=\"2.54\" width=\"0.1524\" layer=\"21\"/>\n<circle x=\"0\" y=\"0\" radius=\"3.175\" width=\"0.254\" layer=\"21\"/>\n<pad name=\"A\" x=\"1.27\" y=\"0\" drill=\"0.8128\" shape=\"long\" rot=\"R90\"/>\n<pad name=\"K\" x=\"-1.27\" y=\"0\" drill=\"0.8128\" shape=\"long\" rot=\"R90\"/>\n<text x=\"-4.191\" y=\"3.937\" size=\"1.27\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-4.318\" y=\"-5.08\" size=\"1.27\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n</package>\n<package name=\"Q62902-B155\">\n<description>&lt;b&gt;LED HOLDER&lt;/b&gt;&lt;p&gt;\nSiemens</description>\n<wire x1=\"-1.27\" y1=\"-3.048\" x2=\"-1.27\" y2=\"-2.54\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"10.033\" y1=\"3.048\" x2=\"2.921\" y2=\"3.048\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"10.033\" y1=\"3.048\" x2=\"10.033\" y2=\"-3.048\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-1.27\" y1=\"-3.048\" x2=\"2.921\" y2=\"-3.048\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.921\" y1=\"-3.048\" x2=\"2.921\" y2=\"3.048\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.921\" y1=\"-3.048\" x2=\"10.033\" y2=\"-3.048\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.921\" y1=\"3.048\" x2=\"-1.27\" y2=\"3.048\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-1.27\" y1=\"2.54\" x2=\"-5.207\" y2=\"2.54\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-1.27\" y1=\"2.54\" x2=\"-1.27\" y2=\"3.048\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-5.207\" y1=\"-2.54\" x2=\"-1.27\" y2=\"-2.54\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-1.27\" y1=\"-2.54\" x2=\"-1.27\" y2=\"2.54\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-5.207\" y1=\"2.54\" x2=\"-5.207\" y2=\"-2.54\" width=\"0.1524\" layer=\"21\" curve=\"180\"/>\n<wire x1=\"-6.985\" y1=\"0.635\" x2=\"-6.985\" y2=\"-0.635\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-6.096\" y1=\"1.397\" x2=\"-6.096\" y2=\"-1.397\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-5.207\" y1=\"1.905\" x2=\"-5.207\" y2=\"-1.905\" width=\"0.1524\" layer=\"21\"/>\n<pad name=\"K\" x=\"7.62\" y=\"1.27\" drill=\"0.8128\" shape=\"long\"/>\n<pad name=\"A\" x=\"7.62\" y=\"-1.27\" drill=\"0.8128\" shape=\"long\"/>\n<text x=\"3.302\" y=\"-2.794\" size=\"1.016\" layer=\"21\" ratio=\"14\">A+</text>\n<text x=\"3.302\" y=\"1.778\" size=\"1.016\" layer=\"21\" ratio=\"14\">K-</text>\n<text x=\"11.684\" y=\"-2.794\" size=\"1.27\" layer=\"25\" ratio=\"10\" rot=\"R90\">&gt;NAME</text>\n<text x=\"0.635\" y=\"-4.445\" size=\"1.27\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n<rectangle x1=\"2.921\" y1=\"1.016\" x2=\"6.731\" y2=\"1.524\" layer=\"21\"/>\n<rectangle x1=\"2.921\" y1=\"-1.524\" x2=\"6.731\" y2=\"-1.016\" layer=\"21\"/>\n<hole x=\"0\" y=\"0\" drill=\"0.8128\"/>\n</package>\n<package name=\"Q62902-B156\">\n<description>&lt;b&gt;LED HOLDER&lt;/b&gt;&lt;p&gt;\nSiemens</description>\n<wire x1=\"2.54\" y1=\"-1.905\" x2=\"2.54\" y2=\"1.905\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-1.143\" y1=\"0\" x2=\"0\" y2=\"1.143\" width=\"0.1524\" layer=\"51\" curve=\"-90\"/>\n<wire x1=\"0\" y1=\"-1.143\" x2=\"1.143\" y2=\"0\" width=\"0.1524\" layer=\"51\" curve=\"90\"/>\n<wire x1=\"-1.651\" y1=\"0\" x2=\"0\" y2=\"1.651\" width=\"0.1524\" layer=\"51\" curve=\"-90\"/>\n<wire x1=\"0\" y1=\"-1.651\" x2=\"1.651\" y2=\"0\" width=\"0.1524\" layer=\"51\" curve=\"90\"/>\n<wire x1=\"-2.159\" y1=\"0\" x2=\"0\" y2=\"2.159\" width=\"0.1524\" layer=\"51\" curve=\"-90\"/>\n<wire x1=\"0.0539\" y1=\"-2.2129\" x2=\"2.2129\" y2=\"-0.0539\" width=\"0.1524\" layer=\"51\" curve=\"90.005308\"/>\n<wire x1=\"2.54\" y1=\"3.81\" x2=\"3.81\" y2=\"2.54\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.54\" y1=\"3.81\" x2=\"-3.81\" y2=\"3.81\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-3.81\" y1=\"-3.81\" x2=\"-3.81\" y2=\"3.81\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"3.81\" y1=\"2.54\" x2=\"3.81\" y2=\"-3.81\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-3.81\" y1=\"-3.81\" x2=\"-2.54\" y2=\"-3.81\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-2.54\" y1=\"-3.302\" x2=\"-2.54\" y2=\"-3.81\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"3.81\" y1=\"-3.81\" x2=\"2.54\" y2=\"-3.81\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.54\" y1=\"-3.302\" x2=\"2.54\" y2=\"-3.81\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.54\" y1=\"-3.302\" x2=\"-2.54\" y2=\"-3.302\" width=\"0.1524\" layer=\"21\"/>\n<circle x=\"0\" y=\"0\" radius=\"2.54\" width=\"0.1524\" layer=\"21\"/>\n<circle x=\"0\" y=\"0\" radius=\"3.175\" width=\"0.254\" layer=\"21\"/>\n<pad name=\"A\" x=\"-1.27\" y=\"0\" drill=\"1.016\" shape=\"long\" rot=\"R90\"/>\n<pad name=\"K\" x=\"1.27\" y=\"0\" drill=\"1.016\" shape=\"long\" rot=\"R90\"/>\n<text x=\"-3.81\" y=\"4.0894\" size=\"1.27\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-3.7846\" y=\"-5.3594\" size=\"1.27\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n<text x=\"-3.556\" y=\"-3.302\" size=\"1.016\" layer=\"21\" ratio=\"14\">+</text>\n<text x=\"2.794\" y=\"-3.302\" size=\"1.016\" layer=\"21\" ratio=\"14\">-</text>\n</package>\n<package name=\"SFH480\">\n<description>&lt;B&gt;IR LED&lt;/B&gt;&lt;p&gt;\ninfrared emitting diode, Infineon\nTO-18, lead spacing 2.54 mm, cathode marking&lt;p&gt;\nInifineon</description>\n<wire x1=\"-2.159\" y1=\"1.524\" x2=\"-2.794\" y2=\"2.159\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-2.794\" y1=\"2.159\" x2=\"-2.159\" y2=\"2.794\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-1.524\" y1=\"2.159\" x2=\"-2.159\" y2=\"2.794\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"0\" y1=\"1.778\" x2=\"1.5358\" y2=\"0.8959\" width=\"0.1524\" layer=\"21\" curve=\"-59.743278\"/>\n<wire x1=\"-1.5358\" y1=\"0.8959\" x2=\"0\" y2=\"1.778\" width=\"0.1524\" layer=\"21\" curve=\"-59.743278\"/>\n<wire x1=\"-1.5358\" y1=\"-0.8959\" x2=\"0\" y2=\"-1.778\" width=\"0.1524\" layer=\"21\" curve=\"59.743278\"/>\n<wire x1=\"0\" y1=\"-1.778\" x2=\"1.5358\" y2=\"-0.8959\" width=\"0.1524\" layer=\"21\" curve=\"59.743278\"/>\n<wire x1=\"1.5142\" y1=\"0.9318\" x2=\"1.778\" y2=\"0\" width=\"0.1524\" layer=\"51\" curve=\"-31.606487\"/>\n<wire x1=\"1.5\" y1=\"-0.9546\" x2=\"1.778\" y2=\"0\" width=\"0.1524\" layer=\"51\" curve=\"32.472615\"/>\n<wire x1=\"-1.778\" y1=\"0\" x2=\"-1.5142\" y2=\"-0.9318\" width=\"0.1524\" layer=\"51\" curve=\"31.606487\"/>\n<wire x1=\"-1.778\" y1=\"0\" x2=\"-1.5\" y2=\"0.9546\" width=\"0.1524\" layer=\"51\" curve=\"-32.472615\"/>\n<wire x1=\"-0.635\" y1=\"0\" x2=\"0\" y2=\"0.635\" width=\"0.1524\" layer=\"51\" curve=\"-90\"/>\n<wire x1=\"-1.016\" y1=\"0\" x2=\"0\" y2=\"1.016\" width=\"0.1524\" layer=\"51\" curve=\"-90\"/>\n<wire x1=\"0\" y1=\"-0.635\" x2=\"0.635\" y2=\"0\" width=\"0.1524\" layer=\"51\" curve=\"90\"/>\n<wire x1=\"0.0539\" y1=\"-1.0699\" x2=\"1.0699\" y2=\"-0.0539\" width=\"0.1524\" layer=\"51\" curve=\"90\"/>\n<circle x=\"0\" y=\"0\" radius=\"2.667\" width=\"0.1524\" layer=\"21\"/>\n<circle x=\"0\" y=\"0\" radius=\"2.413\" width=\"0.254\" layer=\"21\"/>\n<pad name=\"K\" x=\"-1.27\" y=\"0\" drill=\"0.8128\" shape=\"long\" rot=\"R90\"/>\n<pad name=\"A\" x=\"1.27\" y=\"0\" drill=\"0.8128\" shape=\"long\" rot=\"R90\"/>\n<text x=\"-1.27\" y=\"3.048\" size=\"1.27\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-1.27\" y=\"-4.318\" size=\"1.27\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n</package>\n<package name=\"SFH482\">\n<description>&lt;B&gt;IR LED&lt;/B&gt;&lt;p&gt;\ninfrared emitting diode, Infineon\nTO-18, lead spacing 2.54 mm, cathode marking&lt;p&gt;\nInifineon</description>\n<wire x1=\"-2.159\" y1=\"1.524\" x2=\"-2.794\" y2=\"2.159\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-2.794\" y1=\"2.159\" x2=\"-2.159\" y2=\"2.794\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-1.524\" y1=\"2.159\" x2=\"-2.159\" y2=\"2.794\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"0\" y1=\"1.778\" x2=\"1.5358\" y2=\"0.8959\" width=\"0.1524\" layer=\"21\" curve=\"-59.743278\"/>\n<wire x1=\"-1.5358\" y1=\"0.8959\" x2=\"0\" y2=\"1.778\" width=\"0.1524\" layer=\"21\" curve=\"-59.743278\"/>\n<wire x1=\"-1.5358\" y1=\"-0.8959\" x2=\"0\" y2=\"-1.778\" width=\"0.1524\" layer=\"21\" curve=\"59.743278\"/>\n<wire x1=\"0\" y1=\"-1.778\" x2=\"1.5358\" y2=\"-0.8959\" width=\"0.1524\" layer=\"21\" curve=\"59.743278\"/>\n<wire x1=\"1.5142\" y1=\"0.9318\" x2=\"1.778\" y2=\"0\" width=\"0.1524\" layer=\"51\" curve=\"-31.606487\"/>\n<wire x1=\"1.5\" y1=\"-0.9546\" x2=\"1.778\" y2=\"0\" width=\"0.1524\" layer=\"51\" curve=\"32.472615\"/>\n<wire x1=\"-1.778\" y1=\"0\" x2=\"-1.5142\" y2=\"-0.9318\" width=\"0.1524\" layer=\"51\" curve=\"31.606487\"/>\n<wire x1=\"-1.778\" y1=\"0\" x2=\"-1.5\" y2=\"0.9546\" width=\"0.1524\" layer=\"51\" curve=\"-32.472615\"/>\n<wire x1=\"-0.635\" y1=\"0\" x2=\"0\" y2=\"0.635\" width=\"0.1524\" layer=\"51\" curve=\"-90\"/>\n<wire x1=\"-1.016\" y1=\"0\" x2=\"0\" y2=\"1.016\" width=\"0.1524\" layer=\"51\" curve=\"-90\"/>\n<wire x1=\"0\" y1=\"-0.635\" x2=\"0.635\" y2=\"0\" width=\"0.1524\" layer=\"51\" curve=\"90\"/>\n<wire x1=\"0.0539\" y1=\"-1.0699\" x2=\"1.0699\" y2=\"-0.0539\" width=\"0.1524\" layer=\"51\" curve=\"90\"/>\n<circle x=\"0\" y=\"0\" radius=\"2.667\" width=\"0.1524\" layer=\"21\"/>\n<circle x=\"0\" y=\"0\" radius=\"2.413\" width=\"0.254\" layer=\"21\"/>\n<pad name=\"K\" x=\"1.27\" y=\"0\" drill=\"0.8128\" shape=\"long\" rot=\"R90\"/>\n<pad name=\"A\" x=\"-1.27\" y=\"0\" drill=\"0.8128\" shape=\"long\" rot=\"R90\"/>\n<text x=\"-1.27\" y=\"3.048\" size=\"1.27\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-1.27\" y=\"-4.318\" size=\"1.27\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n</package>\n<package name=\"U57X32\">\n<description>&lt;B&gt;LED&lt;/B&gt;&lt;p&gt;\nrectangle, 5.7 x 3.2 mm</description>\n<wire x1=\"-3.175\" y1=\"1.905\" x2=\"3.175\" y2=\"1.905\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"3.175\" y1=\"-1.905\" x2=\"3.175\" y2=\"1.905\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"3.175\" y1=\"-1.905\" x2=\"-3.175\" y2=\"-1.905\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-3.175\" y1=\"1.905\" x2=\"-3.175\" y2=\"-1.905\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-2.667\" y1=\"1.397\" x2=\"2.667\" y2=\"1.397\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.667\" y1=\"-1.397\" x2=\"2.667\" y2=\"1.397\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"2.667\" y1=\"-1.397\" x2=\"-2.667\" y2=\"-1.397\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-2.667\" y1=\"1.397\" x2=\"-2.667\" y2=\"-1.397\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-2.54\" y1=\"1.016\" x2=\"2.54\" y2=\"1.016\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"2.286\" y1=\"1.27\" x2=\"2.286\" y2=\"-1.27\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"-2.54\" y1=\"0.508\" x2=\"2.54\" y2=\"0.508\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"-2.54\" y1=\"0\" x2=\"2.54\" y2=\"0\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"-2.54\" y1=\"-0.508\" x2=\"2.54\" y2=\"-0.508\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"-2.54\" y1=\"-1.016\" x2=\"2.54\" y2=\"-1.016\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"-2.286\" y1=\"1.27\" x2=\"-2.286\" y2=\"-1.27\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"-1.778\" y1=\"1.27\" x2=\"-1.778\" y2=\"-1.27\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"-1.27\" y1=\"1.27\" x2=\"-1.27\" y2=\"-1.27\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"-0.762\" y1=\"1.27\" x2=\"-0.762\" y2=\"-1.27\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"-0.254\" y1=\"1.27\" x2=\"-0.254\" y2=\"-1.27\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"0.254\" y1=\"1.27\" x2=\"0.254\" y2=\"-1.27\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"0.762\" y1=\"1.27\" x2=\"0.762\" y2=\"-1.27\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"1.27\" y1=\"1.27\" x2=\"1.27\" y2=\"-1.27\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"1.778\" y1=\"1.27\" x2=\"1.778\" y2=\"-1.27\" width=\"0.1524\" layer=\"51\"/>\n<pad name=\"A\" x=\"-1.27\" y=\"0\" drill=\"0.8128\" shape=\"long\" rot=\"R90\"/>\n<pad name=\"K\" x=\"1.27\" y=\"0\" drill=\"0.8128\" shape=\"long\" rot=\"R90\"/>\n<text x=\"3.683\" y=\"0.254\" size=\"1.27\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"3.683\" y=\"-1.524\" size=\"1.27\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n</package>\n<package name=\"IRL80A\">\n<description>&lt;B&gt;IR LED&lt;/B&gt;&lt;p&gt;\nIR transmitter Siemens</description>\n<wire x1=\"0.889\" y1=\"2.286\" x2=\"0.889\" y2=\"1.778\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"0.889\" y1=\"1.778\" x2=\"0.889\" y2=\"0.762\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"0.889\" y1=\"0.762\" x2=\"0.889\" y2=\"-0.635\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"0.889\" y1=\"-0.635\" x2=\"0.889\" y2=\"-1.778\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"0.889\" y1=\"-1.778\" x2=\"0.889\" y2=\"-2.286\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"0.889\" y1=\"-2.286\" x2=\"-0.889\" y2=\"-2.286\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-0.889\" y1=\"2.286\" x2=\"-0.889\" y2=\"1.778\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-0.889\" y1=\"1.778\" x2=\"-0.889\" y2=\"0.762\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"-0.889\" y1=\"0.762\" x2=\"-0.889\" y2=\"-0.762\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-0.889\" y1=\"-0.762\" x2=\"-0.889\" y2=\"-1.778\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"-0.889\" y1=\"-1.778\" x2=\"-0.889\" y2=\"-2.286\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-0.889\" y1=\"2.286\" x2=\"0.889\" y2=\"2.286\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-0.889\" y1=\"-0.762\" x2=\"-0.889\" y2=\"0.762\" width=\"0.1524\" layer=\"21\" curve=\"-180\"/>\n<wire x1=\"-1.397\" y1=\"0.254\" x2=\"-1.397\" y2=\"-0.254\" width=\"0.0508\" layer=\"21\"/>\n<wire x1=\"-1.143\" y1=\"0.508\" x2=\"-1.143\" y2=\"-0.508\" width=\"0.0508\" layer=\"21\"/>\n<pad name=\"K\" x=\"0\" y=\"1.27\" drill=\"0.8128\" shape=\"octagon\"/>\n<pad name=\"A\" x=\"0\" y=\"-1.27\" drill=\"0.8128\" shape=\"octagon\"/>\n<text x=\"1.27\" y=\"0.381\" size=\"1.27\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"1.27\" y=\"-1.651\" size=\"1.27\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n</package>\n<package name=\"P-LCC-2\">\n<description>&lt;b&gt;TOPLED® High-optical Power LED (HOP)&lt;/b&gt;&lt;p&gt;\nSource: http://www.osram.convergy.de/ ... ls_t675.pdf</description>\n<wire x1=\"-1.4\" y1=\"-1.05\" x2=\"-1.4\" y2=\"-1.6\" width=\"0.2032\" layer=\"51\"/>\n<wire x1=\"-1.4\" y1=\"-1.6\" x2=\"-1.1\" y2=\"-1.6\" width=\"0.2032\" layer=\"51\"/>\n<wire x1=\"-1.1\" y1=\"-1.6\" x2=\"-0.85\" y2=\"-1.6\" width=\"0.2032\" layer=\"51\"/>\n<wire x1=\"-0.85\" y1=\"-1.6\" x2=\"1.1\" y2=\"-1.6\" width=\"0.2032\" layer=\"51\"/>\n<wire x1=\"1.1\" y1=\"-1.6\" x2=\"1.4\" y2=\"-1.6\" width=\"0.2032\" layer=\"51\"/>\n<wire x1=\"1.4\" y1=\"-1.6\" x2=\"1.4\" y2=\"1.6\" width=\"0.2032\" layer=\"51\"/>\n<wire x1=\"1.4\" y1=\"1.6\" x2=\"1.1\" y2=\"1.6\" width=\"0.2032\" layer=\"51\"/>\n<wire x1=\"1.1\" y1=\"1.6\" x2=\"-1.1\" y2=\"1.6\" width=\"0.2032\" layer=\"51\"/>\n<wire x1=\"-1.1\" y1=\"1.6\" x2=\"-1.4\" y2=\"1.6\" width=\"0.2032\" layer=\"51\"/>\n<wire x1=\"-1.1\" y1=\"1.6\" x2=\"-1.1\" y2=\"1.8\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"-1.1\" y1=\"1.8\" x2=\"1.1\" y2=\"1.8\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"1.1\" y1=\"1.8\" x2=\"1.1\" y2=\"1.6\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"-1.1\" y1=\"-1.6\" x2=\"-1.1\" y2=\"-1.8\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"-1.1\" y1=\"-1.8\" x2=\"1.1\" y2=\"-1.8\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"1.1\" y1=\"-1.8\" x2=\"1.1\" y2=\"-1.6\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"-0.85\" y1=\"-1.6\" x2=\"-1.4\" y2=\"-1.05\" width=\"0.2032\" layer=\"51\"/>\n<wire x1=\"-1.4\" y1=\"1.6\" x2=\"-1.4\" y2=\"-1.05\" width=\"0.2032\" layer=\"51\"/>\n<circle x=\"0\" y=\"0\" radius=\"1.1\" width=\"0.2032\" layer=\"51\"/>\n<smd name=\"C\" x=\"0\" y=\"-2.75\" dx=\"4\" dy=\"4\" layer=\"1\" stop=\"no\" cream=\"no\"/>\n<smd name=\"A\" x=\"0\" y=\"2.75\" dx=\"4\" dy=\"4\" layer=\"1\" stop=\"no\" cream=\"no\"/>\n<text x=\"-2.54\" y=\"-1.905\" size=\"1.27\" layer=\"25\" rot=\"R90\">&gt;NAME</text>\n<text x=\"3.81\" y=\"-1.905\" size=\"1.27\" layer=\"27\" rot=\"R90\">&gt;VALUE</text>\n<text x=\"-0.635\" y=\"2.54\" size=\"1.27\" layer=\"21\">A</text>\n<text x=\"-0.635\" y=\"-3.81\" size=\"1.27\" layer=\"21\">C</text>\n<rectangle x1=\"-1.3\" y1=\"-2.25\" x2=\"1.3\" y2=\"-0.75\" layer=\"31\"/>\n<rectangle x1=\"-1.3\" y1=\"0.75\" x2=\"1.3\" y2=\"2.25\" layer=\"31\"/>\n<rectangle x1=\"-0.25\" y1=\"-0.25\" x2=\"0.25\" y2=\"0.25\" layer=\"21\"/>\n<rectangle x1=\"-1.4\" y1=\"0.65\" x2=\"1.4\" y2=\"2.35\" layer=\"29\"/>\n<rectangle x1=\"-1.4\" y1=\"-2.35\" x2=\"1.4\" y2=\"-0.65\" layer=\"29\"/>\n</package>\n<package name=\"OSRAM-MINI-TOP-LED\">\n<description>&lt;b&gt;BLUE LINETM Hyper Mini TOPLED® Hyper-Bright LED&lt;/b&gt;&lt;p&gt;\nSource: http://www.osram.convergy.de/ ... LB M676.pdf</description>\n<wire x1=\"-0.6\" y1=\"0.9\" x2=\"-0.6\" y2=\"-0.7\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"-0.45\" y1=\"-0.9\" x2=\"-0.4\" y2=\"-0.9\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"-0.4\" y1=\"-0.9\" x2=\"0.6\" y2=\"-0.9\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"0.6\" y1=\"-0.9\" x2=\"0.6\" y2=\"0.9\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"0.6\" y1=\"0.9\" x2=\"-0.6\" y2=\"0.9\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"-0.45\" y1=\"0.95\" x2=\"-0.45\" y2=\"1.1\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"-0.45\" y1=\"1.1\" x2=\"0.45\" y2=\"1.1\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"0.45\" y1=\"1.1\" x2=\"0.45\" y2=\"0.95\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"-0.6\" y1=\"-0.7\" x2=\"-0.4\" y2=\"-0.9\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"-0.45\" y1=\"-0.9\" x2=\"-0.45\" y2=\"-1.1\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"-0.45\" y1=\"-1.1\" x2=\"0.45\" y2=\"-1.1\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"0.45\" y1=\"-1.1\" x2=\"0.45\" y2=\"-0.95\" width=\"0.1016\" layer=\"51\"/>\n<smd name=\"A\" x=\"0\" y=\"2.6\" dx=\"4\" dy=\"4\" layer=\"1\" stop=\"no\" cream=\"no\"/>\n<smd name=\"C\" x=\"0\" y=\"-2.6\" dx=\"4\" dy=\"4\" layer=\"1\" stop=\"no\" cream=\"no\"/>\n<text x=\"-0.635\" y=\"1.905\" size=\"1.27\" layer=\"21\">A</text>\n<text x=\"-0.635\" y=\"-3.175\" size=\"1.27\" layer=\"21\">C</text>\n<text x=\"-2.54\" y=\"-1.905\" size=\"1.27\" layer=\"25\" rot=\"R90\">&gt;NAME</text>\n<text x=\"3.81\" y=\"-1.905\" size=\"1.27\" layer=\"27\" rot=\"R90\">&gt;VALUE</text>\n<rectangle x1=\"-0.5\" y1=\"0.6\" x2=\"0.5\" y2=\"1.4\" layer=\"29\"/>\n<rectangle x1=\"-0.5\" y1=\"-1.4\" x2=\"0.5\" y2=\"-0.6\" layer=\"29\"/>\n<rectangle x1=\"-0.15\" y1=\"-0.6\" x2=\"0.15\" y2=\"-0.3\" layer=\"51\"/>\n<rectangle x1=\"-0.45\" y1=\"0.65\" x2=\"0.45\" y2=\"1.35\" layer=\"31\"/>\n<rectangle x1=\"-0.45\" y1=\"-1.35\" x2=\"0.45\" y2=\"-0.65\" layer=\"31\"/>\n</package>\n<package name=\"OSRAM-SIDELED\">\n<description>&lt;b&gt;Super SIDELED® High-Current LED&lt;/b&gt;&lt;p&gt;\nLG A672, LP A672 &lt;br&gt;\nSource: http://www.osram.convergy.de/ ... LG_LP_A672.pdf (2004.05.13)</description>\n<wire x1=\"-1.85\" y1=\"-2.05\" x2=\"-1.85\" y2=\"-0.75\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"-1.85\" y1=\"-0.75\" x2=\"-1.7\" y2=\"-0.75\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"-1.7\" y1=\"-0.75\" x2=\"-1.7\" y2=\"0.75\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"-1.7\" y1=\"0.75\" x2=\"-1.85\" y2=\"0.75\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"-1.85\" y1=\"0.75\" x2=\"-1.85\" y2=\"2.05\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"-1.85\" y1=\"2.05\" x2=\"0.9\" y2=\"2.05\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"0.9\" y1=\"2.05\" x2=\"0.9\" y2=\"-2.05\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"0.9\" y1=\"-2.05\" x2=\"-1.85\" y2=\"-2.05\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"0.9\" y1=\"-2.05\" x2=\"1.05\" y2=\"-2.05\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"1.05\" y1=\"-2.05\" x2=\"1.85\" y2=\"-1.85\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"1.85\" y1=\"-1.85\" x2=\"1.85\" y2=\"1.85\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"1.85\" y1=\"1.85\" x2=\"1.05\" y2=\"2.05\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"1.05\" y1=\"2.05\" x2=\"0.9\" y2=\"2.05\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"1.05\" y1=\"2.05\" x2=\"1.05\" y2=\"-2.05\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"-0.55\" y1=\"-0.9\" x2=\"-0.55\" y2=\"0.9\" width=\"0.1016\" layer=\"51\" curve=\"-167.319617\"/>\n<wire x1=\"-0.55\" y1=\"-0.9\" x2=\"0.85\" y2=\"-1.2\" width=\"0.1016\" layer=\"51\" style=\"shortdash\"/>\n<wire x1=\"-0.55\" y1=\"0.9\" x2=\"0.85\" y2=\"1.2\" width=\"0.1016\" layer=\"51\" style=\"shortdash\"/>\n<smd name=\"C\" x=\"0\" y=\"-2.5\" dx=\"4\" dy=\"4\" layer=\"1\" stop=\"no\" cream=\"no\"/>\n<smd name=\"A\" x=\"0\" y=\"2.5\" dx=\"4\" dy=\"4\" layer=\"1\" stop=\"no\" cream=\"no\"/>\n<text x=\"0.635\" y=\"-3.175\" size=\"1.27\" layer=\"21\" rot=\"R90\">C</text>\n<text x=\"0.635\" y=\"2.54\" size=\"1.27\" layer=\"21\" rot=\"R90\">A</text>\n<text x=\"-2.54\" y=\"-2.54\" size=\"1.27\" layer=\"25\" rot=\"R90\">&gt;NAME</text>\n<text x=\"3.81\" y=\"-2.54\" size=\"1.27\" layer=\"27\" rot=\"R90\">&gt;VALUE</text>\n<rectangle x1=\"-2.1\" y1=\"-2.2\" x2=\"2.1\" y2=\"-0.4\" layer=\"29\"/>\n<rectangle x1=\"-2.1\" y1=\"0.4\" x2=\"2.1\" y2=\"2.2\" layer=\"29\"/>\n<rectangle x1=\"-1.9\" y1=\"-2.1\" x2=\"1.9\" y2=\"-0.6\" layer=\"31\"/>\n<rectangle x1=\"-1.9\" y1=\"0.6\" x2=\"1.9\" y2=\"2.1\" layer=\"31\"/>\n<rectangle x1=\"-1.85\" y1=\"-2.05\" x2=\"-0.7\" y2=\"-1\" layer=\"51\"/>\n</package>\n<package name=\"SMART-LED\">\n<description>&lt;b&gt;SmartLEDTM Hyper-Bright LED&lt;/b&gt;&lt;p&gt;\nSource: http://www.osram.convergy.de/ ... LA_LO_LS_LY L896.pdf</description>\n<wire x1=\"-0.35\" y1=\"0.6\" x2=\"0.35\" y2=\"0.6\" width=\"0.1016\" layer=\"51\" style=\"shortdash\"/>\n<wire x1=\"0.35\" y1=\"0.6\" x2=\"0.35\" y2=\"-0.6\" width=\"0.1016\" layer=\"21\" style=\"shortdash\"/>\n<wire x1=\"0.35\" y1=\"-0.6\" x2=\"0.15\" y2=\"-0.6\" width=\"0.1016\" layer=\"51\" style=\"shortdash\"/>\n<wire x1=\"0.15\" y1=\"-0.6\" x2=\"-0.35\" y2=\"-0.6\" width=\"0.1016\" layer=\"51\" style=\"shortdash\"/>\n<wire x1=\"-0.35\" y1=\"-0.6\" x2=\"-0.35\" y2=\"0.6\" width=\"0.1016\" layer=\"21\" style=\"shortdash\"/>\n<wire x1=\"0.35\" y1=\"-0.4\" x2=\"0.15\" y2=\"-0.6\" width=\"0.1016\" layer=\"51\" style=\"shortdash\"/>\n<smd name=\"A\" x=\"0\" y=\"0.725\" dx=\"0.35\" dy=\"0.35\" layer=\"1\"/>\n<smd name=\"B\" x=\"0\" y=\"-0.725\" dx=\"0.35\" dy=\"0.35\" layer=\"1\"/>\n<text x=\"-0.635\" y=\"-0.635\" size=\"1.016\" layer=\"25\" rot=\"R90\">&gt;NAME</text>\n<text x=\"1.905\" y=\"-0.635\" size=\"1.016\" layer=\"27\" rot=\"R90\">&gt;VALUE</text>\n<rectangle x1=\"-0.15\" y1=\"-0.35\" x2=\"0.15\" y2=\"-0.05\" layer=\"21\"/>\n<rectangle x1=\"-0.15\" y1=\"0.6\" x2=\"0.15\" y2=\"0.85\" layer=\"51\"/>\n<rectangle x1=\"-0.15\" y1=\"-0.85\" x2=\"0.15\" y2=\"-0.6\" layer=\"51\"/>\n</package>\n<package name=\"P-LCC-2-TOPLED-RG\">\n<description>&lt;b&gt;Hyper TOPLED® RG Hyper-Bright LED&lt;/b&gt;&lt;p&gt;\nSource: http://www.osram.convergy.de/ ... LA_LO_LS_LY T776.pdf</description>\n<wire x1=\"-1.4\" y1=\"-1.05\" x2=\"-1.4\" y2=\"-1.6\" width=\"0.2032\" layer=\"51\"/>\n<wire x1=\"-1.4\" y1=\"-1.6\" x2=\"-1.1\" y2=\"-1.6\" width=\"0.2032\" layer=\"51\"/>\n<wire x1=\"-1.1\" y1=\"-1.6\" x2=\"-0.85\" y2=\"-1.6\" width=\"0.2032\" layer=\"51\"/>\n<wire x1=\"-0.85\" y1=\"-1.6\" x2=\"1.1\" y2=\"-1.6\" width=\"0.2032\" layer=\"51\"/>\n<wire x1=\"1.1\" y1=\"-1.6\" x2=\"1.4\" y2=\"-1.6\" width=\"0.2032\" layer=\"51\"/>\n<wire x1=\"1.4\" y1=\"-1.6\" x2=\"1.4\" y2=\"1.6\" width=\"0.2032\" layer=\"51\"/>\n<wire x1=\"1.4\" y1=\"1.6\" x2=\"1.1\" y2=\"1.6\" width=\"0.2032\" layer=\"51\"/>\n<wire x1=\"1.1\" y1=\"1.6\" x2=\"-1.1\" y2=\"1.6\" width=\"0.2032\" layer=\"51\"/>\n<wire x1=\"-1.1\" y1=\"1.6\" x2=\"-1.4\" y2=\"1.6\" width=\"0.2032\" layer=\"51\"/>\n<wire x1=\"-1.1\" y1=\"1.6\" x2=\"-1.1\" y2=\"2.45\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"1.1\" y1=\"2.45\" x2=\"1.1\" y2=\"1.6\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"-1.1\" y1=\"-1.6\" x2=\"-1.1\" y2=\"-2.45\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"1.1\" y1=\"-2.45\" x2=\"1.1\" y2=\"-1.6\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"-0.85\" y1=\"-1.6\" x2=\"-1.4\" y2=\"-1.05\" width=\"0.2032\" layer=\"51\"/>\n<wire x1=\"-1.4\" y1=\"1.6\" x2=\"-1.4\" y2=\"-1.05\" width=\"0.2032\" layer=\"51\"/>\n<circle x=\"0\" y=\"0\" radius=\"1.1\" width=\"0.2032\" layer=\"21\"/>\n<smd name=\"C\" x=\"0\" y=\"-3.5\" dx=\"4\" dy=\"4\" layer=\"1\" stop=\"no\" cream=\"no\"/>\n<smd name=\"A\" x=\"0\" y=\"3.5\" dx=\"4\" dy=\"4\" layer=\"1\" stop=\"no\" cream=\"no\"/>\n<text x=\"-2.54\" y=\"-1.905\" size=\"1.27\" layer=\"25\" rot=\"R90\">&gt;NAME</text>\n<text x=\"3.81\" y=\"-1.905\" size=\"1.27\" layer=\"27\" rot=\"R90\">&gt;VALUE</text>\n<text x=\"-0.635\" y=\"3.29\" size=\"1.27\" layer=\"21\">A</text>\n<text x=\"-0.635\" y=\"-4.56\" size=\"1.27\" layer=\"21\">C</text>\n<rectangle x1=\"-1.3\" y1=\"-3\" x2=\"1.3\" y2=\"-1.5\" layer=\"31\"/>\n<rectangle x1=\"-1.3\" y1=\"1.5\" x2=\"1.3\" y2=\"3\" layer=\"31\"/>\n<rectangle x1=\"-0.25\" y1=\"-0.25\" x2=\"0.25\" y2=\"0.25\" layer=\"21\"/>\n<rectangle x1=\"-1.15\" y1=\"2.4\" x2=\"1.15\" y2=\"2.7\" layer=\"51\"/>\n<rectangle x1=\"-1.15\" y1=\"-2.7\" x2=\"1.15\" y2=\"-2.4\" layer=\"51\"/>\n<rectangle x1=\"-1.5\" y1=\"1.5\" x2=\"1.5\" y2=\"3.2\" layer=\"29\"/>\n<rectangle x1=\"-1.5\" y1=\"-3.2\" x2=\"1.5\" y2=\"-1.5\" layer=\"29\"/>\n<hole x=\"0\" y=\"0\" drill=\"2.8\"/>\n</package>\n<package name=\"MICRO-SIDELED\">\n<description>&lt;b&gt;Hyper Micro SIDELED®&lt;/b&gt;&lt;p&gt;\nSource: http://www.osram.convergy.de/ ... LA_LO_LS_LY Y876.pdf</description>\n<wire x1=\"0.65\" y1=\"1.1\" x2=\"-0.1\" y2=\"1.1\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"-0.1\" y1=\"1.1\" x2=\"-0.35\" y2=\"1\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"-0.35\" y1=\"1\" x2=\"-0.35\" y2=\"-0.9\" width=\"0.1016\" layer=\"21\"/>\n<wire x1=\"-0.35\" y1=\"-0.9\" x2=\"-0.1\" y2=\"-1.1\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"-0.1\" y1=\"-1.1\" x2=\"0.65\" y2=\"-1.1\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"0.65\" y1=\"-1.1\" x2=\"0.65\" y2=\"1.1\" width=\"0.1016\" layer=\"21\"/>\n<wire x1=\"0.6\" y1=\"0.9\" x2=\"0.25\" y2=\"0.7\" width=\"0.0508\" layer=\"21\"/>\n<wire x1=\"0.25\" y1=\"0.7\" x2=\"0.25\" y2=\"-0.7\" width=\"0.0508\" layer=\"21\"/>\n<wire x1=\"0.25\" y1=\"-0.7\" x2=\"0.6\" y2=\"-0.9\" width=\"0.0508\" layer=\"21\"/>\n<smd name=\"A\" x=\"0\" y=\"1.95\" dx=\"1.6\" dy=\"1.6\" layer=\"1\" stop=\"no\" cream=\"no\"/>\n<smd name=\"C\" x=\"0\" y=\"-1.95\" dx=\"1.6\" dy=\"1.6\" layer=\"1\" stop=\"no\" cream=\"no\"/>\n<text x=\"-1.27\" y=\"-1.905\" size=\"1.27\" layer=\"25\" rot=\"R90\">&gt;NAME</text>\n<text x=\"2.54\" y=\"-1.905\" size=\"1.27\" layer=\"27\" rot=\"R90\">&gt;VALUE</text>\n<rectangle x1=\"-0.4\" y1=\"1.1\" x2=\"0.4\" y2=\"1.8\" layer=\"29\"/>\n<rectangle x1=\"-0.4\" y1=\"-1.8\" x2=\"0.4\" y2=\"-1.1\" layer=\"29\"/>\n<rectangle x1=\"-0.35\" y1=\"-1.75\" x2=\"0.35\" y2=\"-1.15\" layer=\"31\"/>\n<rectangle x1=\"-0.35\" y1=\"1.15\" x2=\"0.35\" y2=\"1.75\" layer=\"31\"/>\n<rectangle x1=\"-0.125\" y1=\"1.125\" x2=\"0.125\" y2=\"1.75\" layer=\"51\"/>\n<rectangle x1=\"-0.125\" y1=\"-1.75\" x2=\"0.125\" y2=\"-1.125\" layer=\"51\"/>\n</package>\n<package name=\"P-LCC-4\">\n<description>&lt;b&gt;Power TOPLED®&lt;/b&gt;&lt;p&gt;\nSource: http://www.osram.convergy.de/ ... LA_LO_LA_LY E67B.pdf</description>\n<wire x1=\"-1.4\" y1=\"-1.05\" x2=\"-1.4\" y2=\"-1.6\" width=\"0.2032\" layer=\"51\"/>\n<wire x1=\"-1.4\" y1=\"-1.6\" x2=\"-1\" y2=\"-1.6\" width=\"0.2032\" layer=\"51\"/>\n<wire x1=\"-1\" y1=\"-1.6\" x2=\"-0.85\" y2=\"-1.6\" width=\"0.2032\" layer=\"51\"/>\n<wire x1=\"-0.85\" y1=\"-1.6\" x2=\"1\" y2=\"-1.6\" width=\"0.2032\" layer=\"51\"/>\n<wire x1=\"1\" y1=\"-1.6\" x2=\"1.4\" y2=\"-1.6\" width=\"0.2032\" layer=\"51\"/>\n<wire x1=\"1.4\" y1=\"-1.6\" x2=\"1.4\" y2=\"1.6\" width=\"0.2032\" layer=\"51\"/>\n<wire x1=\"1.4\" y1=\"1.6\" x2=\"1.1\" y2=\"1.6\" width=\"0.2032\" layer=\"51\"/>\n<wire x1=\"1.1\" y1=\"1.6\" x2=\"-1\" y2=\"1.6\" width=\"0.2032\" layer=\"51\"/>\n<wire x1=\"-1\" y1=\"1.6\" x2=\"-1.4\" y2=\"1.6\" width=\"0.2032\" layer=\"51\"/>\n<wire x1=\"-1\" y1=\"1.6\" x2=\"-1\" y2=\"1.8\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"-1\" y1=\"1.8\" x2=\"-0.5\" y2=\"1.8\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"-0.5\" y1=\"1.8\" x2=\"-0.5\" y2=\"1.65\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"0.5\" y1=\"1.65\" x2=\"0.5\" y2=\"1.8\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"0.5\" y1=\"1.8\" x2=\"1.1\" y2=\"1.8\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"1.1\" y1=\"1.8\" x2=\"1.1\" y2=\"1.6\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"-1\" y1=\"-1.6\" x2=\"-1\" y2=\"-1.8\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"-1\" y1=\"-1.8\" x2=\"-0.5\" y2=\"-1.8\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"-0.5\" y1=\"-1.8\" x2=\"-0.5\" y2=\"-1.65\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"0.5\" y1=\"-1.65\" x2=\"0.5\" y2=\"-1.8\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"0.5\" y1=\"-1.8\" x2=\"1\" y2=\"-1.8\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"1\" y1=\"-1.8\" x2=\"1\" y2=\"-1.6\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"-0.85\" y1=\"-1.6\" x2=\"-1.4\" y2=\"-1.05\" width=\"0.2032\" layer=\"51\"/>\n<wire x1=\"-1.4\" y1=\"1.6\" x2=\"-1.4\" y2=\"-1.05\" width=\"0.2032\" layer=\"51\"/>\n<circle x=\"0\" y=\"0\" radius=\"1.1\" width=\"0.2032\" layer=\"51\"/>\n<smd name=\"A\" x=\"-2\" y=\"3.15\" dx=\"3.3\" dy=\"4.8\" layer=\"1\" stop=\"no\" cream=\"no\"/>\n<smd name=\"C@3\" x=\"2\" y=\"3.15\" dx=\"3.3\" dy=\"4.8\" layer=\"1\" stop=\"no\" cream=\"no\"/>\n<smd name=\"C@4\" x=\"2\" y=\"-3.15\" dx=\"3.3\" dy=\"4.8\" layer=\"1\" stop=\"no\" cream=\"no\"/>\n<smd name=\"C@1\" x=\"-2\" y=\"-3.15\" dx=\"3.3\" dy=\"4.8\" layer=\"1\" stop=\"no\" cream=\"no\"/>\n<text x=\"-3.81\" y=\"-2.54\" size=\"1.27\" layer=\"25\" rot=\"R90\">&gt;NAME</text>\n<text x=\"5.08\" y=\"-2.54\" size=\"1.27\" layer=\"27\" rot=\"R90\">&gt;VALUE</text>\n<text x=\"-1.905\" y=\"-3.81\" size=\"1.27\" layer=\"21\">C</text>\n<text x=\"-1.905\" y=\"2.54\" size=\"1.27\" layer=\"21\">A</text>\n<text x=\"1.27\" y=\"2.54\" size=\"1.27\" layer=\"21\">C</text>\n<text x=\"1.27\" y=\"-3.81\" size=\"1.27\" layer=\"21\">C</text>\n<rectangle x1=\"-1.15\" y1=\"0.75\" x2=\"-0.35\" y2=\"1.85\" layer=\"29\"/>\n<rectangle x1=\"0.35\" y1=\"0.75\" x2=\"1.15\" y2=\"1.85\" layer=\"29\"/>\n<rectangle x1=\"0.35\" y1=\"-1.85\" x2=\"1.15\" y2=\"-0.75\" layer=\"29\"/>\n<rectangle x1=\"-1.15\" y1=\"-1.85\" x2=\"-0.35\" y2=\"-0.75\" layer=\"29\"/>\n<rectangle x1=\"-1.1\" y1=\"-1.8\" x2=\"-0.4\" y2=\"-0.8\" layer=\"31\"/>\n<rectangle x1=\"0.4\" y1=\"-1.8\" x2=\"1.1\" y2=\"-0.8\" layer=\"31\"/>\n<rectangle x1=\"0.4\" y1=\"0.8\" x2=\"1.1\" y2=\"1.8\" layer=\"31\"/>\n<rectangle x1=\"-1.1\" y1=\"0.8\" x2=\"-0.4\" y2=\"1.8\" layer=\"31\"/>\n<rectangle x1=\"-0.2\" y1=\"-0.2\" x2=\"0.2\" y2=\"0.2\" layer=\"21\"/>\n</package>\n<package name=\"CHIP-LED0603\">\n<description>&lt;b&gt;Hyper CHIPLED Hyper-Bright LED&lt;/b&gt;&lt;p&gt;\nLB Q993&lt;br&gt;\nSource: http://www.osram.convergy.de/ ... Lb_q993.pdf</description>\n<wire x1=\"-0.4\" y1=\"0.45\" x2=\"-0.4\" y2=\"-0.45\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"0.4\" y1=\"0.45\" x2=\"0.4\" y2=\"-0.45\" width=\"0.1016\" layer=\"51\"/>\n<smd name=\"C\" x=\"0\" y=\"0.75\" dx=\"0.8\" dy=\"0.8\" layer=\"1\"/>\n<smd name=\"A\" x=\"0\" y=\"-0.75\" dx=\"0.8\" dy=\"0.8\" layer=\"1\"/>\n<text x=\"-0.635\" y=\"-0.635\" size=\"1.27\" layer=\"25\" rot=\"R90\">&gt;NAME</text>\n<text x=\"1.905\" y=\"-0.635\" size=\"1.27\" layer=\"27\" rot=\"R90\">&gt;VALUE</text>\n<rectangle x1=\"-0.45\" y1=\"0.45\" x2=\"0.45\" y2=\"0.85\" layer=\"51\"/>\n<rectangle x1=\"-0.45\" y1=\"-0.85\" x2=\"0.45\" y2=\"-0.45\" layer=\"51\"/>\n<rectangle x1=\"-0.45\" y1=\"0\" x2=\"-0.3\" y2=\"0.3\" layer=\"21\"/>\n<rectangle x1=\"0.3\" y1=\"0\" x2=\"0.45\" y2=\"0.3\" layer=\"21\"/>\n<rectangle x1=\"-0.15\" y1=\"0\" x2=\"0.15\" y2=\"0.3\" layer=\"21\"/>\n</package>\n<package name=\"CHIP-LED0805\">\n<description>&lt;b&gt;Hyper CHIPLED Hyper-Bright LED&lt;/b&gt;&lt;p&gt;\nLB R99A&lt;br&gt;\nSource: http://www.osram.convergy.de/ ... lb_r99a.pdf</description>\n<wire x1=\"-0.625\" y1=\"0.45\" x2=\"-0.625\" y2=\"-0.45\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"0.625\" y1=\"0.45\" x2=\"0.625\" y2=\"-0.475\" width=\"0.1016\" layer=\"51\"/>\n<smd name=\"C\" x=\"0\" y=\"1.05\" dx=\"1.2\" dy=\"1.2\" layer=\"1\"/>\n<smd name=\"A\" x=\"0\" y=\"-1.05\" dx=\"1.2\" dy=\"1.2\" layer=\"1\"/>\n<text x=\"-1.27\" y=\"-1.27\" size=\"1.27\" layer=\"25\" rot=\"R90\">&gt;NAME</text>\n<text x=\"2.54\" y=\"-1.27\" size=\"1.27\" layer=\"27\" rot=\"R90\">&gt;VALUE</text>\n<rectangle x1=\"-0.675\" y1=\"0\" x2=\"-0.525\" y2=\"0.3\" layer=\"21\"/>\n<rectangle x1=\"0.525\" y1=\"0\" x2=\"0.675\" y2=\"0.3\" layer=\"21\"/>\n<rectangle x1=\"-0.15\" y1=\"0\" x2=\"0.15\" y2=\"0.3\" layer=\"21\"/>\n<rectangle x1=\"-0.675\" y1=\"0.45\" x2=\"0.675\" y2=\"1.05\" layer=\"51\"/>\n<rectangle x1=\"-0.675\" y1=\"-1.05\" x2=\"0.675\" y2=\"-0.45\" layer=\"51\"/>\n</package>\n<package name=\"MINI-TOPLED-SANTANA\">\n<description>&lt;b&gt;Mini TOPLED Santana®&lt;/b&gt;&lt;p&gt;\nSource: http://www.osram.convergy.de/ ... LG M470.pdf</description>\n<wire x1=\"0.7\" y1=\"-1\" x2=\"0.35\" y2=\"-1\" width=\"0.1016\" layer=\"21\"/>\n<wire x1=\"0.35\" y1=\"-1\" x2=\"-0.7\" y2=\"-1\" width=\"0.1016\" layer=\"21\"/>\n<wire x1=\"-0.7\" y1=\"-1\" x2=\"-0.7\" y2=\"1\" width=\"0.1016\" layer=\"21\"/>\n<wire x1=\"-0.7\" y1=\"1\" x2=\"0.7\" y2=\"1\" width=\"0.1016\" layer=\"21\"/>\n<wire x1=\"0.7\" y1=\"1\" x2=\"0.7\" y2=\"-0.65\" width=\"0.1016\" layer=\"21\"/>\n<wire x1=\"0.7\" y1=\"-0.65\" x2=\"0.7\" y2=\"-1\" width=\"0.1016\" layer=\"21\"/>\n<wire x1=\"0.45\" y1=\"-0.7\" x2=\"-0.45\" y2=\"-0.7\" width=\"0.1016\" layer=\"21\"/>\n<wire x1=\"-0.45\" y1=\"-0.7\" x2=\"-0.45\" y2=\"0.7\" width=\"0.1016\" layer=\"21\"/>\n<wire x1=\"-0.45\" y1=\"0.7\" x2=\"0.45\" y2=\"0.7\" width=\"0.1016\" layer=\"21\"/>\n<wire x1=\"0.45\" y1=\"0.7\" x2=\"0.45\" y2=\"-0.7\" width=\"0.1016\" layer=\"21\"/>\n<wire x1=\"0.7\" y1=\"-0.65\" x2=\"0.35\" y2=\"-1\" width=\"0.1016\" layer=\"21\"/>\n<smd name=\"C\" x=\"0\" y=\"-2.2\" dx=\"1.6\" dy=\"1.6\" layer=\"1\" stop=\"no\" cream=\"no\"/>\n<smd name=\"A\" x=\"0\" y=\"2.2\" dx=\"1.6\" dy=\"1.6\" layer=\"1\" stop=\"no\" cream=\"no\"/>\n<text x=\"-1.27\" y=\"-1.905\" size=\"1.27\" layer=\"25\" rot=\"R90\">&gt;NAME</text>\n<text x=\"2.54\" y=\"-1.905\" size=\"1.27\" layer=\"27\" rot=\"R90\">&gt;VALUE</text>\n<rectangle x1=\"-0.55\" y1=\"1.5\" x2=\"0.55\" y2=\"2.1\" layer=\"29\"/>\n<rectangle x1=\"-0.55\" y1=\"-2.1\" x2=\"0.55\" y2=\"-1.5\" layer=\"29\"/>\n<rectangle x1=\"-0.5\" y1=\"-2.05\" x2=\"0.5\" y2=\"-1.55\" layer=\"31\"/>\n<rectangle x1=\"-0.5\" y1=\"1.55\" x2=\"0.5\" y2=\"2.05\" layer=\"31\"/>\n<rectangle x1=\"-0.2\" y1=\"-0.4\" x2=\"0.15\" y2=\"-0.05\" layer=\"21\"/>\n<rectangle x1=\"-0.5\" y1=\"-2.1\" x2=\"0.5\" y2=\"-1.4\" layer=\"51\"/>\n<rectangle x1=\"-0.5\" y1=\"1.4\" x2=\"0.5\" y2=\"2.05\" layer=\"51\"/>\n<rectangle x1=\"-0.5\" y1=\"1\" x2=\"0.5\" y2=\"1.4\" layer=\"21\"/>\n<rectangle x1=\"-0.5\" y1=\"-1.4\" x2=\"0.5\" y2=\"-1.05\" layer=\"21\"/>\n<hole x=\"0\" y=\"0\" drill=\"2.7\"/>\n</package>\n<package name=\"CHIPLED_0805\">\n<description>&lt;b&gt;CHIPLED&lt;/b&gt;&lt;p&gt;\nSource: http://www.osram.convergy.de/ ... LG_R971.pdf</description>\n<wire x1=\"-0.35\" y1=\"0.925\" x2=\"0.35\" y2=\"0.925\" width=\"0.1016\" layer=\"51\" curve=\"162.394521\"/>\n<wire x1=\"-0.35\" y1=\"-0.925\" x2=\"0.35\" y2=\"-0.925\" width=\"0.1016\" layer=\"51\" curve=\"-162.394521\"/>\n<wire x1=\"0.575\" y1=\"0.525\" x2=\"0.575\" y2=\"-0.525\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"-0.575\" y1=\"-0.5\" x2=\"-0.575\" y2=\"0.925\" width=\"0.1016\" layer=\"51\"/>\n<circle x=\"-0.45\" y=\"0.85\" radius=\"0.103\" width=\"0.1016\" layer=\"51\"/>\n<smd name=\"C\" x=\"0\" y=\"1.05\" dx=\"1.2\" dy=\"1.2\" layer=\"1\"/>\n<smd name=\"A\" x=\"0\" y=\"-1.05\" dx=\"1.2\" dy=\"1.2\" layer=\"1\"/>\n<text x=\"-1.27\" y=\"-1.27\" size=\"1.27\" layer=\"25\" rot=\"R90\">&gt;NAME</text>\n<text x=\"2.54\" y=\"-1.27\" size=\"1.27\" layer=\"27\" rot=\"R90\">&gt;VALUE</text>\n<rectangle x1=\"0.3\" y1=\"0.5\" x2=\"0.625\" y2=\"1\" layer=\"51\"/>\n<rectangle x1=\"-0.325\" y1=\"0.5\" x2=\"-0.175\" y2=\"0.75\" layer=\"51\"/>\n<rectangle x1=\"0.175\" y1=\"0.5\" x2=\"0.325\" y2=\"0.75\" layer=\"51\"/>\n<rectangle x1=\"-0.2\" y1=\"0.5\" x2=\"0.2\" y2=\"0.675\" layer=\"51\"/>\n<rectangle x1=\"0.3\" y1=\"-1\" x2=\"0.625\" y2=\"-0.5\" layer=\"51\"/>\n<rectangle x1=\"-0.625\" y1=\"-1\" x2=\"-0.3\" y2=\"-0.5\" layer=\"51\"/>\n<rectangle x1=\"0.175\" y1=\"-0.75\" x2=\"0.325\" y2=\"-0.5\" layer=\"51\"/>\n<rectangle x1=\"-0.325\" y1=\"-0.75\" x2=\"-0.175\" y2=\"-0.5\" layer=\"51\"/>\n<rectangle x1=\"-0.2\" y1=\"-0.675\" x2=\"0.2\" y2=\"-0.5\" layer=\"51\"/>\n<rectangle x1=\"-0.1\" y1=\"0\" x2=\"0.1\" y2=\"0.2\" layer=\"21\"/>\n<rectangle x1=\"-0.6\" y1=\"0.5\" x2=\"-0.3\" y2=\"0.8\" layer=\"51\"/>\n<rectangle x1=\"-0.625\" y1=\"0.925\" x2=\"-0.3\" y2=\"1\" layer=\"51\"/>\n</package>\n<package name=\"CHIPLED_1206\">\n<description>&lt;b&gt;CHIPLED&lt;/b&gt;&lt;p&gt;\nSource: http://www.osram.convergy.de/ ... LG_LY N971.pdf</description>\n<wire x1=\"-0.4\" y1=\"1.6\" x2=\"0.4\" y2=\"1.6\" width=\"0.1016\" layer=\"51\" curve=\"172.619069\"/>\n<wire x1=\"-0.8\" y1=\"-0.95\" x2=\"-0.8\" y2=\"0.95\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"0.8\" y1=\"0.95\" x2=\"0.8\" y2=\"-0.95\" width=\"0.1016\" layer=\"51\"/>\n<circle x=\"-0.55\" y=\"1.425\" radius=\"0.1\" width=\"0.1016\" layer=\"51\"/>\n<smd name=\"C\" x=\"0\" y=\"1.75\" dx=\"1.5\" dy=\"1.5\" layer=\"1\"/>\n<smd name=\"A\" x=\"0\" y=\"-1.75\" dx=\"1.5\" dy=\"1.5\" layer=\"1\"/>\n<text x=\"-1.27\" y=\"-1.27\" size=\"1.27\" layer=\"25\" rot=\"R90\">&gt;NAME</text>\n<text x=\"2.54\" y=\"-1.27\" size=\"1.27\" layer=\"27\" rot=\"R90\">&gt;VALUE</text>\n<rectangle x1=\"-0.85\" y1=\"1.525\" x2=\"-0.35\" y2=\"1.65\" layer=\"51\"/>\n<rectangle x1=\"-0.85\" y1=\"1.225\" x2=\"-0.625\" y2=\"1.55\" layer=\"51\"/>\n<rectangle x1=\"-0.45\" y1=\"1.225\" x2=\"-0.325\" y2=\"1.45\" layer=\"51\"/>\n<rectangle x1=\"-0.65\" y1=\"1.225\" x2=\"-0.225\" y2=\"1.35\" layer=\"51\"/>\n<rectangle x1=\"0.35\" y1=\"1.3\" x2=\"0.85\" y2=\"1.65\" layer=\"51\"/>\n<rectangle x1=\"0.25\" y1=\"1.225\" x2=\"0.85\" y2=\"1.35\" layer=\"51\"/>\n<rectangle x1=\"-0.85\" y1=\"0.95\" x2=\"0.85\" y2=\"1.25\" layer=\"51\"/>\n<rectangle x1=\"-0.85\" y1=\"-1.65\" x2=\"0.85\" y2=\"-0.95\" layer=\"51\"/>\n<rectangle x1=\"-0.85\" y1=\"0.35\" x2=\"-0.525\" y2=\"0.775\" layer=\"21\"/>\n<rectangle x1=\"0.525\" y1=\"0.35\" x2=\"0.85\" y2=\"0.775\" layer=\"21\"/>\n<rectangle x1=\"-0.175\" y1=\"0\" x2=\"0.175\" y2=\"0.35\" layer=\"21\"/>\n</package>\n<package name=\"CHIPLED_0603\">\n<description>&lt;b&gt;CHIPLED&lt;/b&gt;&lt;p&gt;\nSource: http://www.osram.convergy.de/ ... LG_LY Q971.pdf</description>\n<wire x1=\"-0.3\" y1=\"0.8\" x2=\"0.3\" y2=\"0.8\" width=\"0.1016\" layer=\"51\" curve=\"170.055574\"/>\n<wire x1=\"-0.275\" y1=\"-0.825\" x2=\"0.275\" y2=\"-0.825\" width=\"0.0508\" layer=\"51\" curve=\"-180\"/>\n<wire x1=\"-0.4\" y1=\"0.375\" x2=\"-0.4\" y2=\"-0.35\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"0.4\" y1=\"0.35\" x2=\"0.4\" y2=\"-0.35\" width=\"0.1016\" layer=\"51\"/>\n<circle x=\"-0.35\" y=\"0.625\" radius=\"0.075\" width=\"0.0508\" layer=\"51\"/>\n<smd name=\"C\" x=\"0\" y=\"0.75\" dx=\"0.8\" dy=\"0.8\" layer=\"1\"/>\n<smd name=\"A\" x=\"0\" y=\"-0.75\" dx=\"0.8\" dy=\"0.8\" layer=\"1\"/>\n<text x=\"-0.635\" y=\"-1.27\" size=\"1.27\" layer=\"25\" rot=\"R90\">&gt;NAME</text>\n<text x=\"1.905\" y=\"-1.27\" size=\"1.27\" layer=\"27\" rot=\"R90\">&gt;VALUE</text>\n<rectangle x1=\"-0.45\" y1=\"0.7\" x2=\"-0.25\" y2=\"0.85\" layer=\"51\"/>\n<rectangle x1=\"-0.275\" y1=\"0.55\" x2=\"-0.225\" y2=\"0.6\" layer=\"51\"/>\n<rectangle x1=\"-0.45\" y1=\"0.35\" x2=\"-0.4\" y2=\"0.725\" layer=\"51\"/>\n<rectangle x1=\"0.25\" y1=\"0.55\" x2=\"0.45\" y2=\"0.85\" layer=\"51\"/>\n<rectangle x1=\"-0.45\" y1=\"0.35\" x2=\"0.45\" y2=\"0.575\" layer=\"51\"/>\n<rectangle x1=\"-0.45\" y1=\"-0.85\" x2=\"-0.25\" y2=\"-0.35\" layer=\"51\"/>\n<rectangle x1=\"0.25\" y1=\"-0.85\" x2=\"0.45\" y2=\"-0.35\" layer=\"51\"/>\n<rectangle x1=\"-0.275\" y1=\"-0.575\" x2=\"0.275\" y2=\"-0.35\" layer=\"51\"/>\n<rectangle x1=\"-0.275\" y1=\"-0.65\" x2=\"-0.175\" y2=\"-0.55\" layer=\"51\"/>\n<rectangle x1=\"0.175\" y1=\"-0.65\" x2=\"0.275\" y2=\"-0.55\" layer=\"51\"/>\n<rectangle x1=\"-0.125\" y1=\"0\" x2=\"0.125\" y2=\"0.25\" layer=\"21\"/>\n</package>\n<package name=\"CHIPLED-0603-TTW\">\n<description>&lt;b&gt;CHIPLED-0603&lt;/b&gt;&lt;p&gt;\nRecommended Solder Pad useable for SmartLEDTM and Chipled - Package 0603&lt;br&gt;\nPackage able to withstand TTW-soldering heat&lt;br&gt;\nPackage suitable for TTW-soldering&lt;br&gt;\nSource: http://www.osram.convergy.de/ ... LO_LS_LY L89K.pdf</description>\n<wire x1=\"-0.3\" y1=\"0.8\" x2=\"0.3\" y2=\"0.8\" width=\"0.1016\" layer=\"51\" curve=\"170.055574\"/>\n<wire x1=\"-0.275\" y1=\"-0.825\" x2=\"0.275\" y2=\"-0.825\" width=\"0.0508\" layer=\"51\" curve=\"-180\"/>\n<wire x1=\"-0.4\" y1=\"0.375\" x2=\"-0.4\" y2=\"-0.35\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"0.4\" y1=\"0.35\" x2=\"0.4\" y2=\"-0.35\" width=\"0.1016\" layer=\"51\"/>\n<circle x=\"-0.35\" y=\"0.625\" radius=\"0.075\" width=\"0.0508\" layer=\"51\"/>\n<smd name=\"C\" x=\"0\" y=\"0.875\" dx=\"0.8\" dy=\"0.5\" layer=\"1\" stop=\"no\" cream=\"no\"/>\n<smd name=\"A\" x=\"0\" y=\"-0.875\" dx=\"0.8\" dy=\"0.5\" layer=\"1\" stop=\"no\" cream=\"no\"/>\n<smd name=\"A@1\" x=\"0\" y=\"-0.5\" dx=\"0.35\" dy=\"0.35\" layer=\"1\"/>\n<smd name=\"C@1\" x=\"0\" y=\"0.5\" dx=\"0.35\" dy=\"0.35\" layer=\"1\"/>\n<text x=\"-0.635\" y=\"-1.27\" size=\"1.27\" layer=\"25\" rot=\"R90\">&gt;NAME</text>\n<text x=\"1.905\" y=\"-1.27\" size=\"1.27\" layer=\"27\" rot=\"R90\">&gt;VALUE</text>\n<rectangle x1=\"-0.45\" y1=\"0.7\" x2=\"-0.25\" y2=\"0.85\" layer=\"51\"/>\n<rectangle x1=\"-0.275\" y1=\"0.55\" x2=\"-0.225\" y2=\"0.6\" layer=\"51\"/>\n<rectangle x1=\"-0.45\" y1=\"0.35\" x2=\"-0.4\" y2=\"0.725\" layer=\"51\"/>\n<rectangle x1=\"0.25\" y1=\"0.55\" x2=\"0.45\" y2=\"0.85\" layer=\"51\"/>\n<rectangle x1=\"-0.45\" y1=\"0.35\" x2=\"0.45\" y2=\"0.575\" layer=\"51\"/>\n<rectangle x1=\"-0.45\" y1=\"-0.85\" x2=\"-0.25\" y2=\"-0.35\" layer=\"51\"/>\n<rectangle x1=\"0.25\" y1=\"-0.85\" x2=\"0.45\" y2=\"-0.35\" layer=\"51\"/>\n<rectangle x1=\"-0.275\" y1=\"-0.575\" x2=\"0.275\" y2=\"-0.35\" layer=\"51\"/>\n<rectangle x1=\"-0.275\" y1=\"-0.65\" x2=\"-0.175\" y2=\"-0.55\" layer=\"51\"/>\n<rectangle x1=\"0.175\" y1=\"-0.65\" x2=\"0.275\" y2=\"-0.55\" layer=\"51\"/>\n<rectangle x1=\"-0.125\" y1=\"0\" x2=\"0.125\" y2=\"0.25\" layer=\"21\"/>\n<rectangle x1=\"-0.175\" y1=\"0.325\" x2=\"0.175\" y2=\"0.7\" layer=\"29\"/>\n<rectangle x1=\"-0.4\" y1=\"0.625\" x2=\"0.4\" y2=\"1.125\" layer=\"29\"/>\n<rectangle x1=\"-0.4\" y1=\"-1.125\" x2=\"0.4\" y2=\"-0.625\" layer=\"29\"/>\n<rectangle x1=\"-0.175\" y1=\"-0.675\" x2=\"0.175\" y2=\"-0.325\" layer=\"29\"/>\n</package>\n<package name=\"SMARTLED-TTW\">\n<description>&lt;b&gt;SmartLED TTW&lt;/b&gt;&lt;p&gt;\nRecommended Solder Pad useable for SmartLEDTM and Chipled - Package 0603&lt;br&gt;\nPackage able to withstand TTW-soldering heat&lt;br&gt;\nPackage suitable for TTW-soldering&lt;br&gt;\nSource: http://www.osram.convergy.de/ ... LO_LS_LY L89K.pdf</description>\n<wire x1=\"-0.35\" y1=\"0.6\" x2=\"0.35\" y2=\"0.6\" width=\"0.1016\" layer=\"51\" style=\"shortdash\"/>\n<wire x1=\"0.35\" y1=\"0.6\" x2=\"0.35\" y2=\"-0.6\" width=\"0.1016\" layer=\"21\" style=\"shortdash\"/>\n<wire x1=\"0.35\" y1=\"-0.6\" x2=\"0.15\" y2=\"-0.6\" width=\"0.1016\" layer=\"51\" style=\"shortdash\"/>\n<wire x1=\"0.15\" y1=\"-0.6\" x2=\"-0.35\" y2=\"-0.6\" width=\"0.1016\" layer=\"51\" style=\"shortdash\"/>\n<wire x1=\"-0.35\" y1=\"-0.6\" x2=\"-0.35\" y2=\"0.6\" width=\"0.1016\" layer=\"21\" style=\"shortdash\"/>\n<wire x1=\"0.35\" y1=\"-0.4\" x2=\"0.15\" y2=\"-0.6\" width=\"0.1016\" layer=\"51\" style=\"shortdash\"/>\n<smd name=\"C\" x=\"0\" y=\"0.875\" dx=\"0.8\" dy=\"0.5\" layer=\"1\" stop=\"no\" cream=\"no\"/>\n<smd name=\"A\" x=\"0\" y=\"-0.875\" dx=\"0.8\" dy=\"0.5\" layer=\"1\" stop=\"no\" cream=\"no\"/>\n<smd name=\"A@1\" x=\"0\" y=\"-0.5\" dx=\"0.35\" dy=\"0.35\" layer=\"1\" stop=\"no\" cream=\"no\"/>\n<smd name=\"C@1\" x=\"0\" y=\"0.5\" dx=\"0.35\" dy=\"0.35\" layer=\"1\" stop=\"no\" cream=\"no\"/>\n<text x=\"-0.635\" y=\"-1.27\" size=\"1.27\" layer=\"25\" rot=\"R90\">&gt;NAME</text>\n<text x=\"1.905\" y=\"-1.27\" size=\"1.27\" layer=\"27\" rot=\"R90\">&gt;VALUE</text>\n<rectangle x1=\"-0.175\" y1=\"0.325\" x2=\"0.175\" y2=\"0.7\" layer=\"29\"/>\n<rectangle x1=\"-0.15\" y1=\"-0.35\" x2=\"0.15\" y2=\"-0.05\" layer=\"21\"/>\n<rectangle x1=\"-0.15\" y1=\"0.6\" x2=\"0.15\" y2=\"0.85\" layer=\"51\"/>\n<rectangle x1=\"-0.15\" y1=\"-0.85\" x2=\"0.15\" y2=\"-0.6\" layer=\"51\"/>\n<rectangle x1=\"-0.225\" y1=\"0.3\" x2=\"0.225\" y2=\"0.975\" layer=\"31\"/>\n<rectangle x1=\"-0.175\" y1=\"-0.7\" x2=\"0.175\" y2=\"-0.325\" layer=\"29\" rot=\"R180\"/>\n<rectangle x1=\"-0.225\" y1=\"-0.975\" x2=\"0.225\" y2=\"-0.3\" layer=\"31\" rot=\"R180\"/>\n</package>\n<package name=\"LUMILED+\">\n<description>&lt;b&gt;Lumileds Lighting. LUXEON®&lt;/b&gt; with cool pad&lt;p&gt;\nSource: K2.pdf</description>\n<wire x1=\"-3.575\" y1=\"2.3375\" x2=\"-2.3375\" y2=\"3.575\" width=\"0.2032\" layer=\"21\"/>\n<wire x1=\"-2.3375\" y1=\"3.575\" x2=\"2.3375\" y2=\"3.575\" width=\"0.2032\" layer=\"21\"/>\n<wire x1=\"3.575\" y1=\"2.3375\" x2=\"3.575\" y2=\"-3.575\" width=\"0.2032\" layer=\"21\"/>\n<wire x1=\"3.575\" y1=\"-3.575\" x2=\"-2.3375\" y2=\"-3.575\" width=\"0.2032\" layer=\"21\"/>\n<wire x1=\"-2.3375\" y1=\"-3.575\" x2=\"-2.5\" y2=\"-3.4125\" width=\"0.2032\" layer=\"21\"/>\n<wire x1=\"-2.5\" y1=\"-3.4125\" x2=\"-3.4125\" y2=\"-2.5\" width=\"0.2032\" layer=\"21\" curve=\"167.429893\"/>\n<wire x1=\"-3.4125\" y1=\"-2.5\" x2=\"-3.575\" y2=\"-2.3375\" width=\"0.2032\" layer=\"21\"/>\n<wire x1=\"-3.575\" y1=\"-2.3375\" x2=\"-3.575\" y2=\"2.3375\" width=\"0.2032\" layer=\"21\"/>\n<wire x1=\"2.3375\" y1=\"3.575\" x2=\"2.5\" y2=\"3.4125\" width=\"0.2032\" layer=\"21\"/>\n<wire x1=\"2.5\" y1=\"3.4125\" x2=\"3.4125\" y2=\"2.5\" width=\"0.2032\" layer=\"21\" curve=\"167.429893\"/>\n<wire x1=\"3.4125\" y1=\"2.5\" x2=\"3.575\" y2=\"2.3375\" width=\"0.2032\" layer=\"21\"/>\n<wire x1=\"-1.725\" y1=\"2.225\" x2=\"-1.0625\" y2=\"2.5625\" width=\"0.2032\" layer=\"21\" curve=\"-255.44999\"/>\n<wire x1=\"1.725\" y1=\"-2.225\" x2=\"1.0625\" y2=\"-2.5625\" width=\"0.2032\" layer=\"21\" curve=\"-255.44999\"/>\n<circle x=\"0\" y=\"0\" radius=\"2.725\" width=\"0.2032\" layer=\"51\"/>\n<smd name=\"1NC\" x=\"-5.2\" y=\"1.15\" dx=\"2.9\" dy=\"1.7\" layer=\"1\"/>\n<smd name=\"2+\" x=\"-5.2\" y=\"-1.15\" dx=\"2.9\" dy=\"1.7\" layer=\"1\"/>\n<smd name=\"3NC\" x=\"5.2\" y=\"-1.15\" dx=\"2.9\" dy=\"1.7\" layer=\"1\" rot=\"R180\"/>\n<smd name=\"4-\" x=\"5.2\" y=\"1.15\" dx=\"2.9\" dy=\"1.7\" layer=\"1\" rot=\"R180\"/>\n<text x=\"-3.175\" y=\"3.81\" size=\"1.27\" layer=\"25\">&gt;NAME</text>\n<text x=\"-3.175\" y=\"-5.08\" size=\"1.27\" layer=\"27\">&gt;VALUE</text>\n<rectangle x1=\"-5.975\" y1=\"0.575\" x2=\"-3.625\" y2=\"1.6\" layer=\"51\"/>\n<rectangle x1=\"-5.975\" y1=\"-1.6\" x2=\"-3.625\" y2=\"-0.575\" layer=\"51\"/>\n<rectangle x1=\"3.625\" y1=\"-1.6\" x2=\"5.975\" y2=\"-0.575\" layer=\"51\" rot=\"R180\"/>\n<rectangle x1=\"3.625\" y1=\"0.575\" x2=\"5.975\" y2=\"1.6\" layer=\"51\" rot=\"R180\"/>\n<polygon width=\"0.4064\" layer=\"1\">\n<vertex x=\"2.3383\" y=\"1.35\"/>\n<vertex x=\"0\" y=\"2.7\"/>\n<vertex x=\"-2.3383\" y=\"1.35\"/>\n<vertex x=\"-2.3383\" y=\"-1.35\"/>\n<vertex x=\"0\" y=\"-2.7\"/>\n<vertex x=\"2.3383\" y=\"-1.35\"/>\n</polygon>\n<polygon width=\"0.4064\" layer=\"29\">\n<vertex x=\"2.3383\" y=\"1.35\"/>\n<vertex x=\"0\" y=\"2.7\"/>\n<vertex x=\"-2.3383\" y=\"1.35\"/>\n<vertex x=\"-2.3383\" y=\"-1.35\"/>\n<vertex x=\"0\" y=\"-2.7\"/>\n<vertex x=\"2.3383\" y=\"-1.35\"/>\n</polygon>\n<polygon width=\"0.4064\" layer=\"31\">\n<vertex x=\"2.3383\" y=\"1.35\"/>\n<vertex x=\"0\" y=\"2.7\"/>\n<vertex x=\"-2.3383\" y=\"1.35\"/>\n<vertex x=\"-2.3383\" y=\"-1.35\"/>\n<vertex x=\"0\" y=\"-2.7\"/>\n<vertex x=\"2.3383\" y=\"-1.35\"/>\n</polygon>\n</package>\n<package name=\"LUMILED\">\n<description>&lt;b&gt;Lumileds Lighting. LUXEON®&lt;/b&gt; without cool pad&lt;p&gt;\nSource: K2.pdf</description>\n<wire x1=\"-3.575\" y1=\"2.3375\" x2=\"-2.3375\" y2=\"3.575\" width=\"0.2032\" layer=\"21\"/>\n<wire x1=\"-2.3375\" y1=\"3.575\" x2=\"2.3375\" y2=\"3.575\" width=\"0.2032\" layer=\"21\"/>\n<wire x1=\"3.575\" y1=\"2.3375\" x2=\"3.575\" y2=\"-3.575\" width=\"0.2032\" layer=\"21\"/>\n<wire x1=\"3.575\" y1=\"-3.575\" x2=\"-2.3375\" y2=\"-3.575\" width=\"0.2032\" layer=\"21\"/>\n<wire x1=\"-2.3375\" y1=\"-3.575\" x2=\"-2.5\" y2=\"-3.4125\" width=\"0.2032\" layer=\"21\"/>\n<wire x1=\"-2.5\" y1=\"-3.4125\" x2=\"-3.4125\" y2=\"-2.5\" width=\"0.2032\" layer=\"21\" curve=\"167.429893\"/>\n<wire x1=\"-3.4125\" y1=\"-2.5\" x2=\"-3.575\" y2=\"-2.3375\" width=\"0.2032\" layer=\"21\"/>\n<wire x1=\"-3.575\" y1=\"-2.3375\" x2=\"-3.575\" y2=\"2.3375\" width=\"0.2032\" layer=\"21\"/>\n<wire x1=\"2.3375\" y1=\"3.575\" x2=\"2.5\" y2=\"3.4125\" width=\"0.2032\" layer=\"21\"/>\n<wire x1=\"2.5\" y1=\"3.4125\" x2=\"3.4125\" y2=\"2.5\" width=\"0.2032\" layer=\"21\" curve=\"167.429893\"/>\n<wire x1=\"3.4125\" y1=\"2.5\" x2=\"3.575\" y2=\"2.3375\" width=\"0.2032\" layer=\"21\"/>\n<wire x1=\"-1.725\" y1=\"2.225\" x2=\"-1.0625\" y2=\"2.5625\" width=\"0.2032\" layer=\"21\" curve=\"-255.44999\"/>\n<wire x1=\"1.725\" y1=\"-2.225\" x2=\"1.0625\" y2=\"-2.5625\" width=\"0.2032\" layer=\"21\" curve=\"-255.44999\"/>\n<circle x=\"0\" y=\"0\" radius=\"2.725\" width=\"0.2032\" layer=\"51\"/>\n<smd name=\"1NC\" x=\"-5.2\" y=\"1.15\" dx=\"2.9\" dy=\"1.7\" layer=\"1\"/>\n<smd name=\"2+\" x=\"-5.2\" y=\"-1.15\" dx=\"2.9\" dy=\"1.7\" layer=\"1\"/>\n<smd name=\"3NC\" x=\"5.2\" y=\"-1.15\" dx=\"2.9\" dy=\"1.7\" layer=\"1\" rot=\"R180\"/>\n<smd name=\"4-\" x=\"5.2\" y=\"1.15\" dx=\"2.9\" dy=\"1.7\" layer=\"1\" rot=\"R180\"/>\n<text x=\"-3.175\" y=\"3.81\" size=\"1.27\" layer=\"25\">&gt;NAME</text>\n<text x=\"-3.175\" y=\"-5.08\" size=\"1.27\" layer=\"27\">&gt;VALUE</text>\n<rectangle x1=\"-5.975\" y1=\"0.575\" x2=\"-3.625\" y2=\"1.6\" layer=\"51\"/>\n<rectangle x1=\"-5.975\" y1=\"-1.6\" x2=\"-3.625\" y2=\"-0.575\" layer=\"51\"/>\n<rectangle x1=\"3.625\" y1=\"-1.6\" x2=\"5.975\" y2=\"-0.575\" layer=\"51\" rot=\"R180\"/>\n<rectangle x1=\"3.625\" y1=\"0.575\" x2=\"5.975\" y2=\"1.6\" layer=\"51\" rot=\"R180\"/>\n<polygon width=\"0.4064\" layer=\"29\">\n<vertex x=\"2.3383\" y=\"1.35\"/>\n<vertex x=\"0\" y=\"2.7\"/>\n<vertex x=\"-2.3383\" y=\"1.35\"/>\n<vertex x=\"-2.3383\" y=\"-1.35\"/>\n<vertex x=\"0\" y=\"-2.7\"/>\n<vertex x=\"2.3383\" y=\"-1.35\"/>\n</polygon>\n<polygon width=\"0.4064\" layer=\"31\">\n<vertex x=\"2.3383\" y=\"1.35\"/>\n<vertex x=\"0\" y=\"2.7\"/>\n<vertex x=\"-2.3383\" y=\"1.35\"/>\n<vertex x=\"-2.3383\" y=\"-1.35\"/>\n<vertex x=\"0\" y=\"-2.7\"/>\n<vertex x=\"2.3383\" y=\"-1.35\"/>\n</polygon>\n</package>\n<package name=\"LED10MM\">\n<description>&lt;B&gt;LED&lt;/B&gt;&lt;p&gt;\n10 mm, round</description>\n<wire x1=\"5.08\" y1=\"-2.54\" x2=\"5.08\" y2=\"2.54\" width=\"0.254\" layer=\"21\" curve=\"-306.869898\"/>\n<wire x1=\"4.445\" y1=\"0\" x2=\"0\" y2=\"-4.445\" width=\"0.127\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"3.81\" y1=\"0\" x2=\"0\" y2=\"-3.81\" width=\"0.127\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"3.175\" y1=\"0\" x2=\"0\" y2=\"-3.175\" width=\"0.127\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"2.54\" y1=\"0\" x2=\"0\" y2=\"-2.54\" width=\"0.127\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"-4.445\" y1=\"0\" x2=\"0\" y2=\"4.445\" width=\"0.127\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"-3.81\" y1=\"0\" x2=\"0\" y2=\"3.81\" width=\"0.127\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"-3.175\" y1=\"0\" x2=\"0\" y2=\"3.175\" width=\"0.127\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"-2.54\" y1=\"0\" x2=\"0\" y2=\"2.54\" width=\"0.127\" layer=\"21\" curve=\"-90\"/>\n<wire x1=\"5.08\" y1=\"2.54\" x2=\"5.08\" y2=\"-2.54\" width=\"0.254\" layer=\"21\"/>\n<circle x=\"0\" y=\"0\" radius=\"5.08\" width=\"0.127\" layer=\"21\"/>\n<pad name=\"K\" x=\"1.27\" y=\"0\" drill=\"0.8128\" diameter=\"1.6764\" shape=\"square\"/>\n<pad name=\"A\" x=\"-1.27\" y=\"0\" drill=\"0.8128\" diameter=\"1.6764\" shape=\"octagon\"/>\n<text x=\"6.35\" y=\"1.27\" size=\"1.27\" layer=\"25\">&gt;NAME</text>\n<text x=\"6.35\" y=\"-1.27\" size=\"1.27\" layer=\"27\">&gt;VALUE</text>\n</package>\n<package name=\"KA-3528ASYC\">\n<description>&lt;b&gt;SURFACE MOUNT LED LAMP&lt;/b&gt; 3.5x2.8mm&lt;p&gt;\nSource: http://www.kingbright.com/manager/upload/pdf/KA-3528ASYC(Ver1189474662.1)</description>\n<wire x1=\"-1.55\" y1=\"1.35\" x2=\"1.55\" y2=\"1.35\" width=\"0.1016\" layer=\"21\"/>\n<wire x1=\"1.55\" y1=\"1.35\" x2=\"1.55\" y2=\"-1.35\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"1.55\" y1=\"-1.35\" x2=\"-1.55\" y2=\"-1.35\" width=\"0.1016\" layer=\"21\"/>\n<wire x1=\"-1.55\" y1=\"-1.35\" x2=\"-1.55\" y2=\"1.35\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"-0.65\" y1=\"0.95\" x2=\"0.65\" y2=\"0.95\" width=\"0.1016\" layer=\"21\" curve=\"-68.40813\"/>\n<wire x1=\"0.65\" y1=\"-0.95\" x2=\"-0.65\" y2=\"-0.95\" width=\"0.1016\" layer=\"21\" curve=\"-68.40813\"/>\n<circle x=\"0\" y=\"0\" radius=\"1.15\" width=\"0.1016\" layer=\"51\"/>\n<smd name=\"A\" x=\"-1.55\" y=\"0\" dx=\"1.5\" dy=\"2.2\" layer=\"1\"/>\n<smd name=\"C\" x=\"1.55\" y=\"0\" dx=\"1.5\" dy=\"2.2\" layer=\"1\"/>\n<text x=\"-1.905\" y=\"1.905\" size=\"1.27\" layer=\"25\">&gt;NAME</text>\n<text x=\"-1.905\" y=\"-3.175\" size=\"1.27\" layer=\"27\">&gt;VALUE</text>\n<rectangle x1=\"-1.75\" y1=\"0.6\" x2=\"-1.6\" y2=\"1.1\" layer=\"51\"/>\n<rectangle x1=\"-1.75\" y1=\"-1.1\" x2=\"-1.6\" y2=\"-0.6\" layer=\"51\"/>\n<rectangle x1=\"1.6\" y1=\"-1.1\" x2=\"1.75\" y2=\"-0.6\" layer=\"51\" rot=\"R180\"/>\n<rectangle x1=\"1.6\" y1=\"0.6\" x2=\"1.75\" y2=\"1.1\" layer=\"51\" rot=\"R180\"/>\n<polygon width=\"0.1016\" layer=\"51\">\n<vertex x=\"1.55\" y=\"-1.35\"/>\n<vertex x=\"1.55\" y=\"-0.625\"/>\n<vertex x=\"0.825\" y=\"-1.35\"/>\n</polygon>\n<polygon width=\"0.1016\" layer=\"21\">\n<vertex x=\"1.55\" y=\"-1.35\"/>\n<vertex x=\"1.55\" y=\"-1.175\"/>\n<vertex x=\"1\" y=\"-1.175\"/>\n<vertex x=\"0.825\" y=\"-1.35\"/>\n</polygon>\n</package>\n<package name=\"SML0805\">\n<description>&lt;b&gt;SML0805-2CW-TR (0805 PROFILE)&lt;/b&gt; COOL WHITE&lt;p&gt;\nSource: http://www.ledtronics.com/ds/smd-0603/Dstr0093.pdf</description>\n<wire x1=\"-0.95\" y1=\"-0.55\" x2=\"0.95\" y2=\"-0.55\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"0.95\" y1=\"-0.55\" x2=\"0.95\" y2=\"0.55\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"0.95\" y1=\"0.55\" x2=\"-0.95\" y2=\"0.55\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"-0.95\" y1=\"0.55\" x2=\"-0.95\" y2=\"-0.55\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"-0.175\" y1=\"-0.025\" x2=\"0\" y2=\"0.15\" width=\"0.0634\" layer=\"21\"/>\n<wire x1=\"0\" y1=\"0.15\" x2=\"0.15\" y2=\"0\" width=\"0.0634\" layer=\"21\"/>\n<wire x1=\"0.15\" y1=\"0\" x2=\"-0.025\" y2=\"-0.175\" width=\"0.0634\" layer=\"21\"/>\n<wire x1=\"-0.025\" y1=\"-0.175\" x2=\"-0.175\" y2=\"-0.025\" width=\"0.0634\" layer=\"21\"/>\n<circle x=\"-0.275\" y=\"0.4\" radius=\"0.125\" width=\"0\" layer=\"21\"/>\n<smd name=\"C\" x=\"-1.05\" y=\"0\" dx=\"1.2\" dy=\"1.2\" layer=\"1\"/>\n<smd name=\"A\" x=\"1.05\" y=\"0\" dx=\"1.2\" dy=\"1.2\" layer=\"1\"/>\n<text x=\"-1.5\" y=\"1\" size=\"1.27\" layer=\"25\">&gt;NAME</text>\n<text x=\"-1.5\" y=\"-2\" size=\"1.27\" layer=\"27\">&gt;VALUE</text>\n</package>\n<package name=\"SML1206\">\n<description>&lt;b&gt;SML10XXKH-TR (HIGH INTENSITY) LED&lt;/b&gt;&lt;p&gt;\n&lt;table&gt;\n&lt;tr&gt;&lt;td&gt;SML10R3KH-TR&lt;/td&gt;&lt;td&gt;ULTRA RED&lt;/td&gt;&lt;/tr&gt;\n&lt;tr&gt;&lt;td&gt;SML10E3KH-TR&lt;/td&gt;&lt;td&gt;SUPER REDSUPER BLUE&lt;/td&gt;&lt;/tr&gt;\n&lt;tr&gt;&lt;td&gt;SML10O3KH-TR&lt;/td&gt;&lt;td&gt;SUPER ORANGE&lt;/td&gt;&lt;/tr&gt;\n&lt;tr&gt;&lt;td&gt;SML10PY3KH-TR&lt;/td&gt;&lt;td&gt;PURE YELLOW&lt;/td&gt;&lt;/tr&gt;\n&lt;tr&gt;&lt;td&gt;SML10OY3KH-TR&lt;/td&gt;&lt;td&gt;ULTRA YELLOW&lt;/td&gt;&lt;/tr&gt;\n&lt;tr&gt;&lt;td&gt;SML10AG3KH-TR&lt;/td&gt;&lt;td&gt;AQUA GREEN&lt;/td&gt;&lt;/tr&gt;\n&lt;tr&gt;&lt;td&gt;SML10BG3KH-TR&lt;/td&gt;&lt;td&gt;BLUE GREEN&lt;/td&gt;&lt;/tr&gt;\n&lt;tr&gt;&lt;td&gt;SML10PB1KH-TR&lt;/td&gt;&lt;td&gt;SUPER BLUE&lt;/td&gt;&lt;/tr&gt;\n&lt;tr&gt;&lt;td&gt;SML10CW1KH-TR&lt;/td&gt;&lt;td&gt;WHITE&lt;/td&gt;&lt;/tr&gt;\n&lt;/table&gt;\n\nSource: http://www.ledtronics.com/ds/smd-1206/dstr0094.PDF</description>\n<wire x1=\"-1.5\" y1=\"0.5\" x2=\"-1.5\" y2=\"-0.5\" width=\"0.2032\" layer=\"51\" curve=\"-180\"/>\n<wire x1=\"1.5\" y1=\"-0.5\" x2=\"1.5\" y2=\"0.5\" width=\"0.2032\" layer=\"51\" curve=\"-180\"/>\n<wire x1=\"-1.55\" y1=\"0.75\" x2=\"1.55\" y2=\"0.75\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"1.55\" y1=\"-0.75\" x2=\"-1.55\" y2=\"-0.75\" width=\"0.1016\" layer=\"51\"/>\n<circle x=\"-0.725\" y=\"0.525\" radius=\"0.125\" width=\"0\" layer=\"21\"/>\n<smd name=\"C\" x=\"-1.75\" y=\"0\" dx=\"1.5\" dy=\"1.5\" layer=\"1\"/>\n<smd name=\"A\" x=\"1.75\" y=\"0\" dx=\"1.5\" dy=\"1.5\" layer=\"1\"/>\n<text x=\"-1.5\" y=\"1\" size=\"1.27\" layer=\"25\">&gt;NAME</text>\n<text x=\"-1.5\" y=\"-2.5\" size=\"1.27\" layer=\"27\">&gt;VALUE</text>\n<rectangle x1=\"-1.6\" y1=\"0.4\" x2=\"-1.15\" y2=\"0.8\" layer=\"51\"/>\n<rectangle x1=\"-1.6\" y1=\"-0.8\" x2=\"-1.15\" y2=\"-0.4\" layer=\"51\"/>\n<rectangle x1=\"-1.175\" y1=\"-0.6\" x2=\"-1\" y2=\"-0.275\" layer=\"51\"/>\n<rectangle x1=\"1.15\" y1=\"-0.8\" x2=\"1.6\" y2=\"-0.4\" layer=\"51\" rot=\"R180\"/>\n<rectangle x1=\"1.15\" y1=\"0.4\" x2=\"1.6\" y2=\"0.8\" layer=\"51\" rot=\"R180\"/>\n<rectangle x1=\"1\" y1=\"0.275\" x2=\"1.175\" y2=\"0.6\" layer=\"51\" rot=\"R180\"/>\n<rectangle x1=\"-0.1\" y1=\"-0.1\" x2=\"0.1\" y2=\"0.1\" layer=\"21\"/>\n</package>\n<package name=\"SML0603\">\n<description>&lt;b&gt;SML0603-XXX (HIGH INTENSITY) LED&lt;/b&gt;&lt;p&gt;\n&lt;table&gt;\n&lt;tr&gt;&lt;td&gt;AG3K&lt;/td&gt;&lt;td&gt;AQUA GREEN&lt;/td&gt;&lt;/tr&gt;\n&lt;tr&gt;&lt;td&gt;B1K&lt;/td&gt;&lt;td&gt;SUPER BLUE&lt;/td&gt;&lt;/tr&gt;\n&lt;tr&gt;&lt;td&gt;R1K&lt;/td&gt;&lt;td&gt;SUPER RED&lt;/td&gt;&lt;/tr&gt;\n&lt;tr&gt;&lt;td&gt;R3K&lt;/td&gt;&lt;td&gt;ULTRA RED&lt;/td&gt;&lt;/tr&gt;\n&lt;tr&gt;&lt;td&gt;O3K&lt;/td&gt;&lt;td&gt;SUPER ORANGE&lt;/td&gt;&lt;/tr&gt;\n&lt;tr&gt;&lt;td&gt;O3KH&lt;/td&gt;&lt;td&gt;SOFT ORANGE&lt;/td&gt;&lt;/tr&gt;\n&lt;tr&gt;&lt;td&gt;Y3KH&lt;/td&gt;&lt;td&gt;SUPER YELLOW&lt;/td&gt;&lt;/tr&gt;\n&lt;tr&gt;&lt;td&gt;Y3K&lt;/td&gt;&lt;td&gt;SUPER YELLOW&lt;/td&gt;&lt;/tr&gt;\n&lt;tr&gt;&lt;td&gt;2CW&lt;/td&gt;&lt;td&gt;WHITE&lt;/td&gt;&lt;/tr&gt;\n&lt;/table&gt;\nSource: http://www.ledtronics.com/ds/smd-0603/Dstr0092.pdf</description>\n<wire x1=\"-0.75\" y1=\"0.35\" x2=\"0.75\" y2=\"0.35\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"0.75\" y1=\"0.35\" x2=\"0.75\" y2=\"-0.35\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"0.75\" y1=\"-0.35\" x2=\"-0.75\" y2=\"-0.35\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"-0.75\" y1=\"-0.35\" x2=\"-0.75\" y2=\"0.35\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"-0.45\" y1=\"0.3\" x2=\"-0.45\" y2=\"-0.3\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"0.45\" y1=\"0.3\" x2=\"0.45\" y2=\"-0.3\" width=\"0.1016\" layer=\"51\"/>\n<wire x1=\"-0.2\" y1=\"0.35\" x2=\"0.2\" y2=\"0.35\" width=\"0.1016\" layer=\"21\"/>\n<wire x1=\"-0.2\" y1=\"-0.35\" x2=\"0.2\" y2=\"-0.35\" width=\"0.1016\" layer=\"21\"/>\n<smd name=\"C\" x=\"-0.75\" y=\"0\" dx=\"0.8\" dy=\"0.8\" layer=\"1\"/>\n<smd name=\"A\" x=\"0.75\" y=\"0\" dx=\"0.8\" dy=\"0.8\" layer=\"1\"/>\n<text x=\"-1\" y=\"1\" size=\"1.27\" layer=\"25\">&gt;NAME</text>\n<text x=\"-1\" y=\"-2\" size=\"1.27\" layer=\"27\">&gt;VALUE</text>\n<rectangle x1=\"-0.4\" y1=\"0.175\" x2=\"0\" y2=\"0.4\" layer=\"51\"/>\n<rectangle x1=\"-0.25\" y1=\"0.175\" x2=\"0\" y2=\"0.4\" layer=\"21\"/>\n</package>\n</packages>\n<symbols>\n<symbol name=\"LED\">\n<wire x1=\"1.27\" y1=\"0\" x2=\"0\" y2=\"-2.54\" width=\"0.254\" layer=\"94\"/>\n<wire x1=\"0\" y1=\"-2.54\" x2=\"-1.27\" y2=\"0\" width=\"0.254\" layer=\"94\"/>\n<wire x1=\"1.27\" y1=\"-2.54\" x2=\"0\" y2=\"-2.54\" width=\"0.254\" layer=\"94\"/>\n<wire x1=\"0\" y1=\"-2.54\" x2=\"-1.27\" y2=\"-2.54\" width=\"0.254\" layer=\"94\"/>\n<wire x1=\"1.27\" y1=\"0\" x2=\"0\" y2=\"0\" width=\"0.254\" layer=\"94\"/>\n<wire x1=\"0\" y1=\"0\" x2=\"-1.27\" y2=\"0\" width=\"0.254\" layer=\"94\"/>\n<wire x1=\"0\" y1=\"0\" x2=\"0\" y2=\"-2.54\" width=\"0.1524\" layer=\"94\"/>\n<wire x1=\"-2.032\" y1=\"-0.762\" x2=\"-3.429\" y2=\"-2.159\" width=\"0.1524\" layer=\"94\"/>\n<wire x1=\"-1.905\" y1=\"-1.905\" x2=\"-3.302\" y2=\"-3.302\" width=\"0.1524\" layer=\"94\"/>\n<text x=\"3.556\" y=\"-4.572\" size=\"1.778\" layer=\"95\" rot=\"R90\">&gt;NAME</text>\n<text x=\"5.715\" y=\"-4.572\" size=\"1.778\" layer=\"96\" rot=\"R90\">&gt;VALUE</text>\n<pin name=\"C\" x=\"0\" y=\"-5.08\" visible=\"off\" length=\"short\" direction=\"pas\" rot=\"R90\"/>\n<pin name=\"A\" x=\"0\" y=\"2.54\" visible=\"off\" length=\"short\" direction=\"pas\" rot=\"R270\"/>\n<polygon width=\"0.1524\" layer=\"94\">\n<vertex x=\"-3.429\" y=\"-2.159\"/>\n<vertex x=\"-3.048\" y=\"-1.27\"/>\n<vertex x=\"-2.54\" y=\"-1.778\"/>\n</polygon>\n<polygon width=\"0.1524\" layer=\"94\">\n<vertex x=\"-3.302\" y=\"-3.302\"/>\n<vertex x=\"-2.921\" y=\"-2.413\"/>\n<vertex x=\"-2.413\" y=\"-2.921\"/>\n</polygon>\n</symbol>\n</symbols>\n<devicesets>\n<deviceset name=\"LED\" prefix=\"LED\" uservalue=\"yes\">\n<description>&lt;b&gt;LED&lt;/b&gt;&lt;p&gt;\n&lt;u&gt;OSRAM&lt;/u&gt;:&lt;br&gt;\n\n- &lt;u&gt;CHIPLED&lt;/u&gt;&lt;br&gt;\nLG R971, LG N971, LY N971, LG Q971, LY Q971, LO R971, LY R971\nLH N974, LH R974&lt;br&gt;\nLS Q976, LO Q976, LY Q976&lt;br&gt;\nLO Q996&lt;br&gt;\n\n- &lt;u&gt;Hyper CHIPLED&lt;/u&gt;&lt;br&gt;\nLW Q18S&lt;br&gt;\nLB Q993, LB Q99A, LB R99A&lt;br&gt;\n\n- &lt;u&gt;SideLED&lt;/u&gt;&lt;br&gt;\nLS A670, LO A670, LY A670, LG A670, LP A670&lt;br&gt;\nLB A673, LV A673, LT A673, LW A673&lt;br&gt;\nLH A674&lt;br&gt;\nLY A675&lt;br&gt;\nLS A676, LA A676, LO A676, LY A676, LW A676&lt;br&gt;\nLS A679, LY A679, LG A679&lt;br&gt;\n\n-  &lt;u&gt;Hyper Micro SIDELED®&lt;/u&gt;&lt;br&gt;\nLS Y876, LA Y876, LO Y876, LY Y876&lt;br&gt;\nLT Y87S&lt;br&gt;\n\n- &lt;u&gt;SmartLED&lt;/u&gt;&lt;br&gt;\nLW L88C, LW L88S&lt;br&gt;\nLB L89C, LB L89S, LG L890&lt;br&gt;\nLS L89K, LO L89K, LY L89K&lt;br&gt;\nLS L896, LA L896, LO L896, LY L896&lt;br&gt;\n\n- &lt;u&gt;TOPLED&lt;/u&gt;&lt;br&gt;\nLS T670, LO T670, LY T670, LG T670, LP T670&lt;br&gt;\nLSG T670, LSP T670, LSY T670, LOP T670, LYG T670&lt;br&gt;\nLG T671, LOG T671, LSG T671&lt;br&gt;\nLB T673, LV T673, LT T673, LW T673&lt;br&gt;\nLH T674&lt;br&gt;\nLS T676, LA T676, LO T676, LY T676, LB T676, LH T676, LSB T676, LW T676&lt;br&gt;\nLB T67C, LV T67C, LT T67C, LS T67K, LO T67K, LY T67K, LW E67C&lt;br&gt;\nLS E67B, LA E67B, LO E67B, LY E67B, LB E67C, LV E67C, LT E67C&lt;br&gt;\nLW T67C&lt;br&gt;\nLS T679, LY T679, LG T679&lt;br&gt;\nLS T770, LO T770, LY T770, LG T770, LP T770&lt;br&gt;\nLB T773, LV T773, LT T773, LW T773&lt;br&gt;\nLH T774&lt;br&gt;\nLS E675, LA E675, LY E675, LS T675&lt;br&gt;\nLS T776, LA T776, LO T776, LY T776, LB T776&lt;br&gt;\nLHGB T686&lt;br&gt;\nLT T68C, LB T68C&lt;br&gt;\n\n- &lt;u&gt;Hyper Mini TOPLED®&lt;/u&gt;&lt;br&gt;\nLB M676&lt;br&gt;\n\n- &lt;u&gt;Mini TOPLED Santana®&lt;/u&gt;&lt;br&gt;\nLG M470&lt;br&gt;\nLS M47K, LO M47K, LY M47K\n&lt;p&gt;\nSource: http://www.osram.convergy.de&lt;p&gt;\n\n&lt;u&gt;LUXEON:&lt;/u&gt;&lt;br&gt;\n- &lt;u&gt;LUMILED®&lt;/u&gt;&lt;br&gt;\nLXK2-PW12-R00, LXK2-PW12-S00, LXK2-PW14-U00, LXK2-PW14-V00&lt;br&gt;\nLXK2-PM12-R00, LXK2-PM12-S00, LXK2-PM14-U00&lt;br&gt;\nLXK2-PE12-Q00, LXK2-PE12-R00, LXK2-PE12-S00, LXK2-PE14-T00, LXK2-PE14-U00&lt;br&gt;\nLXK2-PB12-K00, LXK2-PB12-L00, LXK2-PB12-M00, LXK2-PB14-N00, LXK2-PB14-P00, LXK2-PB14-Q00&lt;br&gt;\nLXK2-PR12-L00, LXK2-PR12-M00, LXK2-PR14-Q00, LXK2-PR14-R00&lt;br&gt;\nLXK2-PD12-Q00, LXK2-PD12-R00, LXK2-PD12-S00&lt;br&gt;\nLXK2-PH12-R00, LXK2-PH12-S00&lt;br&gt;\nLXK2-PL12-P00, LXK2-PL12-Q00, LXK2-PL12-R00\n&lt;p&gt;\nSource: www.luxeon.com&lt;p&gt;\n\n&lt;u&gt;KINGBRIGHT:&lt;/U&gt;&lt;p&gt;\nKA-3528ASYC&lt;br&gt;\nSource: www.kingbright.com</description>\n<gates>\n<gate name=\"G$1\" symbol=\"LED\" x=\"0\" y=\"0\"/>\n</gates>\n<devices>\n<device name=\"SMT1206\" package=\"1206\">\n<connects>\n<connect gate=\"G$1\" pin=\"A\" pad=\"A\"/>\n<connect gate=\"G$1\" pin=\"C\" pad=\"C\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"LD260\" package=\"LD260\">\n<connects>\n<connect gate=\"G$1\" pin=\"A\" pad=\"A\"/>\n<connect gate=\"G$1\" pin=\"C\" pad=\"K\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"SQR2X5\" package=\"LED2X5\">\n<connects>\n<connect gate=\"G$1\" pin=\"A\" pad=\"A\"/>\n<connect gate=\"G$1\" pin=\"C\" pad=\"K\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"3MM\" package=\"LED3MM\">\n<connects>\n<connect gate=\"G$1\" pin=\"A\" pad=\"A\"/>\n<connect gate=\"G$1\" pin=\"C\" pad=\"K\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"5MM\" package=\"LED5MM\">\n<connects>\n<connect gate=\"G$1\" pin=\"A\" pad=\"A\"/>\n<connect gate=\"G$1\" pin=\"C\" pad=\"K\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"LSU260\" package=\"LSU260\">\n<connects>\n<connect gate=\"G$1\" pin=\"A\" pad=\"A\"/>\n<connect gate=\"G$1\" pin=\"C\" pad=\"K\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"LZR181\" package=\"LZR181\">\n<connects>\n<connect gate=\"G$1\" pin=\"A\" pad=\"A\"/>\n<connect gate=\"G$1\" pin=\"C\" pad=\"K\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"B152\" package=\"Q62902-B152\">\n<connects>\n<connect gate=\"G$1\" pin=\"A\" pad=\"A\"/>\n<connect gate=\"G$1\" pin=\"C\" pad=\"K\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"B153\" package=\"Q62902-B153\">\n<connects>\n<connect gate=\"G$1\" pin=\"A\" pad=\"A\"/>\n<connect gate=\"G$1\" pin=\"C\" pad=\"K\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"B155\" package=\"Q62902-B155\">\n<connects>\n<connect gate=\"G$1\" pin=\"A\" pad=\"A\"/>\n<connect gate=\"G$1\" pin=\"C\" pad=\"K\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"B156\" package=\"Q62902-B156\">\n<connects>\n<connect gate=\"G$1\" pin=\"A\" pad=\"A\"/>\n<connect gate=\"G$1\" pin=\"C\" pad=\"K\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"SFH480\" package=\"SFH480\">\n<connects>\n<connect gate=\"G$1\" pin=\"A\" pad=\"A\"/>\n<connect gate=\"G$1\" pin=\"C\" pad=\"K\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"SFH482\" package=\"SFH482\">\n<connects>\n<connect gate=\"G$1\" pin=\"A\" pad=\"A\"/>\n<connect gate=\"G$1\" pin=\"C\" pad=\"K\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"SQR5.7X3.2\" package=\"U57X32\">\n<connects>\n<connect gate=\"G$1\" pin=\"A\" pad=\"A\"/>\n<connect gate=\"G$1\" pin=\"C\" pad=\"K\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"IRL80A\" package=\"IRL80A\">\n<connects>\n<connect gate=\"G$1\" pin=\"A\" pad=\"A\"/>\n<connect gate=\"G$1\" pin=\"C\" pad=\"K\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"P-LCC-2\" package=\"P-LCC-2\">\n<connects>\n<connect gate=\"G$1\" pin=\"A\" pad=\"A\"/>\n<connect gate=\"G$1\" pin=\"C\" pad=\"C\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"MINI-TOP\" package=\"OSRAM-MINI-TOP-LED\">\n<connects>\n<connect gate=\"G$1\" pin=\"A\" pad=\"A\"/>\n<connect gate=\"G$1\" pin=\"C\" pad=\"C\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"SIDELED\" package=\"OSRAM-SIDELED\">\n<connects>\n<connect gate=\"G$1\" pin=\"A\" pad=\"A\"/>\n<connect gate=\"G$1\" pin=\"C\" pad=\"C\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"SMART-LED\" package=\"SMART-LED\">\n<connects>\n<connect gate=\"G$1\" pin=\"A\" pad=\"A\"/>\n<connect gate=\"G$1\" pin=\"C\" pad=\"B\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"P-LCC-2-BACK\" package=\"P-LCC-2-TOPLED-RG\">\n<connects>\n<connect gate=\"G$1\" pin=\"A\" pad=\"A\"/>\n<connect gate=\"G$1\" pin=\"C\" pad=\"C\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"MICRO-SIDELED\" package=\"MICRO-SIDELED\">\n<connects>\n<connect gate=\"G$1\" pin=\"A\" pad=\"A\"/>\n<connect gate=\"G$1\" pin=\"C\" pad=\"C\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"P-LCC-4\" package=\"P-LCC-4\">\n<connects>\n<connect gate=\"G$1\" pin=\"A\" pad=\"A\"/>\n<connect gate=\"G$1\" pin=\"C\" pad=\"C@4\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"CHIP-LED0603\" package=\"CHIP-LED0603\">\n<connects>\n<connect gate=\"G$1\" pin=\"A\" pad=\"A\"/>\n<connect gate=\"G$1\" pin=\"C\" pad=\"C\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"CHIP-LED0805\" package=\"CHIP-LED0805\">\n<connects>\n<connect gate=\"G$1\" pin=\"A\" pad=\"A\"/>\n<connect gate=\"G$1\" pin=\"C\" pad=\"C\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"TOPLED-SANTANA\" package=\"MINI-TOPLED-SANTANA\">\n<connects>\n<connect gate=\"G$1\" pin=\"A\" pad=\"A\"/>\n<connect gate=\"G$1\" pin=\"C\" pad=\"C\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"CHIPLED_0805\" package=\"CHIPLED_0805\">\n<connects>\n<connect gate=\"G$1\" pin=\"A\" pad=\"A\"/>\n<connect gate=\"G$1\" pin=\"C\" pad=\"C\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"CHIPLED_1206\" package=\"CHIPLED_1206\">\n<connects>\n<connect gate=\"G$1\" pin=\"A\" pad=\"A\"/>\n<connect gate=\"G$1\" pin=\"C\" pad=\"C\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"CHIPLED_0603\" package=\"CHIPLED_0603\">\n<connects>\n<connect gate=\"G$1\" pin=\"A\" pad=\"A\"/>\n<connect gate=\"G$1\" pin=\"C\" pad=\"C\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"CHIPLED-0603-TTW\" package=\"CHIPLED-0603-TTW\">\n<connects>\n<connect gate=\"G$1\" pin=\"A\" pad=\"A@1\"/>\n<connect gate=\"G$1\" pin=\"C\" pad=\"C@1\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"\" package=\"SMARTLED-TTW\">\n<connects>\n<connect gate=\"G$1\" pin=\"A\" pad=\"A@1\"/>\n<connect gate=\"G$1\" pin=\"C\" pad=\"C@1\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"-LUMILED+\" package=\"LUMILED+\">\n<connects>\n<connect gate=\"G$1\" pin=\"A\" pad=\"2+\"/>\n<connect gate=\"G$1\" pin=\"C\" pad=\"4-\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"-LUMILED\" package=\"LUMILED\">\n<connects>\n<connect gate=\"G$1\" pin=\"A\" pad=\"2+\"/>\n<connect gate=\"G$1\" pin=\"C\" pad=\"4-\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"10MM\" package=\"LED10MM\">\n<connects>\n<connect gate=\"G$1\" pin=\"A\" pad=\"A\"/>\n<connect gate=\"G$1\" pin=\"C\" pad=\"K\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"KA-3528ASYC\" package=\"KA-3528ASYC\">\n<connects>\n<connect gate=\"G$1\" pin=\"A\" pad=\"A\"/>\n<connect gate=\"G$1\" pin=\"C\" pad=\"C\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"SML0805\" package=\"SML0805\">\n<connects>\n<connect gate=\"G$1\" pin=\"A\" pad=\"A\"/>\n<connect gate=\"G$1\" pin=\"C\" pad=\"C\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"SML1206\" package=\"SML1206\">\n<connects>\n<connect gate=\"G$1\" pin=\"A\" pad=\"A\"/>\n<connect gate=\"G$1\" pin=\"C\" pad=\"C\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n<device name=\"SML0603\" package=\"SML0603\">\n<connects>\n<connect gate=\"G$1\" pin=\"A\" pad=\"A\"/>\n<connect gate=\"G$1\" pin=\"C\" pad=\"C\"/>\n</connects>\n<technologies>\n<technology name=\"\"/>\n</technologies>\n</device>\n</devices>\n</deviceset>\n</devicesets>\n</library>\n<library name=\"ptc-ntc\">\n<description>&lt;b&gt;PTC and NTC Resistors&lt;/b&gt;&lt;p&gt;\nSiemens, Philips, Valvo&lt;p&gt;\n&lt;author&gt;Created by librarian@cadsoft.de&lt;/author&gt;</description>\n<packages>\n<package name=\"P640\">\n<description>&lt;b&gt;PHILIPS NTC&lt;/b&gt;</description>\n<wire x1=\"-0.635\" y1=\"-0.7931\" x2=\"0.635\" y2=\"-0.7931\" width=\"0.1524\" layer=\"21\" curve=\"77.365414\"/>\n<wire x1=\"-0.635\" y1=\"0.7931\" x2=\"0.635\" y2=\"0.7931\" width=\"0.1524\" layer=\"21\" curve=\"-77.365414\"/>\n<wire x1=\"-0.8255\" y1=\"1.127\" x2=\"0.8255\" y2=\"1.127\" width=\"0.1524\" layer=\"21\" curve=\"-72.443733\"/>\n<wire x1=\"-0.8255\" y1=\"-1.127\" x2=\"0.8255\" y2=\"-1.127\" width=\"0.1524\" layer=\"21\" curve=\"72.443733\"/>\n<wire x1=\"-1.1684\" y1=\"1.0109\" x2=\"-1.1684\" y2=\"-1.0109\" width=\"0.1524\" layer=\"51\" curve=\"124.363383\"/>\n<wire x1=\"-0.635\" y1=\"0.7931\" x2=\"-0.635\" y2=\"-0.7931\" width=\"0.1524\" layer=\"51\" curve=\"102.634586\"/>\n<wire x1=\"-1.1684\" y1=\"-1.0109\" x2=\"-0.8255\" y2=\"-1.127\" width=\"0.1524\" layer=\"21\" curve=\"18.224242\"/>\n<wire x1=\"-1.1684\" y1=\"1.0109\" x2=\"-0.8255\" y2=\"1.127\" width=\"0.1524\" layer=\"21\" curve=\"-18.224242\"/>\n<wire x1=\"0.635\" y1=\"-0.7931\" x2=\"0.635\" y2=\"0.7931\" width=\"0.1524\" layer=\"51\" curve=\"102.634586\"/>\n<wire x1=\"1.1684\" y1=\"-1.0109\" x2=\"1.1684\" y2=\"1.0109\" width=\"0.1524\" layer=\"51\" curve=\"124.363383\"/>\n<wire x1=\"0.8255\" y1=\"-1.127\" x2=\"1.1684\" y2=\"-1.0109\" width=\"0.1524\" layer=\"21\" curve=\"18.224242\"/>\n<wire x1=\"0.8255\" y1=\"1.127\" x2=\"1.1684\" y2=\"1.0109\" width=\"0.1524\" layer=\"21\" curve=\"-18.224242\"/>\n<pad name=\"1\" x=\"-1.27\" y=\"0\" drill=\"0.8128\" shape=\"long\" rot=\"R90\"/>\n<pad name=\"2\" x=\"1.27\" y=\"0\" drill=\"0.8128\" shape=\"long\" rot=\"R90\"/>\n<text x=\"-2.54\" y=\"1.905\" size=\"1.27\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-2.54\" y=\"-3.175\" size=\"1.27\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n</package>\n<package name=\"P642\">\n<description>&lt;b&gt;PHILIPS/VALVO NTC&lt;/b&gt;</description>\n<wire x1=\"-1.524\" y1=\"-1.27\" x2=\"1.524\" y2=\"-1.27\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"1.524\" y1=\"1.27\" x2=\"-1.524\" y2=\"1.27\" width=\"0.1524\" layer=\"21\"/>\n<wire x1=\"-1.524\" y1=\"-1.27\" x2=\"-1.524\" y2=\"1.27\" width=\"0.1524\" layer=\"21\" curve=\"-180\"/>\n<wire x1=\"1.524\" y1=\"-1.27\" x2=\"1.524\" y2=\"1.27\" width=\"0.1524\" layer=\"21\" curve=\"180\"/>\n<wire x1=\"-1.27\" y1=\"1.27\" x2=\"1.289\" y2=\"1.2556\" width=\"0.1524\" layer=\"21\" curve=\"-74.108925\"/>\n<wire x1=\"-1.289\" y1=\"-1.2556\" x2=\"1.27\" y2=\"-1.27\" width=\"0.1524\" layer=\"21\" curve=\"74.108925\"/>\n<wire x1=\"-1.905\" y1=\"-0.508\" x2=\"1.905\" y2=\"-0.508\" width=\"0.1524\" layer=\"51\"/>\n<wire x1=\"-1.905\" y1=\"0.508\" x2=\"1.905\" y2=\"0.508\" width=\"0.1524\" layer=\"51\"/>\n<pad name=\"1\" x=\"-1.27\" y=\"0\" drill=\"0.8128\" shape=\"long\" rot=\"R90\"/>\n<pad name=\"2\" x=\"1.27\" y=\"0\" drill=\"0.8128\" shape=\"long\" rot=\"R90\"/>\n<text x=\"-2.286\" y=\"2.032\" size=\"1.27\" layer=\"25\" ratio=\"10\">&gt;NAME</text>\n<text x=\"-2.54\" y=\"-3.429\" size=\"1.27\" layer=\"27\" ratio=\"10\">&gt;VALUE</text>\n</package>\n</packages>\n<symbols>\n<symbol name=\"NTC\">\n<wire x1=\"3.175\" y1=\"6.35\" x2=\"3.175\" y2=\"3.81\" width=\"0.1524\" layer=\"94\"/>\n<wire x1=\"3.175\" y1=\"3.81\" x2=\"3.556\" y2=\"5.08\" width=\"0.1524\" layer=\"94\"/>\n<wire x1=\"3.556\" y1=\"5.08\" x2=\"2.794\" y2=\"5.08\" width=\"0.1524\" layer=\"94\"/>\n<wire x1=\"2.794\" y1=\"5.08\" x2=\"3.175\" y2=\"3.81\" width=\"0.1524\" layer=\"94\"/>\n<wire x1=\"1.905\" y1=\"3.81\" x2=\"1.905\" y2=\"6.35\" width=\"0.1524\" layer=\"94\"/>\n<wire x1=\"1.905\" y1=\"6.35\" x2=\"2.286\" y2=\"5.08\" width=\"0.1524\" layer=\"94\"/>\n<wire x1=\"2.286\" y1=\"5.08\" x2=\"1.524\" y2=\"5.08\" width=\"0.1524\" layer=\"94\"/>\n<wire x1=\"1.524\" y1=\"5.08\" x2=\"1.905\" y2=\"6.35\" width=\"0.1524\" layer=\"94\"/>\n<wire x1=\"2.413\" y1=\"0.381\" x2=\"3.937\" y2=\"0.381\" width=\"0.1524\" layer=\"94\" curve=\"180\"/>\n<wire x1=\"1.905\" y1=\"0.635\" x2=\"2.413\" y2=\"0.635\" width=\"0.1524\" layer=\"94\" curve=\"-180\" cap=\"flat\"/>\n<wire x1=\"2.413\" y1=\"0.381\" x2=\"2.413\" y2=\"0.635\" width=\"0.1524\" layer=\"94\"/>\n<wire x1=\"3.937\" y1=\"0.381\" x2=\"3.937\" y2=\"1.651\" width=\"0.1524\" layer=\"94\"/>\n<wire x1=\"3.429\" y1=\"1.143\" x2=\"3.937\" y2=\"1.651\" width=\"0.1524\" layer=\"94\" curve=\"-270\"/>\n<wire x1=\"4.191\" y1=\"1.143\" x2=\"4.3047\" y2=\"0.9591\" width=\"0.1524\" layer=\"94\" curve=\"-116.545417\" cap=\"flat\"/>\n<wire x1=\"3.429\" y1=\"1.143\" x2=\"4.191\" y2=\"1.143\" width=\"0.1524\" layer=\"94\"/>\n<wire x1=\"0.889\" y1=\"-2.54\" x2=\"0.889\" y2=\"2.54\" width=\"0.254\" layer=\"94\"/>\n<wire x1=\"-0.889\" y1=\"2.54\" x2=\"-0.889\" y2=\"-2.54\" width=\"0.254\" layer=\"94\"/>\n<wire x1=\"0.889\" y1=\"2.54\" x2=\"-0.889\" y2=\"2.54\" width=\"0.254\" layer=\"94\"/>\n<wire x1=\"0.889\" y1=\"-2.54\" x2=\"-0.889\" y2=\"-2.54\" width=\"0.254\" layer=\"94\"/>\n<wire x1=\"1.524\" y1=\"1.524\" x2=\"-1.778\" y2=\"-1.778\" width=\"0.1524\" layer=\"94\"/>\n<wire x1=\"-1.778\" y1=\"-1.778\" x2=\"-1.778\" y2=\"-2.54\" width=\"0.1524\" layer=\"94\"/>\n<wire x1=\"-2.921\" y1=\"-3.048\" x2=\"-1.651\" y2=\"-3.048\" width=\"0.1524\" layer=\"94\"/>\n<text x=\"2.032\" y=\"-2.8194\" size=\"1.778\" layer=\"95\">&gt;NAME</text>\n<text x=\"2.032\" y=\"-5.207\" size=\"1.778\" layer=\"96\">&gt;VALUE</text>\n<pin name=\"2\" x=\"0\" y=\"5.08\" visible=\"off\" length=\"short\" direction=\"pas\" swaplevel=\"1\" rot=\"R270\"/>\n<pin name=\"1\" x=\"0\" y=\"-5.08\" visible=\"off\" length=\"short\" direction=\"pas\" swaplevel=\"1\" rot=\"R90\"/>\n</symbol>\n</symbols>\n<devicesets>\n<deviceset name=\"NTC640\" prefix=\"R\" uservalue=\"yes\">\n<description>&lt;b&gt;PHILIPS NTC&lt;/b&gt;</description>\n<gates>\n<gate name=\"1\" symbol=\"NTC\" x=\"0\" y=\"0\"/>\n</gates>\n<devices>\n<device name=\"\" package=\"P640\">\n<connects>\n<connect gate=\"1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\">\n<attribute name=\"MF\" value=\"\" constant=\"no\"/>\n<attribute name=\"MPN\" value=\"\" constant=\"no\"/>\n<attribute name=\"OC_FARNELL\" value=\"unknown\" constant=\"no\"/>\n<attribute name=\"OC_NEWARK\" value=\"unknown\" constant=\"no\"/>\n</technology>\n</technologies>\n</device>\n</devices>\n</deviceset>\n<deviceset name=\"NTC642-6\" prefix=\"R\" uservalue=\"yes\">\n<description>&lt;b&gt;PHILIPS NTC&lt;/b&gt;</description>\n<gates>\n<gate name=\"1\" symbol=\"NTC\" x=\"0\" y=\"0\"/>\n</gates>\n<devices>\n<device name=\"\" package=\"P642\">\n<connects>\n<connect gate=\"1\" pin=\"1\" pad=\"1\"/>\n<connect gate=\"1\" pin=\"2\" pad=\"2\"/>\n</connects>\n<technologies>\n<technology name=\"\">\n<attribute name=\"MF\" value=\"\" constant=\"no\"/>\n<attribute name=\"MPN\" value=\"\" constant=\"no\"/>\n<attribute name=\"OC_FARNELL\" value=\"unknown\" constant=\"no\"/>\n<attribute name=\"OC_NEWARK\" value=\"unknown\" constant=\"no\"/>\n</technology>\n</technologies>\n</device>\n</devices>\n</deviceset>\n</devicesets>\n</library>\n</libraries>\n<attributes>\n</attributes>\n<variantdefs>\n</variantdefs>\n<classes>\n<class number=\"0\" name=\"default\" width=\"0\" drill=\"0\">\n</class>\n</classes>\n<parts>\n<part name=\"FRAME1\" library=\"frames\" deviceset=\"A4L-LOC\" device=\"\"/>\n<part name=\"JP1\" library=\"pinhead\" deviceset=\"PINHD-1X6\" device=\"\"/>\n<part name=\"P+1\" library=\"supply1\" deviceset=\"+5V\" device=\"\"/>\n<part name=\"GND1\" library=\"supply1\" deviceset=\"GND\" device=\"\"/>\n<part name=\"D1\" library=\"diode\" deviceset=\"BAT60J\" device=\"\"/>\n<part name=\"R1\" library=\"rcl\" deviceset=\"R-EU_\" device=\"R0603\" value=\"10k\"/>\n<part name=\"P+2\" library=\"supply1\" deviceset=\"+5V\" device=\"\"/>\n<part name=\"C1\" library=\"rcl\" deviceset=\"C-EU\" device=\"C0603\"/>\n<part name=\"GND2\" library=\"supply1\" deviceset=\"GND\" device=\"\"/>\n<part name=\"R2\" library=\"rcl\" deviceset=\"R-EU_\" device=\"R0603\" value=\"3k\"/>\n<part name=\"R3\" library=\"rcl\" deviceset=\"R-EU_\" device=\"R0603\" value=\"3k\"/>\n<part name=\"R4\" library=\"rcl\" deviceset=\"R-EU_\" device=\"R0603\" value=\"10k\"/>\n<part name=\"GND3\" library=\"supply1\" deviceset=\"GND\" device=\"\"/>\n<part name=\"R5\" library=\"rcl\" deviceset=\"R-EU_\" device=\"R0603\" value=\"10k\"/>\n<part name=\"P+3\" library=\"supply1\" deviceset=\"+5V\" device=\"\"/>\n<part name=\"D2\" library=\"diode\" deviceset=\"BAT60J\" device=\"\"/>\n<part name=\"D3\" library=\"diode\" deviceset=\"BAT60J\" device=\"\"/>\n<part name=\"R6\" library=\"rcl\" deviceset=\"R-EU_\" device=\"R0603\" value=\"330\"/>\n<part name=\"R7\" library=\"rcl\" deviceset=\"R-EU_\" device=\"R0603\" value=\"330\"/>\n<part name=\"D4\" library=\"diode\" deviceset=\"BAT60J\" device=\"\"/>\n<part name=\"R8\" library=\"rcl\" deviceset=\"R-EU_\" device=\"R0603\" value=\"680\"/>\n<part name=\"D5\" library=\"diode\" deviceset=\"BAT60J\" device=\"\"/>\n<part name=\"P+4\" library=\"supply1\" deviceset=\"+5V\" device=\"\"/>\n<part name=\"R9\" library=\"rcl\" deviceset=\"R-EU_\" device=\"R0603\" value=\"330\"/>\n<part name=\"JP2\" library=\"pinhead\" deviceset=\"PINHD-1X4\" device=\"\"/>\n<part name=\"GND4\" library=\"supply1\" deviceset=\"GND\" device=\"\"/>\n<part name=\"+3V1\" library=\"supply1\" deviceset=\"+3V3\" device=\"\" value=\"+4.3V\"/>\n<part name=\"R10\" library=\"rcl\" deviceset=\"R-EU_\" device=\"R0603\" value=\"5k\"/>\n<part name=\"R11\" library=\"rcl\" deviceset=\"R-EU_\" device=\"R0603\" value=\"5k\"/>\n<part name=\"R12\" library=\"rcl\" deviceset=\"R-EU_\" device=\"R0603\" value=\"3k\"/>\n<part name=\"R13\" library=\"rcl\" deviceset=\"R-EU_\" device=\"R0603\" value=\"3k\"/>\n<part name=\"FRAME2\" library=\"frames\" deviceset=\"A4L-LOC\" device=\"\"/>\n<part name=\"JP3\" library=\"pinhead\" deviceset=\"PINHD-1X3\" device=\"\"/>\n<part name=\"GND5\" library=\"supply1\" deviceset=\"GND\" device=\"\"/>\n<part name=\"+3V2\" library=\"supply1\" deviceset=\"+3V3\" device=\"\" value=\"+4.3V\"/>\n<part name=\"JP4\" library=\"pinhead\" deviceset=\"PINHD-1X6\" device=\"\"/>\n<part name=\"+3V3\" library=\"supply1\" deviceset=\"+3V3\" device=\"\" value=\"+4.3V\"/>\n<part name=\"GND6\" library=\"supply1\" deviceset=\"GND\" device=\"\"/>\n<part name=\"R14\" library=\"rcl\" deviceset=\"R-EU_\" device=\"R0603\" value=\"3k\"/>\n<part name=\"R15\" library=\"rcl\" deviceset=\"R-EU_\" device=\"R0603\" value=\"3k\"/>\n<part name=\"R16\" library=\"rcl\" deviceset=\"R-EU_\" device=\"R0603\" value=\"3k\"/>\n<part name=\"R17\" library=\"rcl\" deviceset=\"R-EU_\" device=\"R0603\" value=\"0\"/>\n<part name=\"R18\" library=\"rcl\" deviceset=\"R-EU_\" device=\"R0603\" value=\"0\"/>\n<part name=\"R19\" library=\"rcl\" deviceset=\"R-EU_\" device=\"R0603\" value=\"0\"/>\n<part name=\"R21\" library=\"rcl\" deviceset=\"R-EU_\" device=\"R0603\" value=\"3.3k\"/>\n<part name=\"R22\" library=\"rcl\" deviceset=\"R-EU_\" device=\"R0603\" value=\"10k\"/>\n<part name=\"GND7\" library=\"supply1\" deviceset=\"GND\" device=\"\"/>\n<part name=\"C2\" library=\"rcl\" deviceset=\"C-EU\" device=\"C0603\"/>\n<part name=\"R23\" library=\"rcl\" deviceset=\"R-EU_\" device=\"R0603\" value=\"0\"/>\n<part name=\"R24\" library=\"rcl\" deviceset=\"R-EU_\" device=\"R0603\" value=\"0\"/>\n<part name=\"R25\" library=\"rcl\" deviceset=\"R-EU_\" device=\"R0603\" value=\"5.1k\"/>\n<part name=\"R26\" library=\"rcl\" deviceset=\"R-EU_\" device=\"R0603\" value=\"5.1k\"/>\n<part name=\"P+5\" library=\"supply1\" deviceset=\"VCC\" device=\"\"/>\n<part name=\"R27\" library=\"rcl\" deviceset=\"R-EU_\" device=\"R0603\" value=\"30k\"/>\n<part name=\"GND8\" library=\"supply1\" deviceset=\"GND\" device=\"\"/>\n<part name=\"R28\" library=\"rcl\" deviceset=\"R-EU_\" device=\"R0603\" value=\"2.4k\"/>\n<part name=\"R29\" library=\"rcl\" deviceset=\"R-EU_\" device=\"R0603\" value=\"2.2K\"/>\n<part name=\"R30\" library=\"rcl\" deviceset=\"R-EU_\" device=\"R0603\" value=\"2.0K\"/>\n<part name=\"IC1\" library=\"linear\" deviceset=\"LM358\" device=\"D\"/>\n<part name=\"R31\" library=\"rcl\" deviceset=\"R-EU_\" device=\"R0603\" value=\"10K\"/>\n<part name=\"R32\" library=\"rcl\" deviceset=\"R-EU_\" device=\"R0603\" value=\"1K\"/>\n<part name=\"GND9\" library=\"supply1\" deviceset=\"GND\" device=\"\"/>\n<part name=\"R33\" library=\"rcl\" deviceset=\"R-EU_\" device=\"R0603\" value=\"5m\"/>\n<part name=\"R34\" library=\"rcl\" deviceset=\"R-EU_\" device=\"R0603\" value=\"5m\"/>\n<part name=\"GND10\" library=\"supply1\" deviceset=\"GND\" device=\"\"/>\n<part name=\"C3\" library=\"rcl\" deviceset=\"C-EU\" device=\"C0603\"/>\n<part name=\"R35\" library=\"rcl\" deviceset=\"R-EU_\" device=\"R0603\" value=\"1K\"/>\n<part name=\"R36\" library=\"rcl\" deviceset=\"R-EU_\" device=\"R0603\" value=\"1K\"/>\n<part name=\"R37\" library=\"rcl\" deviceset=\"R-EU_\" device=\"R0603\" value=\"30K\"/>\n<part name=\"R38\" library=\"rcl\" deviceset=\"R-EU_\" device=\"R0603\" value=\"30K\"/>\n<part name=\"R39\" library=\"rcl\" deviceset=\"R-EU_\" device=\"R0603\" value=\"3k\"/>\n<part name=\"C4\" library=\"rcl\" deviceset=\"C-EU\" device=\"C0603\"/>\n<part name=\"GND11\" library=\"supply1\" deviceset=\"GND\" device=\"\"/>\n<part name=\"P+6\" library=\"supply1\" deviceset=\"+5V\" device=\"\"/>\n<part name=\"P+7\" library=\"supply1\" deviceset=\"+5V\" device=\"\"/>\n<part name=\"R40\" library=\"rcl\" deviceset=\"R-EU_\" device=\"R0603\" value=\"5.6K\"/>\n<part name=\"LED1\" library=\"led\" deviceset=\"LED\" device=\"\"/>\n<part name=\"R41\" library=\"rcl\" deviceset=\"R-EU_\" device=\"R0603\" value=\"5.2K\"/>\n<part name=\"R42\" library=\"rcl\" deviceset=\"R-EU_\" device=\"R0603\" value=\"5.2K\"/>\n<part name=\"R20\" library=\"rcl\" deviceset=\"R-EU_\" device=\"R0603\" value=\"0\"/>\n<part name=\"R44\" library=\"rcl\" deviceset=\"R-EU_\" device=\"R0603\" value=\"0\"/>\n<part name=\"R43\" library=\"ptc-ntc\" deviceset=\"NTC640\" device=\"\" value=\"10k\"/>\n<part name=\"R45\" library=\"rcl\" deviceset=\"R-EU_\" device=\"R0603\" value=\"5.1k\"/>\n<part name=\"GND12\" library=\"supply1\" deviceset=\"GND\" device=\"\"/>\n<part name=\"R46\" library=\"rcl\" deviceset=\"R-EU_\" device=\"R0603\" value=\"3.0K\"/>\n<part name=\"P+8\" library=\"supply1\" deviceset=\"+5V\" device=\"\"/>\n<part name=\"R47\" library=\"rcl\" deviceset=\"R-EU_\" device=\"R0603\" value=\"5.1K\"/>\n<part name=\"P+9\" library=\"supply1\" deviceset=\"+5V\" device=\"\"/>\n<part name=\"R48\" library=\"ptc-ntc\" deviceset=\"NTC642-6\" device=\"\" value=\"10K\"/>\n<part name=\"GND13\" library=\"supply1\" deviceset=\"GND\" device=\"\"/>\n</parts>\n<sheets>\n<sheet>\n<plain>\n<text x=\"15.24\" y=\"142.24\" size=\"1.778\" layer=\"97\">Main Harness Signal Connector</text>\n<text x=\"17.018\" y=\"131.318\" size=\"1.778\" layer=\"97\">Brake</text>\n<text x=\"14.478\" y=\"133.858\" size=\"1.778\" layer=\"97\">Throttle</text>\n<text x=\"19.558\" y=\"128.778\" size=\"1.778\" layer=\"97\">RX</text>\n<text x=\"19.558\" y=\"126.238\" size=\"1.778\" layer=\"97\">TX</text>\n<text x=\"17.78\" y=\"123.698\" size=\"1.778\" layer=\"97\">GND</text>\n<text x=\"19.558\" y=\"121.158\" size=\"1.778\" layer=\"97\">5V</text>\n<text x=\"144.272\" y=\"100.838\" size=\"1.778\" layer=\"97\">RX</text>\n<text x=\"144.272\" y=\"85.598\" size=\"1.778\" layer=\"97\">TX</text>\n<wire x1=\"73.66\" y1=\"96.52\" x2=\"104.14\" y2=\"96.52\" width=\"0.1524\" layer=\"97\"/>\n<wire x1=\"104.14\" y1=\"96.52\" x2=\"104.14\" y2=\"83.82\" width=\"0.1524\" layer=\"97\"/>\n<wire x1=\"104.14\" y1=\"83.82\" x2=\"73.66\" y2=\"83.82\" width=\"0.1524\" layer=\"97\"/>\n<wire x1=\"73.66\" y1=\"83.82\" x2=\"73.66\" y2=\"96.52\" width=\"0.1524\" layer=\"97\"/>\n<text x=\"102.616\" y=\"94.996\" size=\"1.016\" layer=\"97\" rot=\"R180\">Components missing, located on \nthe bottom side of pcb right under STC MCU.\n\nTwo SOT-23, likely two transistors, \nsome form of input protection maybe?</text>\n<text x=\"17.018\" y=\"60.198\" size=\"1.778\" layer=\"97\">PAS1</text>\n<text x=\"17.018\" y=\"62.738\" size=\"1.778\" layer=\"97\">PAS2</text>\n<text x=\"159.766\" y=\"166.878\" size=\"1.778\" layer=\"97\">Debug Terminalt?\nConstant data output at 9600 baud.</text>\n<text x=\"187.96\" y=\"111.76\" size=\"1.778\" layer=\"97\">Gear sensor</text>\n<text x=\"187.96\" y=\"106.68\" size=\"1.778\" layer=\"97\">??? Has not been traced</text>\n<text x=\"187.96\" y=\"93.98\" size=\"1.778\" layer=\"97\">??? Has not been traced</text>\n<text x=\"18.796\" y=\"29.718\" size=\"1.778\" layer=\"97\">SPD</text>\n<text x=\"217.17\" y=\"20.066\" size=\"2.54\" layer=\"94\">Daniel Nilsson</text>\n<text x=\"193.04\" y=\"53.34\" size=\"1.778\" layer=\"97\">ADC6 - Battery voltage measurement</text>\n<text x=\"231.648\" y=\"123.698\" size=\"1.778\" layer=\"97\">TxD4</text>\n<text x=\"231.648\" y=\"133.858\" size=\"1.778\" layer=\"97\">RxD4</text>\n<text x=\"231.648\" y=\"159.258\" size=\"1.778\" layer=\"97\">RxD3</text>\n<text x=\"231.648\" y=\"149.098\" size=\"1.778\" layer=\"97\">TxD3</text>\n<text x=\"161.036\" y=\"139.954\" size=\"1.778\" layer=\"97\">Another UART brought out to pins, no data has been seen.</text>\n<text x=\"208.28\" y=\"71.12\" size=\"1.778\" layer=\"97\">ADC7 - Temperature sensor</text>\n</plain>\n<instances>\n<instance part=\"FRAME1\" gate=\"G$1\" x=\"0\" y=\"0\"/>\n<instance part=\"JP1\" gate=\"A\" x=\"25.4\" y=\"129.54\" rot=\"R180\"/>\n<instance part=\"P+1\" gate=\"1\" x=\"43.18\" y=\"106.68\" rot=\"R270\"/>\n<instance part=\"GND1\" gate=\"1\" x=\"40.64\" y=\"119.38\"/>\n<instance part=\"D1\" gate=\"G$1\" x=\"91.44\" y=\"132.08\" rot=\"R180\"/>\n<instance part=\"R1\" gate=\"G$1\" x=\"101.6\" y=\"142.24\" rot=\"R90\"/>\n<instance part=\"P+2\" gate=\"1\" x=\"101.6\" y=\"152.4\"/>\n<instance part=\"C1\" gate=\"G$1\" x=\"101.6\" y=\"124.46\"/>\n<instance part=\"GND2\" gate=\"1\" x=\"101.6\" y=\"114.3\"/>\n<instance part=\"R2\" gate=\"G$1\" x=\"119.38\" y=\"142.24\" rot=\"R180\"/>\n<instance part=\"R3\" gate=\"G$1\" x=\"83.82\" y=\"160.02\" rot=\"R180\"/>\n<instance part=\"R4\" gate=\"G$1\" x=\"73.66\" y=\"149.86\" rot=\"R90\"/>\n<instance part=\"GND3\" gate=\"1\" x=\"73.66\" y=\"139.7\"/>\n<instance part=\"R5\" gate=\"G$1\" x=\"86.36\" y=\"109.22\" rot=\"R90\"/>\n<instance part=\"P+3\" gate=\"1\" x=\"86.36\" y=\"119.38\"/>\n<instance part=\"D2\" gate=\"G$1\" x=\"78.74\" y=\"101.6\" rot=\"R180\"/>\n<instance part=\"D3\" gate=\"G$1\" x=\"187.96\" y=\"134.62\" rot=\"R180\"/>\n<instance part=\"R6\" gate=\"G$1\" x=\"208.28\" y=\"134.62\" rot=\"R180\"/>\n<instance part=\"R7\" gate=\"G$1\" x=\"208.28\" y=\"160.02\" rot=\"R180\"/>\n<instance part=\"D4\" gate=\"G$1\" x=\"187.96\" y=\"160.02\" rot=\"R180\"/>\n<instance part=\"R8\" gate=\"G$1\" x=\"55.88\" y=\"93.98\" rot=\"R270\"/>\n<instance part=\"D5\" gate=\"G$1\" x=\"55.88\" y=\"109.22\" rot=\"R270\"/>\n<instance part=\"P+4\" gate=\"1\" x=\"55.88\" y=\"121.92\"/>\n<instance part=\"R9\" gate=\"G$1\" x=\"96.52\" y=\"101.6\" rot=\"R180\"/>\n<instance part=\"JP2\" gate=\"A\" x=\"25.4\" y=\"63.5\" rot=\"R180\"/>\n<instance part=\"GND4\" gate=\"1\" x=\"38.1\" y=\"50.8\"/>\n<instance part=\"+3V1\" gate=\"G$1\" x=\"38.1\" y=\"83.82\"/>\n<instance part=\"R10\" gate=\"G$1\" x=\"48.26\" y=\"71.12\" rot=\"R90\"/>\n<instance part=\"R11\" gate=\"G$1\" x=\"58.42\" y=\"71.12\" rot=\"R90\"/>\n<instance part=\"R12\" gate=\"G$1\" x=\"78.74\" y=\"68.58\" rot=\"R180\"/>\n<instance part=\"R13\" gate=\"G$1\" x=\"78.74\" y=\"55.88\" rot=\"R180\"/>\n<instance part=\"JP3\" gate=\"A\" x=\"25.4\" y=\"30.48\" rot=\"R180\"/>\n<instance part=\"GND5\" gate=\"1\" x=\"38.1\" y=\"17.78\"/>\n<instance part=\"+3V2\" gate=\"G$1\" x=\"38.1\" y=\"43.18\"/>\n<instance part=\"R25\" gate=\"G$1\" x=\"50.8\" y=\"38.1\" rot=\"R90\"/>\n<instance part=\"R26\" gate=\"G$1\" x=\"78.74\" y=\"30.48\" rot=\"R180\"/>\n<instance part=\"P+5\" gate=\"VCC\" x=\"170.18\" y=\"66.04\"/>\n<instance part=\"R27\" gate=\"G$1\" x=\"170.18\" y=\"55.88\" rot=\"R270\"/>\n<instance part=\"GND8\" gate=\"1\" x=\"170.18\" y=\"30.48\"/>\n<instance part=\"R28\" gate=\"G$1\" x=\"170.18\" y=\"40.64\" rot=\"R270\"/>\n<instance part=\"R29\" gate=\"G$1\" x=\"182.88\" y=\"48.26\"/>\n<instance part=\"R30\" gate=\"G$1\" x=\"195.58\" y=\"48.26\"/>\n<instance part=\"R41\" gate=\"G$1\" x=\"208.28\" y=\"149.86\" rot=\"R180\"/>\n<instance part=\"R42\" gate=\"G$1\" x=\"208.28\" y=\"124.46\" rot=\"R180\"/>\n<instance part=\"R43\" gate=\"1\" x=\"190.5\" y=\"78.74\" rot=\"R90\"/>\n<instance part=\"R45\" gate=\"G$1\" x=\"175.26\" y=\"78.74\"/>\n<instance part=\"GND12\" gate=\"1\" x=\"200.66\" y=\"73.66\"/>\n<instance part=\"R46\" gate=\"G$1\" x=\"190.5\" y=\"66.04\"/>\n<instance part=\"P+9\" gate=\"1\" x=\"160.02\" y=\"86.36\"/>\n</instances>\n<busses>\n</busses>\n<nets>\n<net name=\"+5V\" class=\"0\">\n<segment>\n<pinref part=\"JP1\" gate=\"A\" pin=\"1\"/>\n<wire x1=\"27.94\" y1=\"121.92\" x2=\"35.56\" y2=\"121.92\" width=\"0.1524\" layer=\"91\"/>\n<wire x1=\"35.56\" y1=\"121.92\" x2=\"35.56\" y2=\"106.68\" width=\"0.1524\" layer=\"91\"/>\n<pinref part=\"P+1\" gate=\"1\" pin=\"+5V\"/>\n<wire x1=\"35.56\" y1=\"106.68\" x2=\"40.64\" y2=\"106.68\" width=\"0.1524\" layer=\"91\"/>\n</segment>\n<segment>\n<pinref part=\"P+2\" gate=\"1\" pin=\"+5V\"/>\n<pinref part=\"R1\" gate=\"G$1\" pin=\"2\"/>\n<wire x1=\"101.6\" y1=\"149.86\" x2=\"101.6\" y2=\"147.32\" width=\"0.1524\" layer=\"91\"/>\n</segment>\n<segment>\n<pinref part=\"R5\" gate=\"G$1\" pin=\"2\"/>\n<pinref part=\"P+3\" gate=\"1\" pin=\"+5V\"/>\n<wire x1=\"86.36\" y1=\"114.3\" x2=\"86.36\" y2=\"116.84\" width=\"0.1524\" layer=\"91\"/>\n</segment>\n<segment>\n<pinref part=\"P+4\" gate=\"1\" pin=\"+5V\"/>\n<pinref part=\"D5\" gate=\"G$1\" pin=\"A\"/>\n<wire x1=\"55.88\" y1=\"119.38\" x2=\"55.88\" y2=\"111.76\" width=\"0.1524\" layer=\"91\"/>\n</segment>\n<segment>\n<pinref part=\"R45\" gate=\"G$1\" pin=\"1\"/>\n<wire x1=\"160.02\" y1=\"78.74\" x2=\"170.18\" y2=\"78.74\" width=\"0.1524\" layer=\"91\"/>\n<pinref part=\"P+9\" gate=\"1\" pin=\"+5V\"/>\n<wire x1=\"160.02\" y1=\"83.82\" x2=\"160.02\" y2=\"78.74\" width=\"0.1524\" layer=\"91\"/>\n</segment>\n</net>\n<net name=\"GND\" class=\"0\">\n<segment>\n<pinref part=\"JP1\" gate=\"A\" pin=\"2\"/>\n<pinref part=\"GND1\" gate=\"1\" pin=\"GND\"/>\n<wire x1=\"27.94\" y1=\"124.46\" x2=\"40.64\" y2=\"124.46\" width=\"0.1524\" layer=\"91\"/>\n<wire x1=\"40.64\" y1=\"124.46\" x2=\"40.64\" y2=\"121.92\" width=\"0.1524\" layer=\"91\"/>\n</segment>\n<segment>\n<pinref part=\"C1\" gate=\"G$1\" pin=\"2\"/>\n<pinref part=\"GND2\" gate=\"1\" pin=\"GND\"/>\n<wire x1=\"101.6\" y1=\"119.38\" x2=\"101.6\" y2=\"116.84\" width=\"0.1524\" layer=\"91\"/>\n</segment>\n<segment>\n<pinref part=\"R4\" gate=\"G$1\" pin=\"1\"/>\n<pinref part=\"GND3\" gate=\"1\" pin=\"GND\"/>\n<wire x1=\"73.66\" y1=\"144.78\" x2=\"73.66\" y2=\"142.24\" width=\"0.1524\" layer=\"91\"/>\n</segment>\n<segment>\n<pinref part=\"GND4\" gate=\"1\" pin=\"GND\"/>\n<wire x1=\"38.1\" y1=\"53.34\" x2=\"38.1\" y2=\"58.42\" width=\"0.1524\" layer=\"91\"/>\n<pinref part=\"JP2\" gate=\"A\" pin=\"1\"/>\n<wire x1=\"38.1\" y1=\"58.42\" x2=\"27.94\" y2=\"58.42\" width=\"0.1524\" layer=\"91\"/>\n</segment>\n<segment>\n<pinref part=\"JP3\" gate=\"A\" pin=\"1\"/>\n<pinref part=\"GND5\" gate=\"1\" pin=\"GND\"/>\n<wire x1=\"27.94\" y1=\"27.94\" x2=\"38.1\" y2=\"27.94\" width=\"0.1524\" layer=\"91\"/>\n<wire x1=\"38.1\" y1=\"27.94\" x2=\"38.1\" y2=\"20.32\" width=\"0.1524\" layer=\"91\"/>\n</segment>\n<segment>\n<pinref part=\"R28\" gate=\"G$1\" pin=\"2\"/>\n<pinref part=\"GND8\" gate=\"1\" pin=\"GND\"/>\n<wire x1=\"170.18\" y1=\"35.56\" x2=\"170.18\" y2=\"33.02\" width=\"0.1524\" layer=\"91\"/>\n</segment>\n<segment>\n<pinref part=\"R43\" gate=\"1\" pin=\"1\"/>\n<wire x1=\"195.58\" y1=\"78.74\" x2=\"200.66\" y2=\"78.74\" width=\"0.1524\" layer=\"91\"/>\n<pinref part=\"GND12\" gate=\"1\" pin=\"GND\"/>\n<wire x1=\"200.66\" y1=\"78.74\" x2=\"200.66\" y2=\"76.2\" width=\"0.1524\" layer=\"91\"/>\n</segment>\n</net>\n<net name=\"N$2\" class=\"0\">\n<segment>\n<pinref part=\"JP1\" gate=\"A\" pin=\"5\"/>\n<pinref part=\"D1\" gate=\"G$1\" pin=\"C\"/>\n<wire x1=\"27.94\" y1=\"132.08\" x2=\"88.9\" y2=\"132.08\" width=\"0.1524\" layer=\"91\"/>\n</segment>\n</net>\n<net name=\"STC_P2.4\" class=\"0\">\n<segment>\n<pinref part=\"R1\" gate=\"G$1\" pin=\"1\"/>\n<pinref part=\"C1\" gate=\"G$1\" pin=\"1\"/>\n<wire x1=\"101.6\" y1=\"137.16\" x2=\"101.6\" y2=\"132.08\" width=\"0.1524\" layer=\"91\"/>\n<pinref part=\"D1\" gate=\"G$1\" pin=\"A\"/>\n<wire x1=\"101.6\" y1=\"132.08\" x2=\"101.6\" y2=\"127\" width=\"0.1524\" layer=\"91\"/>\n<wire x1=\"101.6\" y1=\"132.08\" x2=\"93.98\" y2=\"132.08\" width=\"0.1524\" layer=\"91\"/>\n<junction x=\"101.6\" y=\"132.08\"/>\n<wire x1=\"101.6\" y1=\"132.08\" x2=\"109.22\" y2=\"132.08\" width=\"0.1524\" layer=\"91\"/>\n<label x=\"129.54\" y=\"132.08\" size=\"1.778\" layer=\"95\" xref=\"yes\"/>\n<pinref part=\"R2\" gate=\"G$1\" pin=\"2\"/>\n<wire x1=\"109.22\" y1=\"132.08\" x2=\"129.54\" y2=\"132.08\" width=\"0.1524\" layer=\"91\"/>\n<wire x1=\"114.3\" y1=\"142.24\" x2=\"109.22\" y2=\"142.24\" width=\"0.1524\" layer=\"91\"/>\n<wire x1=\"109.22\" y1=\"142.24\" x2=\"109.22\" y2=\"132.08\" width=\"0.1524\" layer=\"91\"/>\n<junction x=\"109.22\" y=\"132.08\"/>\n</segment>\n</net>\n<net name=\"NEC_P124\" class=\"0\">\n<segment>\n<pinref part=\"R2\" gate=\"G$1\" pin=\"1\"/>\n<wire x1=\"124.46\" y1=\"142.24\" x2=\"129.54\" y2=\"142.24\" width=\"0.1524\" layer=\"91\"/>\n<label x=\"129.54\" y=\"142.24\" size=\"1.778\" layer=\"95\" xref=\"yes\"/>\n</segment>\n</net>\n<net name=\"N$1\" class=\"0\">\n<segment>\n<pinref part=\"JP1\" gate=\"A\" pin=\"6\"/>\n<wire x1=\"27.94\" y1=\"134.62\" x2=\"55.88\" y2=\"134.62\" width=\"0.1524\" layer=\"91\"/>\n<wire x1=\"55.88\" y1=\"134.62\" x2=\"55.88\" y2=\"160.02\" width=\"0.1524\" layer=\"91\"/>\n<pinref part=\"R3\" gate=\"G$1\" pin=\"2\"/>\n<wire x1=\"55.88\" y1=\"160.02\" x2=\"73.66\" y2=\"160.02\" width=\"0.1524\" layer=\"91\"/>\n<pinref part=\"R4\" gate=\"G$1\" pin=\"2\"/>\n<wire x1=\"73.66\" y1=\"160.02\" x2=\"78.74\" y2=\"160.02\" width=\"0.1524\" layer=\"91\"/>\n<wire x1=\"73.66\" y1=\"154.94\" x2=\"73.66\" y2=\"160.02\" width=\"0.1524\" layer=\"91\"/>\n<junction x=\"73.66\" y=\"160.02\"/>\n</segment>\n</net>\n<net name=\"STC_P1.3\" class=\"0\">\n<segment>\n<pinref part=\"R3\" gate=\"G$1\" pin=\"1\"/>\n<wire x1=\"88.9\" y1=\"160.02\" x2=\"129.54\" y2=\"160.02\" width=\"0.1524\" layer=\"91\"/>\n<label x=\"129.54\" y=\"160.02\" size=\"1.778\" layer=\"95\" xref=\"yes\"/>\n</segment>\n</net>\n<net name=\"N$3\" class=\"0\">\n<segment>\n<pinref part=\"JP1\" gate=\"A\" pin=\"4\"/>\n<wire x1=\"27.94\" y1=\"129.54\" x2=\"71.12\" y2=\"129.54\" width=\"0.1524\" layer=\"91\"/>\n<wire x1=\"71.12\" y1=\"129.54\" x2=\"71.12\" y2=\"101.6\" width=\"0.1524\" layer=\"91\"/>\n<pinref part=\"D2\" gate=\"G$1\" pin=\"C\"/>\n<wire x1=\"76.2\" y1=\"101.6\" x2=\"71.12\" y2=\"101.6\" width=\"0.1524\" layer=\"91\"/>\n</segment>\n</net>\n<net name=\"N$4\" class=\"0\">\n<segment>\n<pinref part=\"R5\" gate=\"G$1\" pin=\"1\"/>\n<wire x1=\"86.36\" y1=\"104.14\" x2=\"86.36\" y2=\"101.6\" width=\"0.1524\" layer=\"91\"/>\n<pinref part=\"D2\" gate=\"G$1\" pin=\"A\"/>\n<wire x1=\"86.36\" y1=\"101.6\" x2=\"81.28\" y2=\"101.6\" width=\"0.1524\" layer=\"91\"/>\n<pinref part=\"R9\" gate=\"G$1\" pin=\"2\"/>\n<wire x1=\"91.44\" y1=\"101.6\" x2=\"86.36\" y2=\"101.6\" width=\"0.1524\" layer=\"91\"/>\n<junction x=\"86.36\" y=\"101.6\"/>\n</segment>\n</net>\n<net name=\"N$5\" class=\"0\">\n<segment>\n<pinref part=\"D3\" gate=\"G$1\" pin=\"A\"/>\n<wire x1=\"190.5\" y1=\"134.62\" x2=\"203.2\" y2=\"134.62\" width=\"0.1524\" layer=\"91\"/>\n<pinref part=\"R6\" gate=\"G$1\" pin=\"2\"/>\n</segment>\n</net>\n<net name=\"STC_P0.2\" class=\"0\">\n<segment>\n<pinref part=\"R6\" gate=\"G$1\" pin=\"1\"/>\n<wire x1=\"213.36\" y1=\"134.62\" x2=\"215.9\" y2=\"134.62\" width=\"0.1524\" layer=\"91\"/>\n<label x=\"215.9\" y=\"134.62\" size=\"1.778\" layer=\"95\" xref=\"yes\"/>\n</segment>\n</net>\n<net name=\"STC_P0.0\" class=\"0\">\n<segment>\n<pinref part=\"R7\" gate=\"G$1\" pin=\"1\"/>\n<wire x1=\"213.36\" y1=\"160.02\" x2=\"215.9\" y2=\"160.02\" width=\"0.1524\" layer=\"91\"/>\n<label x=\"215.9\" y=\"160.02\" size=\"1.778\" layer=\"95\" xref=\"yes\"/>\n</segment>\n</net>\n<net name=\"N$6\" class=\"0\">\n<segment>\n<pinref part=\"R7\" gate=\"G$1\" pin=\"2\"/>\n<pinref part=\"D4\" gate=\"G$1\" pin=\"A\"/>\n<wire x1=\"203.2\" y1=\"160.02\" x2=\"190.5\" y2=\"160.02\" width=\"0.1524\" layer=\"91\"/>\n</segment>\n</net>\n<net name=\"R\" class=\"0\">\n<segment>\n<pinref part=\"D3\" gate=\"G$1\" pin=\"C\"/>\n<wire x1=\"185.42\" y1=\"134.62\" x2=\"165.1\" y2=\"134.62\" width=\"0.1524\" layer=\"91\"/>\n<label x=\"165.1\" y=\"134.62\" size=\"1.778\" layer=\"95\" rot=\"R180\" xref=\"yes\"/>\n</segment>\n</net>\n<net name=\"BR\" class=\"0\">\n<segment>\n<pinref part=\"D4\" gate=\"G$1\" pin=\"C\"/>\n<wire x1=\"185.42\" y1=\"160.02\" x2=\"165.1\" y2=\"160.02\" width=\"0.1524\" layer=\"91\"/>\n<label x=\"165.1\" y=\"160.02\" size=\"1.778\" layer=\"95\" rot=\"R180\" xref=\"yes\"/>\n</segment>\n</net>\n<net name=\"STC_P3.1\" class=\"0\">\n<segment>\n<pinref part=\"JP1\" gate=\"A\" pin=\"3\"/>\n<wire x1=\"27.94\" y1=\"127\" x2=\"48.26\" y2=\"127\" width=\"0.1524\" layer=\"91\"/>\n<wire x1=\"48.26\" y1=\"127\" x2=\"48.26\" y2=\"86.36\" width=\"0.1524\" layer=\"91\"/>\n<wire x1=\"48.26\" y1=\"86.36\" x2=\"55.88\" y2=\"86.36\" width=\"0.1524\" layer=\"91\"/>\n<pinref part=\"R8\" gate=\"G$1\" pin=\"2\"/>\n<wire x1=\"55.88\" y1=\"86.36\" x2=\"55.88\" y2=\"88.9\" width=\"0.1524\" layer=\"91\"/>\n<junction x=\"55.88\" y=\"86.36\"/>\n<wire x1=\"55.88\" y1=\"86.36\" x2=\"129.54\" y2=\"86.36\" width=\"0.1524\" layer=\"91\"/>\n<label x=\"129.54\" y=\"86.36\" size=\"1.778\" layer=\"95\" xref=\"yes\"/>\n</segment>\n</net>\n<net name=\"N$8\" class=\"0\">\n<segment>\n<pinref part=\"D5\" gate=\"G$1\" pin=\"C\"/>\n<pinref part=\"R8\" gate=\"G$1\" pin=\"1\"/>\n<wire x1=\"55.88\" y1=\"106.68\" x2=\"55.88\" y2=\"99.06\" width=\"0.1524\" layer=\"91\"/>\n</segment>\n</net>\n<net name=\"STC_P3.0\" class=\"0\">\n<segment>\n<pinref part=\"R9\" gate=\"G$1\" pin=\"1\"/>\n<wire x1=\"101.6\" y1=\"101.6\" x2=\"129.54\" y2=\"101.6\" width=\"0.1524\" layer=\"91\"/>\n<label x=\"129.54\" y=\"101.6\" size=\"1.778\" layer=\"95\" xref=\"yes\"/>\n</segment>\n</net>\n<net name=\"+3V3\" class=\"0\">\n<segment>\n<pinref part=\"+3V1\" gate=\"G$1\" pin=\"+3V3\"/>\n<wire x1=\"38.1\" y1=\"81.28\" x2=\"38.1\" y2=\"78.74\" width=\"0.1524\" layer=\"91\"/>\n<pinref part=\"JP2\" gate=\"A\" pin=\"4\"/>\n<wire x1=\"38.1\" y1=\"78.74\" x2=\"38.1\" y2=\"66.04\" width=\"0.1524\" layer=\"91\"/>\n<wire x1=\"38.1\" y1=\"66.04\" x2=\"27.94\" y2=\"66.04\" width=\"0.1524\" layer=\"91\"/>\n<pinref part=\"R10\" gate=\"G$1\" pin=\"2\"/>\n<wire x1=\"48.26\" y1=\"76.2\" x2=\"48.26\" y2=\"78.74\" width=\"0.1524\" layer=\"91\"/>\n<wire x1=\"48.26\" y1=\"78.74\" x2=\"38.1\" y2=\"78.74\" width=\"0.1524\" layer=\"91\"/>\n<junction x=\"38.1\" y=\"78.74\"/>\n<pinref part=\"R11\" gate=\"G$1\" pin=\"2\"/>\n<wire x1=\"58.42\" y1=\"76.2\" x2=\"58.42\" y2=\"78.74\" width=\"0.1524\" layer=\"91\"/>\n<wire x1=\"58.42\" y1=\"78.74\" x2=\"48.26\" y2=\"78.74\" width=\"0.1524\" layer=\"91\"/>\n<junction x=\"48.26\" y=\"78.74\"/>\n</segment>\n<segment>\n<pinref part=\"+3V2\" gate=\"G$1\" pin=\"+3V3\"/>\n<wire x1=\"38.1\" y1=\"40.64\" x2=\"38.1\" y2=\"38.1\" width=\"0.1524\" layer=\"91\"/>\n<pinref part=\"JP3\" gate=\"A\" pin=\"3\"/>\n<wire x1=\"38.1\" y1=\"38.1\" x2=\"38.1\" y2=\"33.02\" width=\"0.1524\" layer=\"91\"/>\n<wire x1=\"38.1\" y1=\"33.02\" x2=\"27.94\" y2=\"33.02\" width=\"0.1524\" layer=\"91\"/>\n<pinref part=\"R25\" gate=\"G$1\" pin=\"2\"/>\n<wire x1=\"50.8\" y1=\"43.18\" x2=\"50.8\" y2=\"45.72\" width=\"0.1524\" layer=\"91\"/>\n<wire x1=\"50.8\" y1=\"45.72\" x2=\"43.18\" y2=\"45.72\" width=\"0.1524\" layer=\"91\"/>\n<wire x1=\"43.18\" y1=\"45.72\" x2=\"43.18\" y2=\"38.1\" width=\"0.1524\" layer=\"91\"/>\n<wire x1=\"43.18\" y1=\"38.1\" x2=\"38.1\" y2=\"38.1\" width=\"0.1524\" layer=\"91\"/>\n<junction x=\"38.1\" y=\"38.1\"/>\n</segment>\n</net>\n<net name=\"N$7\" class=\"0\">\n<segment>\n<pinref part=\"JP2\" gate=\"A\" pin=\"2\"/>\n<wire x1=\"27.94\" y1=\"60.96\" x2=\"58.42\" y2=\"60.96\" width=\"0.1524\" layer=\"91\"/>\n<pinref part=\"R11\" gate=\"G$1\" pin=\"1\"/>\n<wire x1=\"58.42\" y1=\"60.96\" x2=\"71.12\" y2=\"60.96\" width=\"0.1524\" layer=\"91\"/>\n<wire x1=\"58.42\" y1=\"66.04\" x2=\"58.42\" y2=\"60.96\" width=\"0.1524\" layer=\"91\"/>\n<junction x=\"58.42\" y=\"60.96\"/>\n<pinref part=\"R13\" gate=\"G$1\" pin=\"2\"/>\n<wire x1=\"73.66\" y1=\"55.88\" x2=\"71.12\" y2=\"55.88\" width=\"0.1524\" layer=\"91\"/>\n<wire x1=\"71.12\" y1=\"55.88\" x2=\"71.12\" y2=\"60.96\" width=\"0.1524\" layer=\"91\"/>\n</segment>\n</net>\n<net name=\"N$9\" class=\"0\">\n<segment>\n<pinref part=\"JP2\" gate=\"A\" pin=\"3\"/>\n<wire x1=\"27.94\" y1=\"63.5\" x2=\"48.26\" y2=\"63.5\" width=\"0.1524\" layer=\"91\"/>\n<pinref part=\"R10\" gate=\"G$1\" pin=\"1\"/>\n<wire x1=\"48.26\" y1=\"63.5\" x2=\"71.12\" y2=\"63.5\" width=\"0.1524\" layer=\"91\"/>\n<wire x1=\"48.26\" y1=\"66.04\" x2=\"48.26\" y2=\"63.5\" width=\"0.1524\" layer=\"91\"/>\n<junction x=\"48.26\" y=\"63.5\"/>\n<wire x1=\"71.12\" y1=\"63.5\" x2=\"71.12\" y2=\"68.58\" width=\"0.1524\" layer=\"91\"/>\n<pinref part=\"R12\" gate=\"G$1\" pin=\"2\"/>\n<wire x1=\"71.12\" y1=\"68.58\" x2=\"73.66\" y2=\"68.58\" width=\"0.1524\" layer=\"91\"/>\n</segment>\n</net>\n<net name=\"STC_P4.6\" class=\"0\">\n<segment>\n<pinref part=\"R12\" gate=\"G$1\" pin=\"1\"/>\n<wire x1=\"83.82\" y1=\"68.58\" x2=\"129.54\" y2=\"68.58\" width=\"0.1524\" layer=\"91\"/>\n<label x=\"129.54\" y=\"68.58\" size=\"1.778\" layer=\"95\" xref=\"yes\"/>\n</segment>\n</net>\n<net name=\"STC_P4.5\" class=\"0\">\n<segment>\n<pinref part=\"R13\" gate=\"G$1\" pin=\"1\"/>\n<wire x1=\"83.82\" y1=\"55.88\" x2=\"129.54\" y2=\"55.88\" width=\"0.1524\" layer=\"91\"/>\n<label x=\"129.54\" y=\"55.88\" size=\"1.778\" layer=\"95\" xref=\"yes\"/>\n</segment>\n</net>\n<net name=\"BT\" class=\"0\">\n<segment>\n<wire x1=\"203.2\" y1=\"149.86\" x2=\"165.1\" y2=\"149.86\" width=\"0.1524\" layer=\"91\"/>\n<label x=\"165.1\" y=\"149.86\" size=\"1.778\" layer=\"95\" rot=\"R180\" xref=\"yes\"/>\n<pinref part=\"R41\" gate=\"G$1\" pin=\"2\"/>\n</segment>\n</net>\n<net name=\"T\" class=\"0\">\n<segment>\n<wire x1=\"203.2\" y1=\"124.46\" x2=\"165.1\" y2=\"124.46\" width=\"0.1524\" layer=\"91\"/>\n<label x=\"165.1\" y=\"124.46\" size=\"1.778\" layer=\"95\" rot=\"R180\" xref=\"yes\"/>\n<pinref part=\"R42\" gate=\"G$1\" pin=\"2\"/>\n</segment>\n</net>\n<net name=\"GS\" class=\"0\">\n<segment>\n<wire x1=\"185.42\" y1=\"111.76\" x2=\"165.1\" y2=\"111.76\" width=\"0.1524\" layer=\"91\"/>\n<label x=\"165.1\" y=\"111.76\" size=\"1.778\" layer=\"95\" rot=\"R180\" xref=\"yes\"/>\n</segment>\n</net>\n<net name=\"DS\" class=\"0\">\n<segment>\n<wire x1=\"185.42\" y1=\"106.68\" x2=\"165.1\" y2=\"106.68\" width=\"0.1524\" layer=\"91\"/>\n<label x=\"165.1\" y=\"106.68\" size=\"1.778\" layer=\"95\" rot=\"R180\" xref=\"yes\"/>\n</segment>\n</net>\n<net name=\"W\" class=\"0\">\n<segment>\n<wire x1=\"185.42\" y1=\"93.98\" x2=\"165.1\" y2=\"93.98\" width=\"0.1524\" layer=\"91\"/>\n<label x=\"165.1\" y=\"93.98\" size=\"1.778\" layer=\"95\" rot=\"R180\" xref=\"yes\"/>\n</segment>\n</net>\n<net name=\"N$10\" class=\"0\">\n<segment>\n<pinref part=\"JP3\" gate=\"A\" pin=\"2\"/>\n<wire x1=\"27.94\" y1=\"30.48\" x2=\"50.8\" y2=\"30.48\" width=\"0.1524\" layer=\"91\"/>\n<pinref part=\"R25\" gate=\"G$1\" pin=\"1\"/>\n<wire x1=\"50.8\" y1=\"30.48\" x2=\"73.66\" y2=\"30.48\" width=\"0.1524\" layer=\"91\"/>\n<wire x1=\"50.8\" y1=\"33.02\" x2=\"50.8\" y2=\"30.48\" width=\"0.1524\" layer=\"91\"/>\n<junction x=\"50.8\" y=\"30.48\"/>\n<pinref part=\"R26\" gate=\"G$1\" pin=\"2\"/>\n</segment>\n</net>\n<net name=\"STC_P2.2\" class=\"0\">\n<segment>\n<pinref part=\"R26\" gate=\"G$1\" pin=\"1\"/>\n<wire x1=\"83.82\" y1=\"30.48\" x2=\"129.54\" y2=\"30.48\" width=\"0.1524\" layer=\"91\"/>\n<label x=\"129.54\" y=\"30.48\" size=\"1.778\" layer=\"95\" xref=\"yes\"/>\n</segment>\n</net>\n<net name=\"VCC\" class=\"0\">\n<segment>\n<pinref part=\"P+5\" gate=\"VCC\" pin=\"VCC\"/>\n<pinref part=\"R27\" gate=\"G$1\" pin=\"1\"/>\n<wire x1=\"170.18\" y1=\"63.5\" x2=\"170.18\" y2=\"60.96\" width=\"0.1524\" layer=\"91\"/>\n</segment>\n</net>\n<net name=\"N$14\" class=\"0\">\n<segment>\n<pinref part=\"R27\" gate=\"G$1\" pin=\"2\"/>\n<pinref part=\"R28\" gate=\"G$1\" pin=\"1\"/>\n<wire x1=\"170.18\" y1=\"50.8\" x2=\"170.18\" y2=\"48.26\" width=\"0.1524\" layer=\"91\"/>\n<wire x1=\"170.18\" y1=\"48.26\" x2=\"170.18\" y2=\"45.72\" width=\"0.1524\" layer=\"91\"/>\n<wire x1=\"170.18\" y1=\"48.26\" x2=\"177.8\" y2=\"48.26\" width=\"0.1524\" layer=\"91\"/>\n<junction x=\"170.18\" y=\"48.26\"/>\n<pinref part=\"R29\" gate=\"G$1\" pin=\"1\"/>\n</segment>\n</net>\n<net name=\"NEC_P151\" class=\"0\">\n<segment>\n<pinref part=\"R30\" gate=\"G$1\" pin=\"1\"/>\n<pinref part=\"R29\" gate=\"G$1\" pin=\"2\"/>\n<wire x1=\"190.5\" y1=\"48.26\" x2=\"187.96\" y2=\"48.26\" width=\"0.1524\" layer=\"91\"/>\n<wire x1=\"187.96\" y1=\"48.26\" x2=\"187.96\" y2=\"35.56\" width=\"0.1524\" layer=\"91\"/>\n<junction x=\"187.96\" y=\"48.26\"/>\n<wire x1=\"187.96\" y1=\"35.56\" x2=\"205.74\" y2=\"35.56\" width=\"0.1524\" layer=\"91\"/>\n<label x=\"205.74\" y=\"35.56\" size=\"1.778\" layer=\"95\" xref=\"yes\"/>\n</segment>\n</net>\n<net name=\"STC_P1.6\" class=\"0\">\n<segment>\n<pinref part=\"R30\" gate=\"G$1\" pin=\"2\"/>\n<wire x1=\"200.66\" y1=\"48.26\" x2=\"205.74\" y2=\"48.26\" width=\"0.1524\" layer=\"91\"/>\n<label x=\"205.74\" y=\"48.26\" size=\"1.778\" layer=\"95\" xref=\"yes\"/>\n</segment>\n</net>\n<net name=\"STC_P0.1\" class=\"0\">\n<segment>\n<pinref part=\"R41\" gate=\"G$1\" pin=\"1\"/>\n<wire x1=\"213.36\" y1=\"149.86\" x2=\"215.9\" y2=\"149.86\" width=\"0.1524\" layer=\"91\"/>\n<label x=\"215.9\" y=\"149.86\" size=\"1.778\" layer=\"95\" xref=\"yes\"/>\n</segment>\n</net>\n<net name=\"STC_P0.3\" class=\"0\">\n<segment>\n<pinref part=\"R42\" gate=\"G$1\" pin=\"1\"/>\n<wire x1=\"213.36\" y1=\"124.46\" x2=\"215.9\" y2=\"124.46\" width=\"0.1524\" layer=\"91\"/>\n<label x=\"215.9\" y=\"124.46\" size=\"1.778\" layer=\"95\" xref=\"yes\"/>\n</segment>\n</net>\n<net name=\"N$21\" class=\"0\">\n<segment>\n<pinref part=\"R45\" gate=\"G$1\" pin=\"2\"/>\n<pinref part=\"R43\" gate=\"1\" pin=\"2\"/>\n<wire x1=\"180.34\" y1=\"78.74\" x2=\"182.88\" y2=\"78.74\" width=\"0.1524\" layer=\"91\"/>\n<wire x1=\"182.88\" y1=\"78.74\" x2=\"185.42\" y2=\"78.74\" width=\"0.1524\" layer=\"91\"/>\n<wire x1=\"182.88\" y1=\"78.74\" x2=\"182.88\" y2=\"66.04\" width=\"0.1524\" layer=\"91\"/>\n<junction x=\"182.88\" y=\"78.74\"/>\n<pinref part=\"R46\" gate=\"G$1\" pin=\"1\"/>\n<wire x1=\"182.88\" y1=\"66.04\" x2=\"185.42\" y2=\"66.04\" width=\"0.1524\" layer=\"91\"/>\n</segment>\n</net>\n<net name=\"STC_P1.7\" class=\"0\">\n<segment>\n<pinref part=\"R46\" gate=\"G$1\" pin=\"2\"/>\n<wire x1=\"195.58\" y1=\"66.04\" x2=\"205.74\" y2=\"66.04\" width=\"0.1524\" layer=\"91\"/>\n<label x=\"205.74\" y=\"66.04\" size=\"1.778\" layer=\"95\" xref=\"yes\"/>\n</segment>\n</net>\n</nets>\n</sheet>\n<sheet>\n<plain>\n<text x=\"11.684\" y=\"138.684\" size=\"1.778\" layer=\"97\">U (white)</text>\n<text x=\"13.208\" y=\"141.732\" size=\"1.778\" layer=\"97\">V (blue)</text>\n<text x=\"12.192\" y=\"135.89\" size=\"1.778\" layer=\"97\">W (grey)</text>\n<text x=\"17.78\" y=\"99.06\" size=\"1.778\" layer=\"97\">Motor Power Enable</text>\n<text x=\"220.98\" y=\"154.432\" size=\"1.778\" layer=\"97\">NEC TxD</text>\n<text x=\"151.638\" y=\"154.178\" size=\"1.778\" layer=\"97\">STC RxD2</text>\n<text x=\"151.638\" y=\"141.478\" size=\"1.778\" layer=\"97\">STC TxD2</text>\n<text x=\"220.98\" y=\"141.732\" size=\"1.778\" layer=\"97\">NEC RxD</text>\n<text x=\"172.72\" y=\"165.1\" size=\"1.778\" layer=\"97\">Serial Communication between MCUs</text>\n<text x=\"217.17\" y=\"20.32\" size=\"2.54\" layer=\"94\">Daniel Nilsson</text>\n<text x=\"142.24\" y=\"58.42\" size=\"1.778\" layer=\"97\">WARNING:\nNot sure this opamp circuit is 100% correct, it looks a bit strange.\n\nOPAMP is there to amplify voltage drop over shunt\nresistors in order to get a more detailed reading with ADC.</text>\n<text x=\"80.772\" y=\"166.878\" size=\"1.778\" layer=\"97\">Motor winding temperature sensor.\nLabeled as \"T\" on hall sensor board.</text>\n<text x=\"165.1\" y=\"127\" size=\"1.778\" layer=\"97\">Some form of status LED.\nSeems to be blinking during normal operation.</text>\n<text x=\"17.78\" y=\"106.68\" size=\"1.778\" layer=\"97\">Motor Control Enable</text>\n<text x=\"17.78\" y=\"114.3\" size=\"1.778\" layer=\"97\">No effect, but should be high</text>\n</plain>\n<instances>\n<instance part=\"FRAME2\" gate=\"G$1\" x=\"0\" y=\"0\"/>\n<instance part=\"JP4\" gate=\"A\" x=\"25.4\" y=\"139.7\" rot=\"R180\"/>\n<instance part=\"+3V3\" gate=\"G$1\" x=\"40.64\" y=\"127\"/>\n<instance part=\"GND6\" gate=\"1\" x=\"50.8\" y=\"124.46\"/>\n<instance part=\"R14\" gate=\"G$1\" x=\"76.2\" y=\"147.32\"/>\n<instance part=\"R15\" gate=\"G$1\" x=\"76.2\" y=\"139.7\"/>\n<instance part=\"R16\" gate=\"G$1\" x=\"76.2\" y=\"132.08\"/>\n<instance part=\"R17\" gate=\"G$1\" x=\"111.76\" y=\"154.94\"/>\n<instance part=\"R18\" gate=\"G$1\" x=\"111.76\" y=\"142.24\"/>\n<instance part=\"R19\" gate=\"G$1\" x=\"111.76\" y=\"132.08\"/>\n<instance part=\"R21\" gate=\"G$1\" x=\"66.04\" y=\"96.52\"/>\n<instance part=\"R22\" gate=\"G$1\" x=\"78.74\" y=\"88.9\" rot=\"R90\"/>\n<instance part=\"GND7\" gate=\"1\" x=\"78.74\" y=\"76.2\"/>\n<instance part=\"C2\" gate=\"G$1\" x=\"86.36\" y=\"88.9\"/>\n<instance part=\"R23\" gate=\"G$1\" x=\"193.04\" y=\"154.94\"/>\n<instance part=\"R24\" gate=\"G$1\" x=\"193.04\" y=\"142.24\"/>\n<instance part=\"IC1\" gate=\"A\" x=\"116.84\" y=\"50.8\"/>\n<instance part=\"R31\" gate=\"G$1\" x=\"116.84\" y=\"35.56\"/>\n<instance part=\"R32\" gate=\"G$1\" x=\"104.14\" y=\"27.94\" rot=\"R90\"/>\n<instance part=\"GND9\" gate=\"1\" x=\"104.14\" y=\"17.78\"/>\n<instance part=\"R33\" gate=\"G$1\" x=\"25.4\" y=\"45.72\" rot=\"R90\"/>\n<instance part=\"R34\" gate=\"G$1\" x=\"33.02\" y=\"45.72\" rot=\"R90\"/>\n<instance part=\"GND10\" gate=\"1\" x=\"25.4\" y=\"22.86\"/>\n<instance part=\"C3\" gate=\"G$1\" x=\"66.04\" y=\"40.64\"/>\n<instance part=\"R35\" gate=\"G$1\" x=\"55.88\" y=\"53.34\" rot=\"R180\"/>\n<instance part=\"R36\" gate=\"G$1\" x=\"45.72\" y=\"60.96\" rot=\"R270\"/>\n<instance part=\"R37\" gate=\"G$1\" x=\"45.72\" y=\"73.66\" rot=\"R270\"/>\n<instance part=\"R38\" gate=\"G$1\" x=\"66.04\" y=\"66.04\" rot=\"R270\"/>\n<instance part=\"R39\" gate=\"G$1\" x=\"58.42\" y=\"165.1\"/>\n<instance part=\"C4\" gate=\"G$1\" x=\"66.04\" y=\"160.02\"/>\n<instance part=\"GND11\" gate=\"1\" x=\"66.04\" y=\"149.86\"/>\n<instance part=\"P+6\" gate=\"1\" x=\"45.72\" y=\"86.36\"/>\n<instance part=\"P+7\" gate=\"1\" x=\"154.94\" y=\"127\"/>\n<instance part=\"R40\" gate=\"G$1\" x=\"193.04\" y=\"119.38\"/>\n<instance part=\"LED1\" gate=\"G$1\" x=\"165.1\" y=\"119.38\" rot=\"R90\"/>\n<instance part=\"R20\" gate=\"G$1\" x=\"66.04\" y=\"104.14\"/>\n<instance part=\"R44\" gate=\"G$1\" x=\"66.04\" y=\"111.76\"/>\n<instance part=\"P+8\" gate=\"1\" x=\"35.56\" y=\"172.72\"/>\n<instance part=\"R47\" gate=\"G$1\" x=\"43.18\" y=\"165.1\"/>\n<instance part=\"R48\" gate=\"1\" x=\"35.56\" y=\"152.4\"/>\n<instance part=\"GND13\" gate=\"1\" x=\"27.94\" y=\"154.94\"/>\n</instances>\n<busses>\n</busses>\n<nets>\n<net name=\"+3V3\" class=\"0\">\n<segment>\n<pinref part=\"+3V3\" gate=\"G$1\" pin=\"+3V3\"/>\n<wire x1=\"40.64\" y1=\"124.46\" x2=\"40.64\" y2=\"119.38\" width=\"0.1524\" layer=\"91\"/>\n<wire x1=\"40.64\" y1=\"119.38\" x2=\"33.02\" y2=\"119.38\" width=\"0.1524\" layer=\"91\"/>\n<wire x1=\"33.02\" y1=\"119.38\" x2=\"33.02\" y2=\"132.08\" width=\"0.1524\" layer=\"91\"/>\n<pinref part=\"JP4\" gate=\"A\" pin=\"1\"/>\n<wire x1=\"33.02\" y1=\"132.08\" x2=\"27.94\" y2=\"132.08\" width=\"0.1524\" layer=\"91\"/>\n</segment>\n</net>\n<net name=\"GND\" class=\"0\">\n<segment>\n<pinref part=\"GND6\" gate=\"1\" pin=\"GND\"/>\n<wire x1=\"50.8\" y1=\"127\" x2=\"50.8\" y2=\"134.62\" width=\"0.1524\" layer=\"91\"/>\n<pinref part=\"JP4\" gate=\"A\" pin=\"2\"/>\n<wire x1=\"50.8\" y1=\"134.62\" x2=\"27.94\" y2=\"134.62\" width=\"0.1524\" layer=\"91\"/>\n</segment>\n<segment>\n<pinref part=\"R22\" gate=\"G$1\" pin=\"1\"/>\n<pinref part=\"GND7\" gate=\"1\" pin=\"GND\"/>\n<wire x1=\"78.74\" y1=\"83.82\" x2=\"78.74\" y2=\"81.28\" width=\"0.1524\" layer=\"91\"/>\n<pinref part=\"C2\" gate=\"G$1\" pin=\"2\"/>\n<wire x1=\"78.74\" y1=\"81.28\" x2=\"78.74\" y2=\"78.74\" width=\"0.1524\" layer=\"91\"/>\n<wire x1=\"86.36\" y1=\"83.82\" x2=\"86.36\" y2=\"81.28\" width=\"0.1524\" layer=\"91\"/>\n<wire x1=\"86.36\" y1=\"81.28\" x2=\"78.74\" y2=\"81.28\" width=\"0.1524\" layer=\"91\"/>\n<junction x=\"78.74\" y=\"81.28\"/>\n</segment>\n<segment>\n<pinref part=\"R32\" gate=\"G$1\" pin=\"1\"/>\n<pinref part=\"GND9\" gate=\"1\" pin=\"GND\"/>\n<wire x1=\"104.14\" y1=\"22.86\" x2=\"104.14\" y2=\"20.32\" width=\"0.1524\" layer=\"91\"/>\n</segment>\n<segment>\n<pinref part=\"R34\" gate=\"G$1\" pin=\"1\"/>\n<wire x1=\"33.02\" y1=\"40.64\" x2=\"33.02\" y2=\"35.56\" width=\"0.1524\" layer=\"91\"/>\n<wire x1=\"33.02\" y1=\"35.56\" x2=\"25.4\" y2=\"35.56\" width=\"0.1524\" layer=\"91\"/>\n<pinref part=\"R33\" gate=\"G$1\" pin=\"1\"/>\n<wire x1=\"25.4\" y1=\"35.56\" x2=\"25.4\" y2=\"40.64\" width=\"0.1524\" layer=\"91\"/>\n<pinref part=\"GND10\" gate=\"1\" pin=\"GND\"/>\n<wire x1=\"25.4\" y1=\"35.56\" x2=\"25.4\" y2=\"30.48\" width=\"0.1524\" layer=\"91\"/>\n<junction x=\"25.4\" y=\"35.56\"/>\n<wire x1=\"25.4\" y1=\"30.48\" x2=\"25.4\" y2=\"25.4\" width=\"0.1524\" layer=\"91\"/>\n<wire x1=\"66.04\" y1=\"30.48\" x2=\"25.4\" y2=\"30.48\" width=\"0.1524\" layer=\"91\"/>\n<junction x=\"25.4\" y=\"30.48\"/>\n<pinref part=\"C3\" gate=\"G$1\" pin=\"2\"/>\n<wire x1=\"66.04\" y1=\"35.56\" x2=\"66.04\" y2=\"30.48\" width=\"0.1524\" layer=\"91\"/>\n</segment>\n<segment>\n<pinref part=\"GND11\" gate=\"1\" pin=\"GND\"/>\n<pinref part=\"C4\" gate=\"G$1\" pin=\"2\"/>\n<wire x1=\"66.04\" y1=\"152.4\" x2=\"66.04\" y2=\"154.94\" width=\"0.1524\" layer=\"91\"/>\n</segment>\n<segment>\n<pinref part=\"R48\" gate=\"1\" pin=\"2\"/>\n<wire x1=\"35.56\" y1=\"157.48\" x2=\"35.56\" y2=\"160.02\" width=\"0.1524\" layer=\"91\"/>\n<wire x1=\"35.56\" y1=\"160.02\" x2=\"27.94\" y2=\"160.02\" width=\"0.1524\" layer=\"91\"/>\n<pinref part=\"GND13\" gate=\"1\" pin=\"GND\"/>\n<wire x1=\"27.94\" y1=\"160.02\" x2=\"27.94\" y2=\"157.48\" width=\"0.1524\" layer=\"91\"/>\n</segment>\n</net>\n<net name=\"N$11\" class=\"0\">\n<segment>\n<pinref part=\"JP4\" gate=\"A\" pin=\"3\"/>\n<wire x1=\"27.94\" y1=\"137.16\" x2=\"68.58\" y2=\"137.16\" width=\"0.1524\" layer=\"91\"/>\n<wire x1=\"68.58\" y1=\"137.16\" x2=\"68.58\" y2=\"132.08\" width=\"0.1524\" layer=\"91\"/>\n<pinref part=\"R16\" gate=\"G$1\" pin=\"1\"/>\n<wire x1=\"68.58\" y1=\"132.08\" x2=\"71.12\" y2=\"132.08\" width=\"0.1524\" layer=\"91\"/>\n</segment>\n</net>\n<net name=\"N$12\" class=\"0\">\n<segment>\n<pinref part=\"R15\" gate=\"G$1\" pin=\"1\"/>\n<pinref part=\"JP4\" gate=\"A\" pin=\"4\"/>\n<wire x1=\"71.12\" y1=\"139.7\" x2=\"27.94\" y2=\"139.7\" width=\"0.1524\" layer=\"91\"/>\n</segment>\n</net>\n<net name=\"N$13\" class=\"0\">\n<segment>\n<pinref part=\"R14\" gate=\"G$1\" pin=\"1\"/>\n<wire x1=\"71.12\" y1=\"147.32\" x2=\"68.58\" y2=\"147.32\" width=\"0.1524\" layer=\"91\"/>\n<wire x1=\"68.58\" y1=\"147.32\" x2=\"68.58\" y2=\"142.24\" width=\"0.1524\" layer=\"91\"/>\n<pinref part=\"JP4\" gate=\"A\" pin=\"5\"/>\n<wire x1=\"68.58\" y1=\"142.24\" x2=\"27.94\" y2=\"142.24\" width=\"0.1524\" layer=\"91\"/>\n</segment>\n</net>\n<net name=\"STC_P5.0\" class=\"0\">\n<segment>\n<pinref part=\"R15\" gate=\"G$1\" pin=\"2\"/>\n<wire x1=\"81.28\" y1=\"139.7\" x2=\"86.36\" y2=\"139.7\" width=\"0.1524\" layer=\"91\"/>\n<wire x1=\"86.36\" y1=\"139.7\" x2=\"86.36\" y2=\"137.16\" width=\"0.1524\" layer=\"91\"/>\n<wire x1=\"86.36\" y1=\"137.16\" x2=\"91.44\" y2=\"137.16\" width=\"0.1524\" layer=\"91\"/>\n<label x=\"91.44\" y=\"137.16\" size=\"1.778\" layer=\"95\" xref=\"yes\"/>\n<pinref part=\"R18\" gate=\"G$1\" pin=\"1\"/>\n<wire x1=\"106.68\" y1=\"142.24\" x2=\"86.36\" y2=\"142.24\" width=\"0.1524\" layer=\"91\"/>\n<wire x1=\"86.36\" y1=\"142.24\" x2=\"86.36\" y2=\"139.7\" width=\"0.1524\" layer=\"91\"/>\n<junction x=\"86.36\" y=\"139.7\"/>\n</segment>\n</net>\n<net name=\"STC_P3.4\" class=\"0\">\n<segment>\n<label x=\"91.44\" y=\"147.32\" size=\"1.778\" layer=\"95\" xref=\"yes\"/>\n<pinref part=\"R14\" gate=\"G$1\" pin=\"2\"/>\n<wire x1=\"81.28\" y1=\"147.32\" x2=\"86.36\" y2=\"147.32\" width=\"0.1524\" layer=\"91\"/>\n<pinref part=\"R17\" gate=\"G$1\" pin=\"1\"/>\n<wire x1=\"86.36\" y1=\"147.32\" x2=\"91.44\" y2=\"147.32\" width=\"0.1524\" layer=\"91\"/>\n<wire x1=\"106.68\" y1=\"154.94\" x2=\"86.36\" y2=\"154.94\" width=\"0.1524\" layer=\"91\"/>\n<wire x1=\"86.36\" y1=\"154.94\" x2=\"86.36\" y2=\"147.32\" width=\"0.1524\" layer=\"91\"/>\n<junction x=\"86.36\" y=\"147.32\"/>\n</segment>\n</net>\n<net name=\"STC_P0.6\" class=\"0\">\n<segment>\n<pinref part=\"R16\" gate=\"G$1\" pin=\"2\"/>\n<wire x1=\"81.28\" y1=\"132.08\" x2=\"86.36\" y2=\"132.08\" width=\"0.1524\" layer=\"91\"/>\n<wire x1=\"86.36\" y1=\"132.08\" x2=\"86.36\" y2=\"127\" width=\"0.1524\" layer=\"91\"/>\n<wire x1=\"86.36\" y1=\"127\" x2=\"91.44\" y2=\"127\" width=\"0.1524\" layer=\"91\"/>\n<label x=\"91.44\" y=\"127\" size=\"1.778\" layer=\"95\" xref=\"yes\"/>\n<pinref part=\"R19\" gate=\"G$1\" pin=\"1\"/>\n<wire x1=\"106.68\" y1=\"132.08\" x2=\"86.36\" y2=\"132.08\" width=\"0.1524\" layer=\"91\"/>\n<junction x=\"86.36\" y=\"132.08\"/>\n</segment>\n</net>\n<net name=\"NEC_P122\" class=\"0\">\n<segment>\n<pinref part=\"R17\" gate=\"G$1\" pin=\"2\"/>\n<wire x1=\"116.84\" y1=\"154.94\" x2=\"119.38\" y2=\"154.94\" width=\"0.1524\" layer=\"91\"/>\n<label x=\"119.38\" y=\"154.94\" size=\"1.778\" layer=\"95\" xref=\"yes\"/>\n</segment>\n</net>\n<net name=\"NEC_P120\" class=\"0\">\n<segment>\n<pinref part=\"R18\" gate=\"G$1\" pin=\"2\"/>\n<wire x1=\"116.84\" y1=\"142.24\" x2=\"119.38\" y2=\"142.24\" width=\"0.1524\" layer=\"91\"/>\n<label x=\"119.38\" y=\"142.24\" size=\"1.778\" layer=\"95\" xref=\"yes\"/>\n</segment>\n</net>\n<net name=\"NEC_P121\" class=\"0\">\n<segment>\n<pinref part=\"R19\" gate=\"G$1\" pin=\"2\"/>\n<wire x1=\"116.84\" y1=\"132.08\" x2=\"119.38\" y2=\"132.08\" width=\"0.1524\" layer=\"91\"/>\n<label x=\"119.38\" y=\"132.08\" size=\"1.778\" layer=\"95\" xref=\"yes\"/>\n</segment>\n</net>\n<net name=\"STC_P2.0\" class=\"0\">\n<segment>\n<wire x1=\"30.48\" y1=\"96.52\" x2=\"60.96\" y2=\"96.52\" width=\"0.1524\" layer=\"91\"/>\n<label x=\"30.48\" y=\"96.52\" size=\"1.778\" layer=\"95\" rot=\"R180\" xref=\"yes\"/>\n</segment>\n</net>\n<net name=\"NEC_P150\" class=\"0\">\n<segment>\n<pinref part=\"R21\" gate=\"G$1\" pin=\"2\"/>\n<wire x1=\"71.12\" y1=\"96.52\" x2=\"78.74\" y2=\"96.52\" width=\"0.1524\" layer=\"91\"/>\n<pinref part=\"R22\" gate=\"G$1\" pin=\"2\"/>\n<wire x1=\"78.74\" y1=\"96.52\" x2=\"78.74\" y2=\"93.98\" width=\"0.1524\" layer=\"91\"/>\n<pinref part=\"C2\" gate=\"G$1\" pin=\"1\"/>\n<wire x1=\"86.36\" y1=\"91.44\" x2=\"86.36\" y2=\"96.52\" width=\"0.1524\" layer=\"91\"/>\n<wire x1=\"86.36\" y1=\"96.52\" x2=\"78.74\" y2=\"96.52\" width=\"0.1524\" layer=\"91\"/>\n<junction x=\"78.74\" y=\"96.52\"/>\n<wire x1=\"86.36\" y1=\"96.52\" x2=\"119.38\" y2=\"96.52\" width=\"0.1524\" layer=\"91\"/>\n<junction x=\"86.36\" y=\"96.52\"/>\n<label x=\"119.38\" y=\"96.52\" size=\"1.778\" layer=\"95\" xref=\"yes\"/>\n</segment>\n</net>\n<net name=\"NEC_P73\" class=\"0\">\n<segment>\n<pinref part=\"R23\" gate=\"G$1\" pin=\"2\"/>\n<wire x1=\"198.12\" y1=\"154.94\" x2=\"205.74\" y2=\"154.94\" width=\"0.1524\" layer=\"91\"/>\n<label x=\"205.74\" y=\"154.94\" size=\"1.778\" layer=\"95\" xref=\"yes\"/>\n</segment>\n</net>\n<net name=\"NEC_P74\" class=\"0\">\n<segment>\n<pinref part=\"R24\" gate=\"G$1\" pin=\"2\"/>\n<wire x1=\"198.12\" y1=\"142.24\" x2=\"205.74\" y2=\"142.24\" width=\"0.1524\" layer=\"91\"/>\n<label x=\"205.74\" y=\"142.24\" size=\"1.778\" layer=\"95\" xref=\"yes\"/>\n</segment>\n</net>\n<net name=\"STC_P1.0\" class=\"0\">\n<segment>\n<pinref part=\"R23\" gate=\"G$1\" pin=\"1\"/>\n<wire x1=\"187.96\" y1=\"154.94\" x2=\"177.8\" y2=\"154.94\" width=\"0.1524\" layer=\"91\"/>\n<label x=\"177.8\" y=\"154.94\" size=\"1.778\" layer=\"95\" rot=\"R180\" xref=\"yes\"/>\n</segment>\n</net>\n<net name=\"STC_P1.1\" class=\"0\">\n<segment>\n<pinref part=\"R24\" gate=\"G$1\" pin=\"1\"/>\n<wire x1=\"187.96\" y1=\"142.24\" x2=\"177.8\" y2=\"142.24\" width=\"0.1524\" layer=\"91\"/>\n<label x=\"177.8\" y=\"142.24\" size=\"1.778\" layer=\"95\" rot=\"R180\" xref=\"yes\"/>\n</segment>\n</net>\n<net name=\"N$17\" class=\"0\">\n<segment>\n<pinref part=\"R31\" gate=\"G$1\" pin=\"1\"/>\n<wire x1=\"111.76\" y1=\"35.56\" x2=\"104.14\" y2=\"35.56\" width=\"0.1524\" layer=\"91\"/>\n<pinref part=\"R32\" gate=\"G$1\" pin=\"2\"/>\n<wire x1=\"104.14\" y1=\"35.56\" x2=\"104.14\" y2=\"33.02\" width=\"0.1524\" layer=\"91\"/>\n<wire x1=\"104.14\" y1=\"35.56\" x2=\"104.14\" y2=\"48.26\" width=\"0.1524\" layer=\"91\"/>\n<junction x=\"104.14\" y=\"35.56\"/>\n<pinref part=\"IC1\" gate=\"A\" pin=\"-IN\"/>\n<wire x1=\"104.14\" y1=\"48.26\" x2=\"109.22\" y2=\"48.26\" width=\"0.1524\" layer=\"91\"/>\n</segment>\n</net>\n<net name=\"LOAD\" class=\"0\">\n<segment>\n<wire x1=\"25.4\" y1=\"60.96\" x2=\"25.4\" y2=\"53.34\" width=\"0.1524\" layer=\"91\"/>\n<label x=\"25.4\" y=\"60.96\" size=\"1.778\" layer=\"95\" rot=\"R90\" xref=\"yes\"/>\n<pinref part=\"R34\" gate=\"G$1\" pin=\"2\"/>\n<wire x1=\"33.02\" y1=\"50.8\" x2=\"33.02\" y2=\"53.34\" width=\"0.1524\" layer=\"91\"/>\n<wire x1=\"33.02\" y1=\"53.34\" x2=\"25.4\" y2=\"53.34\" width=\"0.1524\" layer=\"91\"/>\n<pinref part=\"R33\" gate=\"G$1\" pin=\"2\"/>\n<wire x1=\"25.4\" y1=\"50.8\" x2=\"25.4\" y2=\"53.34\" width=\"0.1524\" layer=\"91\"/>\n<junction x=\"25.4\" y=\"53.34\"/>\n<junction x=\"33.02\" y=\"53.34\"/>\n<wire x1=\"45.72\" y1=\"55.88\" x2=\"45.72\" y2=\"53.34\" width=\"0.1524\" layer=\"91\"/>\n<pinref part=\"R36\" gate=\"G$1\" pin=\"2\"/>\n<pinref part=\"R35\" gate=\"G$1\" pin=\"2\"/>\n<wire x1=\"45.72\" y1=\"53.34\" x2=\"33.02\" y2=\"53.34\" width=\"0.1524\" layer=\"91\"/>\n<wire x1=\"50.8\" y1=\"53.34\" x2=\"45.72\" y2=\"53.34\" width=\"0.1524\" layer=\"91\"/>\n<junction x=\"45.72\" y=\"53.34\"/>\n</segment>\n</net>\n<net name=\"NEC_P25\" class=\"0\">\n<segment>\n<pinref part=\"IC1\" gate=\"A\" pin=\"OUT\"/>\n<wire x1=\"124.46\" y1=\"50.8\" x2=\"134.62\" y2=\"50.8\" width=\"0.1524\" layer=\"91\"/>\n<wire x1=\"134.62\" y1=\"50.8\" x2=\"134.62\" y2=\"35.56\" width=\"0.1524\" layer=\"91\"/>\n<pinref part=\"R31\" gate=\"G$1\" pin=\"2\"/>\n<wire x1=\"134.62\" y1=\"35.56\" x2=\"121.92\" y2=\"35.56\" width=\"0.1524\" layer=\"91\"/>\n<junction x=\"134.62\" y=\"50.8\"/>\n<wire x1=\"134.62\" y1=\"50.8\" x2=\"149.86\" y2=\"50.8\" width=\"0.1524\" layer=\"91\"/>\n<label x=\"149.86\" y=\"50.8\" size=\"1.778\" layer=\"95\" xref=\"yes\"/>\n</segment>\n</net>\n<net name=\"N$16\" class=\"0\">\n<segment>\n<pinref part=\"JP4\" gate=\"A\" pin=\"6\"/>\n<wire x1=\"27.94\" y1=\"144.78\" x2=\"35.56\" y2=\"144.78\" width=\"0.1524\" layer=\"91\"/>\n<wire x1=\"35.56\" y1=\"144.78\" x2=\"50.8\" y2=\"144.78\" width=\"0.1524\" layer=\"91\"/>\n<wire x1=\"50.8\" y1=\"144.78\" x2=\"50.8\" y2=\"165.1\" width=\"0.1524\" layer=\"91\"/>\n<pinref part=\"R39\" gate=\"G$1\" pin=\"1\"/>\n<wire x1=\"50.8\" y1=\"165.1\" x2=\"53.34\" y2=\"165.1\" width=\"0.1524\" layer=\"91\"/>\n<pinref part=\"R47\" gate=\"G$1\" pin=\"2\"/>\n<wire x1=\"48.26\" y1=\"165.1\" x2=\"50.8\" y2=\"165.1\" width=\"0.1524\" layer=\"91\"/>\n<junction x=\"50.8\" y=\"165.1\"/>\n<pinref part=\"R48\" gate=\"1\" pin=\"1\"/>\n<wire x1=\"35.56\" y1=\"147.32\" x2=\"35.56\" y2=\"144.78\" width=\"0.1524\" layer=\"91\"/>\n<junction x=\"35.56\" y=\"144.78\"/>\n</segment>\n</net>\n<net name=\"STC_P1.4\" class=\"0\">\n<segment>\n<pinref part=\"R39\" gate=\"G$1\" pin=\"2\"/>\n<pinref part=\"C4\" gate=\"G$1\" pin=\"1\"/>\n<wire x1=\"63.5\" y1=\"165.1\" x2=\"66.04\" y2=\"165.1\" width=\"0.1524\" layer=\"91\"/>\n<wire x1=\"66.04\" y1=\"165.1\" x2=\"66.04\" y2=\"162.56\" width=\"0.1524\" layer=\"91\"/>\n<wire x1=\"66.04\" y1=\"165.1\" x2=\"119.38\" y2=\"165.1\" width=\"0.1524\" layer=\"91\"/>\n<junction x=\"66.04\" y=\"165.1\"/>\n<label x=\"119.38\" y=\"165.1\" size=\"1.778\" layer=\"95\" xref=\"yes\"/>\n</segment>\n</net>\n<net name=\"N$18\" class=\"0\">\n<segment>\n<pinref part=\"R37\" gate=\"G$1\" pin=\"2\"/>\n<pinref part=\"R36\" gate=\"G$1\" pin=\"1\"/>\n<wire x1=\"45.72\" y1=\"68.58\" x2=\"45.72\" y2=\"66.04\" width=\"0.1524\" layer=\"91\"/>\n</segment>\n</net>\n<net name=\"+5V\" class=\"0\">\n<segment>\n<pinref part=\"P+6\" gate=\"1\" pin=\"+5V\"/>\n<pinref part=\"R37\" gate=\"G$1\" pin=\"1\"/>\n<wire x1=\"45.72\" y1=\"83.82\" x2=\"45.72\" y2=\"81.28\" width=\"0.1524\" layer=\"91\"/>\n<pinref part=\"R38\" gate=\"G$1\" pin=\"1\"/>\n<wire x1=\"45.72\" y1=\"81.28\" x2=\"45.72\" y2=\"78.74\" width=\"0.1524\" layer=\"91\"/>\n<wire x1=\"66.04\" y1=\"71.12\" x2=\"66.04\" y2=\"81.28\" width=\"0.1524\" layer=\"91\"/>\n<wire x1=\"66.04\" y1=\"81.28\" x2=\"45.72\" y2=\"81.28\" width=\"0.1524\" layer=\"91\"/>\n<junction x=\"45.72\" y=\"81.28\"/>\n</segment>\n<segment>\n<pinref part=\"P+7\" gate=\"1\" pin=\"+5V\"/>\n<wire x1=\"154.94\" y1=\"124.46\" x2=\"154.94\" y2=\"119.38\" width=\"0.1524\" layer=\"91\"/>\n<pinref part=\"LED1\" gate=\"G$1\" pin=\"A\"/>\n<wire x1=\"154.94\" y1=\"119.38\" x2=\"162.56\" y2=\"119.38\" width=\"0.1524\" layer=\"91\"/>\n</segment>\n<segment>\n<pinref part=\"P+8\" gate=\"1\" pin=\"+5V\"/>\n<wire x1=\"35.56\" y1=\"170.18\" x2=\"35.56\" y2=\"165.1\" width=\"0.1524\" layer=\"91\"/>\n<pinref part=\"R47\" gate=\"G$1\" pin=\"1\"/>\n<wire x1=\"35.56\" y1=\"165.1\" x2=\"38.1\" y2=\"165.1\" width=\"0.1524\" layer=\"91\"/>\n</segment>\n</net>\n<net name=\"N$19\" class=\"0\">\n<segment>\n<pinref part=\"C3\" gate=\"G$1\" pin=\"1\"/>\n<pinref part=\"R35\" gate=\"G$1\" pin=\"1\"/>\n<wire x1=\"60.96\" y1=\"53.34\" x2=\"66.04\" y2=\"53.34\" width=\"0.1524\" layer=\"91\"/>\n<pinref part=\"R38\" gate=\"G$1\" pin=\"2\"/>\n<wire x1=\"66.04\" y1=\"53.34\" x2=\"66.04\" y2=\"43.18\" width=\"0.1524\" layer=\"91\"/>\n<wire x1=\"66.04\" y1=\"60.96\" x2=\"66.04\" y2=\"53.34\" width=\"0.1524\" layer=\"91\"/>\n<junction x=\"66.04\" y=\"53.34\"/>\n<wire x1=\"66.04\" y1=\"53.34\" x2=\"109.22\" y2=\"53.34\" width=\"0.1524\" layer=\"91\"/>\n<junction x=\"66.04\" y=\"53.34\"/>\n<pinref part=\"IC1\" gate=\"A\" pin=\"+IN\"/>\n</segment>\n</net>\n<net name=\"N$20\" class=\"0\">\n<segment>\n<pinref part=\"LED1\" gate=\"G$1\" pin=\"C\"/>\n<pinref part=\"R40\" gate=\"G$1\" pin=\"1\"/>\n<wire x1=\"170.18\" y1=\"119.38\" x2=\"187.96\" y2=\"119.38\" width=\"0.1524\" layer=\"91\"/>\n</segment>\n</net>\n<net name=\"NEC_P70\" class=\"0\">\n<segment>\n<pinref part=\"R40\" gate=\"G$1\" pin=\"2\"/>\n<wire x1=\"198.12\" y1=\"119.38\" x2=\"205.74\" y2=\"119.38\" width=\"0.1524\" layer=\"91\"/>\n<label x=\"205.74\" y=\"119.38\" size=\"1.778\" layer=\"95\" xref=\"yes\"/>\n</segment>\n</net>\n<net name=\"STC_P2.1\" class=\"0\">\n<segment>\n<pinref part=\"R20\" gate=\"G$1\" pin=\"1\"/>\n<wire x1=\"60.96\" y1=\"104.14\" x2=\"30.48\" y2=\"104.14\" width=\"0.1524\" layer=\"91\"/>\n<label x=\"30.48\" y=\"104.14\" size=\"1.778\" layer=\"95\" rot=\"R180\" xref=\"yes\"/>\n</segment>\n</net>\n<net name=\"NEC_P23\" class=\"0\">\n<segment>\n<pinref part=\"R20\" gate=\"G$1\" pin=\"2\"/>\n<wire x1=\"71.12\" y1=\"104.14\" x2=\"119.38\" y2=\"104.14\" width=\"0.1524\" layer=\"91\"/>\n<label x=\"119.38\" y=\"104.14\" size=\"1.778\" layer=\"95\" xref=\"yes\"/>\n</segment>\n</net>\n<net name=\"STC_P4.4\" class=\"0\">\n<segment>\n<pinref part=\"R44\" gate=\"G$1\" pin=\"1\"/>\n<wire x1=\"60.96\" y1=\"111.76\" x2=\"30.48\" y2=\"111.76\" width=\"0.1524\" layer=\"91\"/>\n<label x=\"30.48\" y=\"111.76\" size=\"1.778\" layer=\"95\" rot=\"R180\" xref=\"yes\"/>\n</segment>\n</net>\n<net name=\"NEC_P22\" class=\"0\">\n<segment>\n<pinref part=\"R44\" gate=\"G$1\" pin=\"2\"/>\n<wire x1=\"71.12\" y1=\"111.76\" x2=\"119.38\" y2=\"111.76\" width=\"0.1524\" layer=\"91\"/>\n<label x=\"119.38\" y=\"111.76\" size=\"1.778\" layer=\"95\" xref=\"yes\"/>\n</segment>\n</net>\n</nets>\n</sheet>\n</sheets>\n</schematic>\n</drawing>\n<compatibility>\n<note version=\"6.3\" minversion=\"6.2.2\" severity=\"warning\">\nSince Version 6.2.2 text objects can contain more than one line,\nwhich will not be processed correctly with this version.\n</note>\n</compatibility>\n</eagle>\n"
  },
  {
    "path": "drawings/pcb/eagle.epf",
    "content": "[Eagle]\nVersion=\"07 05 00\"\nPlatform=\"Windows\"\nSerial=\"62191E841E-LSR-WLM-1EL\"\nGlobals=\"Globals\"\nDesktop=\"Desktop\"\n\n[Globals]\nAutoSaveProject=1\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/19inch.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/40xx.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/41xx.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/45xx.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/74ac-logic.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/74ttl-din.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/74xx-eu.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/74xx-little-de.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/74xx-little-us.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/74xx-us.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/751xx.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/IQD-Frequency-Products.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/advanced-test-technologies.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/agilent-technologies.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/allegro.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/altera-cyclone-II.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/altera-cyclone-III.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/altera-stratix-iv.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/altera.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/am29-memory.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/amd-mach.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/amd.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/amis.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/analog-devices.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/aplus.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/ase.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/atmel.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/austriamicrosystems.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/avago.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/axis.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/battery.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/belton-engineering.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/burr-brown.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/busbar.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/buzzer.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/c-trimm.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/california-micro-devices.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/capacitor-wima.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/chipcard-siemens.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/cirrus-logic.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/con-3m.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/con-4ucon.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/con-amp-champ.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/con-amp-micromatch.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/con-amp-mt.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/con-amp-mt6.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/con-amp-quick.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/con-amp-te.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/con-amp.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/con-amphenol.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/con-avx.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/con-berg.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/con-bosch.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/con-chipcard-iso7816.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/con-coax.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/con-commcon.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/con-conrad.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/con-cpci.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/con-cui.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/con-cypressindustries.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/con-deutsch.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/con-dil.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/con-ebyelectro.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/con-elco.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/con-erni.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/con-faston.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/con-fci.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/con-friwo.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/con-garry.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/con-harting-h.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/con-harting-ml.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/con-harting-v.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/con-harting.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/con-hirose.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/con-hirschmann.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/con-jack.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/con-jae.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/con-jst.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/con-kycon.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/con-kyocera-elco.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/con-lemo.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/con-leotronics.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/con-lsta.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/con-lstb.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/con-lumberg.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/con-ml.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/con-molex.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/con-neutrik_ag.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/con-omron.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/con-panasonic.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/con-panduit.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/con-pc.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/con-pc104.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/con-phoenix-254.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/con-phoenix-3.81.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/con-phoenix-350.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/con-phoenix-500.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/con-phoenix-508.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/con-phoenix-762.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/con-phoenix-me_max.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/con-phoenix-mkds_5.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/con-phoenix-smkdsp.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/con-ptr500.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/con-pulse.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/con-rib.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/con-samtec.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/con-shallin.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/con-shiua-chyuan.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/con-stewart.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/con-stocko.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/con-subd.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/con-sullinselectronics.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/con-thomas-betts.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/con-tyco.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/con-tycoelectronics.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/con-vg.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/con-wago-500.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/con-wago-508.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/con-wago.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/con-wago255.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/con-weidmueller-sl35.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/con-wenzhou-yihua.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/con-xmultiple.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/con-yamaichi.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/crystal.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/csr.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/cypress.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/davicom.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/dc-dc-converter.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/dimensions.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/diode.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/discrete.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/display-hp.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/display-kingbright.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/display-lcd.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/docu-dummy.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/dom-key.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/eagle-ltspice.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/ecl.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/em-microelectronic.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/etx-board.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/exar.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/fairchild-semic.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/farnell.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/fiber-optic-hp.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/fiber-optic-siemens.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/fifo.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/flexipanel.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/fox-electronics.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/frames.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/freescale.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/ftdichip.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/fujitsu.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/fuse.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/gennum.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/halo-electronics.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/heatsink.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/holes.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/holtek.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/ic-package.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/inductor-coilcraft.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/inductor-neosid.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/inductor-nkl.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/inductors.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/infineon-tricore.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/infineon.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/intersil-techwell.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/intersil.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/ir.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/isd.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/johanson-technology.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/jump-0r-smd.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/jumper.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/lantronix.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/lattice.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/lc-filter.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/led-7-segment.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/led-citizen-electronics.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/led-lumiled.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/led.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/lem.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/linear-technology.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/linear.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/linx.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/logo.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/lprs.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/lsi-computer-systems.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/lumiled.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/marks.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/maxim.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/maxstream.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/melexis.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/memory-hitachi.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/memory-idt.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/memory-micron.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/memory-motorola-dram.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/memory-nec.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/memory-samsung.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/memory-sram.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/memory.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/mems.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/micrel.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/micro-cyrod.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/micro-fujitsu.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/micro-harris.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/micro-hitachi.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/micro-infineon.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/micro-intel.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/micro-mc68000.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/micro-motorola.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/micro-philips.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/micro-renesas.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/micro-samsung.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/micro-siemens.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/microchip.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/micron.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/micronas.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/microphon.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/microwave.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/midori-sensor.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/minicircuits.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/mitsubishi-semiconductor.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/motorola-sensor-driver.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/murata-filter.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/murata-sensor.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/nanotec.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/national-instruments.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/national-semiconductor.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/nec-lqfp100-pack.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/nec.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/nrj-semiconductor.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/omnivision.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/on-semiconductor.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/opto-honeywell-3000.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/opto-honeywell-4000.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/opto-honeywell.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/opto-micro-linear.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/opto-trans-siemens.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/opto-transmittter-hp.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/opto-vishay.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/optocoupler.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/pal.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/philips-semiconductors.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/photo-elements.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/piher.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/pinhead.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/plcc-socket.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/pld-intel.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/plxtech.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/pot-vitrohm.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/pot-xicor.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/pot.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/ptc-ntc.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/quantum-research-group.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/rcl.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/recom-international.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/rectifier.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/ref-packages-longpad.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/ref-packages.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/relay.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/renesas.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/resistor-bourns.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/resistor-dil.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/resistor-net.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/resistor-power.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/resistor-ruf.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/resistor-shunt.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/resistor-sil.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/resistor.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/rf-micro-devices.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/rf-solutions.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/rohm.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/roundsolutions.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/semicon-smd-ipc.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/sensor-comus-group.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/sensor-heraeus.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/sensor-infratec.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/sharp.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/silabs.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/sim-technology.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/sipex.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/smd-ipc.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/smd-special.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/solomon-systech.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/solpad.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/speaker.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/special-drill.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/special.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/st-microelectronics.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/stm32xx.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/supertex.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/supply1.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/supply2.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/switch-alps.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/switch-coto.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/switch-dil.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/switch-misc.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/switch-omron.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/switch-raychem.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/switch-reed.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/switch.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/telcom.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/telecontrolli.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/telefunken.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/testpad.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/texas-sn55-sn75.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/texas.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/toshiba.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/traco-electronic.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/trafo-bei.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/trafo-hammondmfg.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/trafo-siemens.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/trafo-xicon.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/trafo.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/transformer-pulse.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/transistor-fet.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/transistor-neu-to92.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/transistor-npn.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/transistor-pnp.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/transistor-power.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/transistor-small-signal.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/transistor.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/triac.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/trimble.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/tripas.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/u-blox.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/uln-udn.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/v-reg-micrel.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/v-reg.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/varistor.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/wafer-scale-psd.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/wirepad.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/xicor.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/xilinx-virtex-v5.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/xilinx-xc18v.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/xilinx-xc9.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/xilinx-xcv.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/zetex.lbr\"\nUsedLibrary=\"C:/Program Files/EAGLE-7.5.0/lbr/zilog.lbr\"\nUsedLibrary=\"D:/Projects/Git/components/eagle-lbr/adafruit.lbr\"\nUsedLibrary=\"D:/Projects/Git/components/eagle-lbr/bss138_10.lbr\"\nUsedLibrary=\"D:/Projects/Git/components/eagle-lbr/con-jst2.lbr\"\nUsedLibrary=\"D:/Projects/Git/components/eagle-lbr/con-usb-2.lbr\"\nUsedLibrary=\"D:/Projects/Git/components/eagle-lbr/con-usb-3.lbr\"\nUsedLibrary=\"D:/Projects/Git/components/eagle-lbr/con-usb.lbr\"\nUsedLibrary=\"D:/Projects/Git/components/eagle-lbr/esp32.lbr\"\nUsedLibrary=\"D:/Projects/Git/components/eagle-lbr/esp8266-esp12.lbr\"\nUsedLibrary=\"D:/Projects/Git/components/eagle-lbr/ic.lbr\"\nUsedLibrary=\"D:/Projects/Git/components/eagle-lbr/microusb.lbr\"\nUsedLibrary=\"D:/Projects/Git/components/eagle-lbr/motor-driver.lbr\"\nUsedLibrary=\"D:/Projects/Git/components/eagle-lbr/photo-interrupter.lbr\"\nUsedLibrary=\"D:/Projects/Git/components/eagle-lbr/potentiometers.lbr\"\nUsedLibrary=\"D:/Projects/Git/components/eagle-lbr/regulators.lbr\"\nUsedLibrary=\"D:/Projects/Git/components/eagle-lbr/smps.lbr\"\nUsedLibrary=\"D:/Projects/Git/components/eagle-lbr/stm32.lbr\"\nUsedLibrary=\"D:/Projects/Git/components/eagle-lbr/switch-tact.lbr\"\nUsedLibrary=\"D:/Projects/Git/components/eagle-lbr/sparkfun/power-ic.lbr\"\nUsedLibrary=\"D:/Projects/Git/components/eagle-lbr/sparkfun/SparkFun-Aesthetics.lbr\"\nUsedLibrary=\"D:/Projects/Git/components/eagle-lbr/sparkfun/SparkFun-Batteries.lbr\"\nUsedLibrary=\"D:/Projects/Git/components/eagle-lbr/sparkfun/SparkFun-Boards.lbr\"\nUsedLibrary=\"D:/Projects/Git/components/eagle-lbr/sparkfun/SparkFun-Capacitors.lbr\"\nUsedLibrary=\"D:/Projects/Git/components/eagle-lbr/sparkfun/SparkFun-Clocks.lbr\"\nUsedLibrary=\"D:/Projects/Git/components/eagle-lbr/sparkfun/SparkFun-Coils.lbr\"\nUsedLibrary=\"D:/Projects/Git/components/eagle-lbr/sparkfun/SparkFun-Connectors.lbr\"\nUsedLibrary=\"D:/Projects/Git/components/eagle-lbr/sparkfun/SparkFun-DigitalIC.lbr\"\nUsedLibrary=\"D:/Projects/Git/components/eagle-lbr/sparkfun/SparkFun-DiscreteSemi.lbr\"\nUsedLibrary=\"D:/Projects/Git/components/eagle-lbr/sparkfun/SparkFun-Displays.lbr\"\nUsedLibrary=\"D:/Projects/Git/components/eagle-lbr/sparkfun/SparkFun-Electromechanical.lbr\"\nUsedLibrary=\"D:/Projects/Git/components/eagle-lbr/sparkfun/SparkFun-FreqCtrl.lbr\"\nUsedLibrary=\"D:/Projects/Git/components/eagle-lbr/sparkfun/SparkFun-Fuses.lbr\"\nUsedLibrary=\"D:/Projects/Git/components/eagle-lbr/sparkfun/SparkFun-GPS.lbr\"\nUsedLibrary=\"D:/Projects/Git/components/eagle-lbr/sparkfun/SparkFun-Hardware.lbr\"\nUsedLibrary=\"D:/Projects/Git/components/eagle-lbr/sparkfun/SparkFun-IC-Amplifiers.lbr\"\nUsedLibrary=\"D:/Projects/Git/components/eagle-lbr/sparkfun/SparkFun-IC-Comms.lbr\"\nUsedLibrary=\"D:/Projects/Git/components/eagle-lbr/sparkfun/SparkFun-IC-Conversion.lbr\"\nUsedLibrary=\"D:/Projects/Git/components/eagle-lbr/sparkfun/SparkFun-IC-Logic.lbr\"\nUsedLibrary=\"D:/Projects/Git/components/eagle-lbr/sparkfun/SparkFun-IC-Memory.lbr\"\nUsedLibrary=\"D:/Projects/Git/components/eagle-lbr/sparkfun/SparkFun-IC-Microcontroller.lbr\"\nUsedLibrary=\"D:/Projects/Git/components/eagle-lbr/sparkfun/SparkFun-IC-Power.lbr\"\nUsedLibrary=\"D:/Projects/Git/components/eagle-lbr/sparkfun/SparkFun-IC-Special-Function.lbr\"\nUsedLibrary=\"D:/Projects/Git/components/eagle-lbr/sparkfun/SparkFun-Jumpers.lbr\"\nUsedLibrary=\"D:/Projects/Git/components/eagle-lbr/sparkfun/SparkFun-LED.lbr\"\nUsedLibrary=\"D:/Projects/Git/components/eagle-lbr/sparkfun/SparkFun-PowerSymbols.lbr\"\nUsedLibrary=\"D:/Projects/Git/components/eagle-lbr/sparkfun/SparkFun-Resistors.lbr\"\nUsedLibrary=\"D:/Projects/Git/components/eagle-lbr/sparkfun/SparkFun-Retired.lbr\"\nUsedLibrary=\"D:/Projects/Git/components/eagle-lbr/sparkfun/SparkFun-RF.lbr\"\nUsedLibrary=\"D:/Projects/Git/components/eagle-lbr/sparkfun/SparkFun-Switches.lbr\"\nUsedLibrary=\"D:/Projects/Git/components/eagle-lbr/sparkfun/SparkFun-Sensors.lbr\"\nUsedLibrary=\"D:/Projects/Git/components/eagle-lbr/sparkfun/User-Submitted.lbr\"\nUsedLibrary=\"D:/Projects/Git/components/eagle-lbr/element14/atmel_element14.lbr\"\n\n[Win_1]\nType=\"Control Panel\"\nLoc=\"-8 -8 2551 1368\"\nState=1\nNumber=0\n\n[Desktop]\nScreen=\"2560 1440\"\nWindow=\"Win_1\"\n"
  },
  {
    "path": "src/firmware/.gitignore",
    "content": "**/*.asm\n**/*.elf\n**/*.ihx\n**/*.cdb\n**/*.lk\n**/*.map\n**/*.adb\n**/*.lst\n**/*.rel\n**/*.rst\n**/*.sym\n\n*.hex\n*.mem\n.vs\nbuild\n*.vcxproj.user"
  },
  {
    "path": "src/firmware/Makefile",
    "content": ".PHONY: all clean\n\nifeq '$(findstring ;,$(PATH))' ';'\n\tUNAME := Windows\nelse\n\tUNAME := $(shell uname 2>/dev/null || echo Unknown)\nendif\n\n# Select target controller (normally done from cmd line):\n#TARGET_CONTROLLER = BBSHD\n#TARGET_CONTROLLER = BBS02\n#TARGET_CONTROLLER = TSDZ2\n\n# Compiler\nCC = sdcc\n\n# Target name\nTARGET = bbs-fw\n\nMAINSRC = main.c\nSUBDIRS = \n\t\t\nCFLAGS = -Ddouble=float --std-c99 -D$(TARGET_CONTROLLER)\n\t\n# Target Specific\nifeq ($(TARGET_CONTROLLER), BBSHD)\n\tCFLAGS += -mmcs51 --model-large --xram-size 3840\t\n\tSUBDIRS += bbsx\t\nendif\n\nifeq ($(TARGET_CONTROLLER), BBS02)\n\tCFLAGS += -mmcs51 --model-large --xram-size 1792\n\tSUBDIRS += bbsx\nendif\n\nifeq ($(TARGET_CONTROLLER), TSDZ2)\n\tCFLAGS += -mstm8\n\tSUBDIRS += tsdz2\nendif\n\n\n\t\nINCS = $(wildcard *.h $(foreach fd, $(SUBDIRS), $(fd)/*.h))\nSRCS = $(filter-out main.c, $(wildcard *.c $(foreach fd, $(SUBDIRS), $(fd)/*.c)))\nRELS := $(SRCS:.c=.rel)\n\nINC_DIRS = -I./ $(addprefix -I, $(SUBDIRS))\n\n\nall: precheck $(TARGET) hex\n\t\n$(TARGET): $(MAINSRC) $(RELS)\n\t$(CC) -o $(TARGET).ihx $(INC_DIRS) $(CFLAGS) $(MAINSRC) $(RELS)\n\n%.rel: %.c $(INCS)\n\t$(CC) -o $@ -c $(INC_DIRS) $(CFLAGS) $<\n\necho:\n\t$(info SRCS: $(SRCS))\n\t$(info RELS: $(RELS))\n\t$(info INCS: $(INCS))\n\nprecheck:\nifndef TARGET_CONTROLLER\n\t$(info TARGET_CONTROLLER is not specified.)\n\t$(info Set to one of [BBSHD, BBS02, TSDZ2])\n\t$(info Example:)\n\t$(info $(null)  make all TARGET_CONTROLLER=BBSHD)\n\t$(error )\nendif\n\t$(info Building bbs-fw for $(TARGET_CONTROLLER))\n\nhex:\nifeq ($(UNAME), Linux)\n\t@packihx bbs-fw.ihx > bbs-fw.hex\nelse\n\t@cmd /C tohex.bat\nendif\n\nclean:\nifeq ($(UNAME), Linux)\n\t@rm -f bbsx/*.hex tsdz2/*.hex *.hex\n\t@rm -f bbsx/*.ihx tsdz2/*.ihx *.ihx\n\t@rm -f bbsx/*.asm tsdz2/*.asm *.asm\n\t@rm -f bbsx/*.rel tsdz2/*.rel *.rel\n\t@rm -f bbsx/*.lk  tsdz2/*.lk  *.lk\n\t@rm -f bbsx/*.lst tsdz2/*.lst *.lst\n\t@rm -f bbsx/*.rst tsdz2/*.rst *.rst\n\t@rm -f bbsx/*.sym tsdz2/*.sym *.sym\n\t@rm -f bbsx/*.cdb tsdz2/*.cdb *.cdb\n\t@rm -f bbsx/*.map tsdz2/*.map *.map\n\t@rm -f bbsx/*.elf tsdz2/*.elf *.elf\n\t@rm -f bbsx/*.adb tsdz2/*.adb *.adb\n\t@rm -f bbsx/*.mem tsdz2/*.mem *.mem\nelse\n\t@cmd /C clean.bat\nendif\n\t$(info Clean Finished)\n\n.PHONY = all hex clean precheck echo\n.SUFFIXES: .c .rel\n"
  },
  {
    "path": "src/firmware/adc.h",
    "content": "/*\r\n * bbs-fw\r\n *\r\n * Copyright (C) Daniel Nilsson, 2022.\r\n *\r\n * Released under the GPL License, Version 3\r\n */\r\n\r\n#ifndef _ADC_H_\r\n#define _ADC_H_\r\n#include <stdint.h>\r\n\r\nvoid adc_init();\r\nvoid adc_process();\r\n\r\nuint8_t adc_get_throttle();\r\nuint16_t adc_get_torque();\r\n\r\nuint16_t adc_get_temperature_contr();\r\nuint16_t adc_get_temperature_motor();\r\n\r\nuint16_t adc_get_battery_voltage();\r\n\r\n#endif\r\n"
  },
  {
    "path": "src/firmware/app.c",
    "content": "/*\r\n * bbs-fw\r\n *\r\n * Copyright (C) Daniel Nilsson, 2022.\r\n *\r\n * Released under the GPL License, Version 3\r\n */\r\n\r\n#include \"app.h\"\r\n#include \"fwconfig.h\"\r\n#include \"cfgstore.h\"\r\n#include \"motor.h\"\r\n#include \"sensors.h\"\r\n#include \"throttle.h\"\r\n#include \"lights.h\"\r\n#include \"uart.h\"\r\n#include \"eventlog.h\"\r\n#include \"util.h\"\r\n#include \"system.h\"\r\n\r\n\r\ntypedef struct\r\n{\r\n\tassist_level_t level;\r\n\r\n\t// cached precomputed values\r\n\t// ---------------------------------\r\n\r\n\t// speed\r\n\tint32_t max_wheel_speed_rpm_x10;\r\n\r\n\t// pas\r\n\tuint8_t keep_current_target_percent;\r\n\tuint16_t keep_current_ramp_start_rpm_x10;\r\n\tuint16_t keep_current_ramp_end_rpm_x10;\r\n\r\n} assist_level_data_t;\r\n\r\nstatic uint8_t assist_level;\r\nstatic uint8_t operation_mode;\r\nstatic uint16_t global_speed_limit_rpm;\r\nstatic int32_t global_throttle_speed_limit_rpm_x10;\r\n\r\nstatic uint16_t lvc_voltage_x100;\r\nstatic uint16_t lvc_ramp_down_start_voltage_x100;\r\nstatic uint16_t lvc_ramp_down_end_voltage_x100;\r\n\r\nstatic assist_level_data_t assist_level_data;\r\nstatic uint16_t speed_limit_ramp_interval_rpm_x10;\r\n\r\nstatic bool cruise_paused;\r\nstatic int8_t temperature_contr_c;\r\nstatic int8_t temperature_motor_c;\r\n\r\nstatic uint16_t ramp_up_current_interval_ms;\r\nstatic uint32_t power_blocked_until_ms;\r\n\r\nstatic uint16_t pretension_cutoff_speed_rpm_x10;\r\n\r\nstatic bool lights_state = false;\r\n\r\nvoid apply_pas_cadence(uint8_t* target_current, uint8_t throttle_percent);\r\n#if HAS_TORQUE_SENSOR\r\nvoid apply_pas_torque(uint8_t* target_current);\r\n#endif\r\n\r\nvoid apply_pretension(uint8_t* target_current);\r\nvoid apply_cruise(uint8_t* target_current, uint8_t throttle_percent);\r\nbool apply_throttle(uint8_t* target_current, uint8_t throttle_percent);\r\nbool apply_speed_limit(uint8_t* target_current, uint8_t throttle_percent, bool pas_engaged, bool throttle_override);\r\nbool apply_thermal_limit(uint8_t* target_current);\r\nbool apply_low_voltage_limit(uint8_t* target_current);\r\nbool apply_shift_sensor_interrupt(uint8_t* target_current);\r\nbool apply_brake(uint8_t* target_current);\r\nvoid apply_current_ramp_up(uint8_t* target_current, bool enable);\r\nvoid apply_current_ramp_down(uint8_t* target_current, bool enable);\r\n\r\nbool check_power_block();\r\nvoid block_power_for(uint16_t ms);\r\n\r\nvoid reload_assist_params();\r\n\r\nuint16_t convert_wheel_speed_kph_to_rpm(uint8_t speed_kph);\r\n\r\nvoid app_init()\r\n{\r\n\tmotor_disable();\r\n\tlights_disable();\r\n\tlights_set(g_config.lights_mode == LIGHTS_MODE_ALWAYS_ON);\r\n\r\n\tlvc_voltage_x100 = g_config.low_cut_off_v * 100u;\r\n\r\n\tuint16_t full_voltage_range_x100 =\r\n\t\tEXPAND_U16(g_config.max_battery_x100v_u16h, g_config.max_battery_x100v_u16l) - lvc_voltage_x100;\r\n\tuint16_t padded_voltage_range_x100 = (uint16_t)(full_voltage_range_x100 *\r\n\t\t(100 - BATTERY_FULL_OFFSET_PERCENT - BATTERY_EMPTY_OFFSET_PERCENT) / 100);\r\n\r\n\tlvc_ramp_down_end_voltage_x100 = (uint16_t)(lvc_voltage_x100 +\r\n\t\t(full_voltage_range_x100 * BATTERY_EMPTY_OFFSET_PERCENT / 100));\r\n\tlvc_ramp_down_start_voltage_x100 = (uint16_t)(lvc_ramp_down_end_voltage_x100 +\r\n\t\t((padded_voltage_range_x100 * LVC_RAMP_DOWN_OFFSET_PERCENT) / 100));\r\n\r\n\tglobal_speed_limit_rpm = 0;\r\n\tglobal_throttle_speed_limit_rpm_x10 = 0;\r\n\ttemperature_contr_c = 0;\r\n\ttemperature_motor_c = 0;\r\n\r\n\tramp_up_current_interval_ms = (g_config.max_current_amps * 10u) / g_config.current_ramp_amps_s;\r\n\tpower_blocked_until_ms = 0;\r\n\r\n\tspeed_limit_ramp_interval_rpm_x10 = convert_wheel_speed_kph_to_rpm(SPEED_LIMIT_RAMP_DOWN_INTERVAL_KPH) * 10;\r\n\r\n\tpretension_cutoff_speed_rpm_x10 = convert_wheel_speed_kph_to_rpm(g_config.pretension_speed_cutoff_kph) * 10;\r\n\r\n\tcruise_paused = true;\r\n\toperation_mode = OPERATION_MODE_DEFAULT;\r\n\r\n\tapp_set_wheel_max_speed_rpm(convert_wheel_speed_kph_to_rpm(g_config.max_speed_kph));\r\n\tapp_set_assist_level(g_config.assist_startup_level);\r\n\treload_assist_params();\r\n\r\n\tif (g_config.assist_mode_select == ASSIST_MODE_SELECT_BRAKE_BOOT && brake_is_activated())\r\n\t{\r\n\t\tapp_set_operation_mode(OPERATION_MODE_SPORT);\r\n\t}\r\n}\r\n\r\nvoid app_process()\r\n{\r\n\tuint8_t target_current = 0;\r\n\tuint8_t target_cadence = assist_level_data.level.max_cadence_percent;\r\n\tuint8_t throttle_percent = throttle_map_response(throttle_read());\r\n\r\n\tbool pas_engaged = false;\r\n\tbool throttle_override = false;\r\n\r\n\tif (check_power_block())\r\n\t{\r\n\t\ttarget_current = 0;\r\n\t}\r\n\telse if (assist_level == ASSIST_PUSH && g_config.use_push_walk)\r\n\t{\r\n\t\ttarget_current = 10;\r\n\t}\r\n\telse\r\n\t{\r\n\t\tapply_pretension(&target_current);\r\n\t\tapply_pas_cadence(&target_current, throttle_percent);\r\n#if HAS_TORQUE_SENSOR\r\n\t\tapply_pas_torque(&target_current);\r\n#endif // HAS_TORQUE_SENSOR\r\n\r\n\t\tpas_engaged = target_current > 0;\r\n\r\n\t\tapply_cruise(&target_current, throttle_percent);\r\n\r\n\t\tthrottle_override = apply_throttle(&target_current, throttle_percent);\r\n\r\n\t\t// override target cadence if configured in assist level\r\n\t\tif (throttle_override &&\r\n\t\t\t(assist_level_data.level.flags & ASSIST_FLAG_PAS) &&\r\n\t\t\t(assist_level_data.level.flags & ASSIST_FLAG_OVERRIDE_CADENCE))\r\n\t\t{\r\n\t\t\ttarget_cadence = THROTTLE_CADENCE_OVERRIDE_PERCENT;\r\n\t\t}\r\n\t}\r\n\r\n\tbool speed_limiting = apply_speed_limit(&target_current, throttle_percent, pas_engaged, throttle_override);\r\n\tbool thermal_limiting = apply_thermal_limit(&target_current);\r\n\tbool lvc_limiting = apply_low_voltage_limit(&target_current);\r\n\tbool shift_limiting =\r\n#if HAS_SHIFT_SENSOR_SUPPORT\r\n\t\tapply_shift_sensor_interrupt(&target_current);\r\n#else\r\n\t\tfalse;\r\n#endif\r\n\tbool is_limiting = speed_limiting || thermal_limiting || lvc_limiting || shift_limiting;\r\n\tbool is_braking = apply_brake(&target_current);\r\n\r\n\tapply_current_ramp_up(&target_current, is_limiting || !throttle_override);\r\n\tapply_current_ramp_down(&target_current, !is_braking && !shift_limiting);\r\n\r\n\tmotor_set_target_speed(target_cadence);\r\n\tmotor_set_target_current(target_current);\r\n\r\n\tif (target_current > 0)\r\n\t{\r\n\t\tmotor_enable();\r\n\t}\r\n\telse\r\n\t{\r\n\t\tmotor_disable();\r\n\t}\r\n\r\n\tif (g_config.lights_mode == LIGHTS_MODE_DISABLED /*|| (motor_status() & MOTOR_ERROR_LVC) */)\r\n\t{\r\n\t\tlights_disable();\r\n\t}\r\n\telse\r\n\t{\r\n\t\tlights_enable();\r\n\t}\r\n}\r\n\r\n\r\nvoid app_set_assist_level(uint8_t level)\r\n{\r\n\tif (assist_level != level)\r\n\t{\r\n\t\tif (assist_level == ASSIST_PUSH && g_config.use_push_walk)\r\n\t\t{\r\n\t\t\t// When releasig push walk mode pedals may have been rotating\r\n\t\t\t// with the motor, block motor power for 2 seconds to prevent PAS\r\n\t\t\t// sensor from incorrectly applying power if returning to a PAS level.\r\n\t\t\tblock_power_for(1000);\r\n\t\t}\r\n\r\n\t\tassist_level = level;\r\n\t\teventlog_write_data(EVT_DATA_ASSIST_LEVEL, assist_level);\r\n\t\treload_assist_params();\r\n\t}\r\n}\r\n\r\nvoid app_set_lights(bool on)\r\n{\r\n\tif ( // it's ok to write ugly code if you say it's ugly...\r\n\t\t(g_config.assist_mode_select == ASSIST_MODE_SELECT_LIGHTS) ||\r\n\t\t(assist_level == ASSIST_0 && g_config.assist_mode_select == ASSIST_MODE_SELECT_PAS0_LIGHT) ||\r\n\t\t(assist_level == ASSIST_1 && g_config.assist_mode_select == ASSIST_MODE_SELECT_PAS1_LIGHT) ||\r\n\t\t(assist_level == ASSIST_2 && g_config.assist_mode_select == ASSIST_MODE_SELECT_PAS2_LIGHT) ||\r\n\t\t(assist_level == ASSIST_3 && g_config.assist_mode_select == ASSIST_MODE_SELECT_PAS3_LIGHT) ||\r\n\t\t(assist_level == ASSIST_4 && g_config.assist_mode_select == ASSIST_MODE_SELECT_PAS4_LIGHT) ||\r\n\t\t(assist_level == ASSIST_5 && g_config.assist_mode_select == ASSIST_MODE_SELECT_PAS5_LIGHT) ||\r\n\t\t(assist_level == ASSIST_6 && g_config.assist_mode_select == ASSIST_MODE_SELECT_PAS6_LIGHT) ||\r\n\t\t(assist_level == ASSIST_7 && g_config.assist_mode_select == ASSIST_MODE_SELECT_PAS7_LIGHT) ||\r\n\t\t(assist_level == ASSIST_8 && g_config.assist_mode_select == ASSIST_MODE_SELECT_PAS8_LIGHT) ||\r\n\t\t(assist_level == ASSIST_9 && g_config.assist_mode_select == ASSIST_MODE_SELECT_PAS9_LIGHT)\r\n\t\t)\r\n\t{\r\n\t\tif (on)\r\n\t\t{\r\n\t\t\tapp_set_operation_mode(OPERATION_MODE_SPORT);\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tapp_set_operation_mode(OPERATION_MODE_DEFAULT);\r\n\t\t}\r\n\t}\r\n\telse\r\n\t{\r\n\t\tif (g_config.lights_mode == LIGHTS_MODE_DEFAULT && lights_state != on)\r\n\t\t{\r\n\t\t\tlights_state = on;\r\n\t\t\teventlog_write_data(EVT_DATA_LIGHTS, on);\r\n\t\t\tlights_set(on);\r\n\t\t}\r\n\t}\r\n}\r\n\r\nvoid app_set_operation_mode(uint8_t mode)\r\n{\r\n\tif (operation_mode != mode)\r\n\t{\r\n\t\toperation_mode = mode;\r\n\t\teventlog_write_data(EVT_DATA_OPERATION_MODE, operation_mode);\r\n\t\treload_assist_params();\r\n\t}\r\n}\r\n\r\nvoid app_set_wheel_max_speed_rpm(uint16_t value)\r\n{\r\n\tif (global_speed_limit_rpm != value)\r\n\t{\r\n\t\tglobal_speed_limit_rpm = value;\r\n\t\tglobal_throttle_speed_limit_rpm_x10 = ((int32_t)global_speed_limit_rpm *\r\n\t\t\tg_config.throttle_global_spd_lim_percent) / 10;\r\n\r\n\t\teventlog_write_data(EVT_DATA_WHEEL_SPEED_PPM, value);\r\n\t\treload_assist_params();\r\n\t}\r\n}\r\n\r\nuint8_t app_get_assist_level()\r\n{\r\n\treturn assist_level;\r\n}\r\n\r\nuint8_t app_get_lights()\r\n{\r\n\treturn lights_state;\r\n}\r\n\r\nuint8_t app_get_status_code()\r\n{\r\n\tuint16_t motor = motor_status();\r\n\r\n\tif (motor & MOTOR_ERROR_HALL_SENSOR)\r\n\t{\r\n\t\treturn STATUS_ERROR_HALL_SENSOR;\r\n\t}\r\n\r\n\tif (motor & MOTOR_ERROR_CURRENT_SENSE)\r\n\t{\r\n\t\treturn STATUS_ERROR_CURRENT_SENSE;\r\n\t}\r\n\r\n\tif (motor & MOTOR_ERROR_POWER_RESET)\r\n\t{\r\n\t\t// Phase line error code reused, cause and meaning\r\n\t\t// of MOTOR_ERROR_POWER_RESET triggered on bbs02 is currently unknown\r\n\t\treturn STATUS_ERROR_PHASE_LINE;\r\n\t}\r\n\r\n\tif (!throttle_ok())\r\n\t{\r\n\t\treturn STATUS_ERROR_THROTTLE;\r\n\t}\r\n\r\n\tif (!torque_sensor_ok())\r\n\t{\r\n\t\treturn STATUS_ERROR_TORQUE_SENSOR;\r\n\t}\r\n\r\n\tif (temperature_motor_c > MAX_TEMPERATURE)\r\n\t{\r\n\t\treturn STATUS_ERROR_MOTOR_OVER_TEMP;\r\n\t}\r\n\r\n\tif (temperature_contr_c > MAX_TEMPERATURE)\r\n\t{\r\n\t\treturn STATUS_ERROR_CONTROLLER_OVER_TEMP;\r\n\t}\r\n\r\n\t// Disable LVC error since it is not shown on display in original firmware\r\n\t// Uncomment if you want to enable\r\n\t// if (motor & MOTOR_ERROR_LVC)\r\n\t// {\r\n\t//     return STATUS_ERROR_LVC;\r\n\t// }\r\n\r\n\tif (brake_is_activated())\r\n\t{\r\n\t\treturn STATUS_BRAKING;\r\n\t}\r\n\r\n\treturn STATUS_NORMAL;\r\n}\r\n\r\nuint8_t app_get_temperature()\r\n{\r\n\tint8_t temp_max = MAX(temperature_contr_c, temperature_motor_c);\r\n\r\n\tif (temp_max < 0)\r\n\t{\r\n\t\treturn 0;\r\n\t}\r\n\r\n\treturn (uint8_t)temp_max;\r\n}\r\n\r\nvoid apply_pretension(uint8_t* target_current)\r\n{\r\n\tuint16_t current_speed_rpm_x10 = speed_sensor_get_rpm_x10();\r\n\r\n\tif (g_config.use_speed_sensor && g_config.use_pretension && current_speed_rpm_x10 > pretension_cutoff_speed_rpm_x10)\r\n\t{\r\n\t\t*target_current = 1;\r\n\t}\r\n\treturn;\r\n}\r\n\r\nvoid apply_pas_cadence(uint8_t* target_current, uint8_t throttle_percent)\r\n{\r\n\tif ((assist_level_data.level.flags & ASSIST_FLAG_PAS) && !(assist_level_data.level.flags & ASSIST_FLAG_PAS_TORQUE))\r\n\t{\r\n\t\tif (pas_is_pedaling_forwards() && pas_get_pulse_counter() > g_config.pas_start_delay_pulses)\r\n\t\t{\r\n\t\t\tif (assist_level_data.level.flags & ASSIST_FLAG_PAS_VARIABLE)\r\n\t\t\t{\r\n\t\t\t\tuint8_t current = (uint8_t)MAP16(throttle_percent, 0, 100, 0, assist_level_data.level.target_current_percent);\r\n\t\t\t\tif (current > *target_current)\r\n\t\t\t\t{\r\n\t\t\t\t\t*target_current = current;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tif (assist_level_data.level.target_current_percent > *target_current)\r\n\t\t\t\t{\r\n\t\t\t\t\t*target_current = assist_level_data.level.target_current_percent;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// apply \"keep current\" ramp\r\n\t\t\t\tif (g_config.pas_keep_current_percent < 100)\r\n\t\t\t\t{\r\n\t\t\t\t\tif (*target_current > assist_level_data.keep_current_target_percent &&\r\n\t\t\t\t\t\tpas_get_cadence_rpm_x10() > assist_level_data.keep_current_ramp_start_rpm_x10)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tuint32_t cadence = MIN(pas_get_cadence_rpm_x10(), assist_level_data.keep_current_ramp_end_rpm_x10);\r\n\r\n\t\t\t\t\t\t// ramp down current towards keep_current_target_percent with rpm above keep_current_ramp_start_rpm_x10\r\n\t\t\t\t\t\t*target_current = MAP32(\r\n\t\t\t\t\t\t\tcadence,\t// in\r\n\t\t\t\t\t\t\tassist_level_data.keep_current_ramp_start_rpm_x10,\t\t// in_min\r\n\t\t\t\t\t\t\tassist_level_data.keep_current_ramp_end_rpm_x10,\t\t// in_max\r\n\t\t\t\t\t\t\t*target_current,\t\t\t\t\t\t\t\t\t\t// out_min\r\n\t\t\t\t\t\t\tassist_level_data.keep_current_target_percent);\t\t\t// out_max\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\n#if HAS_TORQUE_SENSOR\r\nvoid apply_pas_torque(uint8_t* target_current)\r\n{\r\n\tif ((assist_level_data.level.flags & ASSIST_FLAG_PAS) && (assist_level_data.level.flags & ASSIST_FLAG_PAS_TORQUE))\r\n\t{\r\n\t\tif (pas_is_pedaling_forwards() && (pas_get_pulse_counter() > g_config.pas_start_delay_pulses || speed_sensor_is_moving()))\r\n\t\t{\r\n\t\t\tuint16_t torque_nm_x100 = torque_sensor_get_nm_x100();\r\n\t\t\tuint16_t cadence_rpm_x10 = pas_get_cadence_rpm_x10();\r\n\t\t\tif (cadence_rpm_x10 < TORQUE_POWER_LOWER_RPM_X10)\r\n\t\t\t{\r\n\t\t\t\tcadence_rpm_x10 = TORQUE_POWER_LOWER_RPM_X10;\r\n\t\t\t}\r\n\r\n\t\t\tuint16_t pedal_power_w_x10 = (uint16_t)(((uint32_t)torque_nm_x100 * cadence_rpm_x10) / 955);\r\n\r\n\t\t\t// used in division below to calculate target current,\r\n\t\t\t// clamp to 24V if no reading available (unexpected error).\r\n\t\t\tuint16_t battery_voltage_x10 = MAX(motor_get_battery_voltage_x10(), 240);\r\n\r\n\t\t\tuint16_t target_current_amp_x100 = (uint16_t)(((uint32_t)10 * pedal_power_w_x10 *\r\n\t\t\t\tassist_level_data.level.torque_amplification_factor_x10) / battery_voltage_x10);\r\n\r\n\t\t\tuint16_t max_current_amp_x100 = g_config.max_current_amps * 100;\r\n\r\n\t\t\t// limit target to ensure no overflow in map result\r\n\t\t\tif (target_current_amp_x100 > max_current_amp_x100)\r\n\t\t\t{\r\n\t\t\t\ttarget_current_amp_x100 = max_current_amp_x100;\r\n\t\t\t}\r\n\t\t\tuint8_t tmp_percent = (uint8_t)MAP32(target_current_amp_x100, 0, max_current_amp_x100, 0, 100);\r\n\r\n\t\t\t// minimum 1 percent current if pedaling\r\n\t\t\tif (tmp_percent < 1)\r\n\t\t\t{\r\n\t\t\t\ttmp_percent = 1;\r\n\t\t\t}\r\n\t\t\t// limit to maximum assist current for set level\r\n\t\t\telse if (tmp_percent > assist_level_data.level.target_current_percent)\r\n\t\t\t{\r\n\t\t\t\ttmp_percent = assist_level_data.level.target_current_percent;\r\n\t\t\t}\r\n\r\n\t\t\tif (tmp_percent > *target_current)\r\n\t\t\t{\r\n\t\t\t\t*target_current = tmp_percent;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n#endif\r\n\r\nvoid apply_cruise(uint8_t* target_current, uint8_t throttle_percent)\r\n{\r\n\tstatic bool cruise_block_throttle_return = false;\r\n\r\n\tif ((assist_level_data.level.flags & ASSIST_FLAG_CRUISE) && throttle_ok())\r\n\t{\r\n\t\t// pause cruise if brake activated\r\n\t\tif (brake_is_activated())\r\n\t\t{\r\n\t\t\tcruise_paused = true;\r\n\t\t\tcruise_block_throttle_return = true;\r\n\t\t}\r\n\r\n\t\t// pause cruise if started pedaling backwards\r\n\t\telse if (pas_is_pedaling_backwards() && pas_get_pulse_counter() > CRUISE_DISENGAGE_PAS_PULSES)\r\n\t\t{\r\n\t\t\tcruise_paused = true;\r\n\t\t\tcruise_block_throttle_return = true;\r\n\t\t}\r\n\r\n\t\t// pause cruise if throttle touched while cruise active\r\n\t\telse if (!cruise_paused && !cruise_block_throttle_return && throttle_percent > 0)\r\n\t\t{\r\n\t\t\tcruise_paused = true;\r\n\t\t\tcruise_block_throttle_return = true;\r\n\t\t}\r\n\r\n\t\t// unpause cruise if pedaling forward while engaging throttle > 50%\r\n\t\telse if (cruise_paused && !cruise_block_throttle_return && throttle_percent > 50 && pas_is_pedaling_forwards() && pas_get_pulse_counter() > CRUISE_ENGAGE_PAS_PULSES)\r\n\t\t{\r\n\t\t\tcruise_paused = false;\r\n\t\t\tcruise_block_throttle_return = true;\r\n\t\t}\r\n\r\n\t\t// reset flag tracking throttle to make sure throttle returns to idle position before engage/disenage cruise with throttle touch\r\n\t\telse if (cruise_block_throttle_return && throttle_percent == 0)\r\n\t\t{\r\n\t\t\tcruise_block_throttle_return = false;\r\n\t\t}\r\n\r\n\t\tif (cruise_paused)\r\n\t\t{\r\n\t\t\t*target_current = 0;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tif (assist_level_data.level.target_current_percent > *target_current)\r\n\t\t\t{\r\n\t\t\t\t*target_current = assist_level_data.level.target_current_percent;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\nbool apply_throttle(uint8_t* target_current, uint8_t throttle_percent)\r\n{\r\n\tif ((assist_level_data.level.flags & ASSIST_FLAG_THROTTLE) && throttle_percent > 0 && throttle_ok())\r\n\t{\r\n\t\tuint8_t current = (uint8_t)MAP16(throttle_percent, 0, 100, g_config.throttle_start_percent, assist_level_data.level.max_throttle_current_percent);\r\n\r\n\t\tif (current >= *target_current)\r\n\t\t{\r\n\t\t\t*target_current = current;\r\n\t\t\treturn true;\r\n\t\t}\r\n\t}\r\n\r\n\treturn false;\r\n}\r\n\r\n\r\nbool apply_speed_limit(uint8_t* target_current, uint8_t throttle_percent, bool pas_engaged, bool throttle_override)\r\n{\r\n\tstatic bool speed_limiting = false;\r\n\r\n\tif (!g_config.use_speed_sensor)\r\n\t{\r\n\t\treturn false;\r\n\t}\r\n\r\n\t// global throttle speed limit applies if enabled in configuration, PAS is not engaged and throttle is used\r\n\tbool global_throttle_limit_active =\r\n\t\t!pas_engaged && \r\n\t\tthrottle_percent > 0 &&\r\n\t\tg_config.throttle_global_spd_lim_percent > 0 &&\r\n\t\t(\r\n\t\t\tg_config.throttle_global_spd_lim_opt == THROTTLE_GLOBAL_SPEED_LIMIT_ENABLED ||\r\n\t\t\t(g_config.throttle_global_spd_lim_opt == THROTTLE_GLOBAL_SPEED_LIMIT_STD_LVLS && operation_mode == OPERATION_MODE_DEFAULT)\r\n\t\t);\r\n\r\n\tbool throttle_speed_override_active = !global_throttle_limit_active && throttle_override &&\r\n\t\t(assist_level_data.level.flags & ASSIST_FLAG_PAS) &&\r\n\t\t(assist_level_data.level.flags & ASSIST_FLAG_OVERRIDE_SPEED);\r\n\r\n\tint32_t max_speed_rpm_x10;\r\n\tif (global_throttle_limit_active)\r\n\t{\r\n\t\t// use configured global throttle override speed limit\r\n\t\tmax_speed_rpm_x10 = global_throttle_speed_limit_rpm_x10;\r\n\t}\r\n\telse if (throttle_speed_override_active)\r\n\t{\r\n\t\t// override assist level speed limit to global speed limit\r\n\t\tmax_speed_rpm_x10 = global_speed_limit_rpm * 10;\r\n\t}\r\n\telse\r\n\t{\r\n\t\t// normal operation, use configured assist level speed limit\r\n\t\tmax_speed_rpm_x10 = assist_level_data.max_wheel_speed_rpm_x10;\r\n\t}\r\n\r\n\tint32_t max_speed_ramp_low_rpm_x10 = max_speed_rpm_x10 - speed_limit_ramp_interval_rpm_x10;\r\n\tint32_t max_speed_ramp_high_rpm_x10 = max_speed_rpm_x10 + speed_limit_ramp_interval_rpm_x10;\r\n\r\n\tif (max_speed_rpm_x10 > 0)\r\n\t{\r\n\t\tint16_t current_speed_rpm_x10 = speed_sensor_get_rpm_x10();\r\n\r\n\t\tif (current_speed_rpm_x10 < max_speed_ramp_low_rpm_x10)\r\n\t\t{\r\n\t\t\t// no limiting\r\n\t\t\tif (speed_limiting)\r\n\t\t\t{\r\n\t\t\t\tspeed_limiting = false;\r\n\t\t\t\teventlog_write_data(EVT_DATA_SPEED_LIMITING, 0);\r\n\t\t\t}\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tif (!speed_limiting)\r\n\t\t\t{\r\n\t\t\t\tspeed_limiting = true;\r\n\t\t\t\teventlog_write_data(EVT_DATA_SPEED_LIMITING, 1);\r\n\t\t\t}\r\n\r\n\t\t\tif (current_speed_rpm_x10 > max_speed_ramp_high_rpm_x10)\r\n\t\t\t{\r\n\t\t\t\tif (*target_current > 1)\r\n\t\t\t\t{\r\n\t\t\t\t\t*target_current = 1;\r\n\t\t\t\t\treturn true;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\t// linear ramp down when approaching max speed.\r\n\t\t\t\tuint8_t tmp = (uint8_t)MAP32(current_speed_rpm_x10, max_speed_ramp_low_rpm_x10, max_speed_ramp_high_rpm_x10, *target_current, 1);\r\n\t\t\t\tif (*target_current > tmp)\r\n\t\t\t\t{\r\n\t\t\t\t\t*target_current = tmp;\r\n\t\t\t\t\treturn true;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\treturn false;\r\n}\r\n\r\nbool apply_thermal_limit(uint8_t* target_current)\r\n{\r\n\tstatic uint32_t next_log_temp_ms = 10000;\r\n\r\n\tstatic bool temperature_limiting = false;\r\n\r\n\tint16_t temp_contr_x100 = temperature_contr_x100();\r\n\ttemperature_contr_c = temp_contr_x100 / 100;\r\n\r\n\tint16_t temp_motor_x100 = temperature_motor_x100();\r\n\ttemperature_motor_c = temp_motor_x100 / 100;\r\n\r\n\tint16_t max_temp_x100 = MAX(temp_contr_x100, temp_motor_x100);\r\n\tint8_t max_temp = MAX(temperature_contr_c, temperature_motor_c);\r\n\r\n\tif (eventlog_is_enabled() && g_config.use_temperature_sensor && system_ms() > next_log_temp_ms)\r\n\t{\r\n\t\tnext_log_temp_ms = system_ms() + 10000;\r\n\t\teventlog_write_data(EVT_DATA_TEMPERATURE, (uint16_t)temperature_motor_c << 8 | temperature_contr_c);\r\n\t}\r\n\r\n\tif (max_temp >= (MAX_TEMPERATURE - MAX_TEMPERATURE_RAMP_DOWN_INTERVAL))\r\n\t{\r\n\t\tif (!temperature_limiting)\r\n\t\t{\r\n\t\t\ttemperature_limiting = true;\r\n\t\t\teventlog_write_data(EVT_DATA_THERMAL_LIMITING, 1);\r\n\t\t}\r\n\r\n\t\tif (max_temp_x100 > MAX_TEMPERATURE * 100)\r\n\t\t{\r\n\t\t\tmax_temp_x100 = MAX_TEMPERATURE * 100;\r\n\t\t}\r\n\r\n\t\tuint8_t tmp = (uint8_t)MAP32(\r\n\t\t\tmax_temp_x100,\t\t\t\t\t\t\t\t\t\t\t\t\t// value\r\n\t\t\t(MAX_TEMPERATURE - MAX_TEMPERATURE_RAMP_DOWN_INTERVAL) * 100,\t// in_min\r\n\t\t\tMAX_TEMPERATURE * 100,\t\t\t\t\t\t\t\t\t\t\t// in_max\r\n\t\t\t100,\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// out_min\r\n\t\t\tMAX_TEMPERATURE_LOW_CURRENT_PERCENT\t\t\t\t\t\t\t\t// out_max\r\n\t\t);\r\n\r\n\t\tif (*target_current > tmp)\r\n\t\t{\r\n\t\t\t*target_current = tmp;\r\n\t\t\treturn true;\r\n\t\t}\r\n\t}\r\n\telse\r\n\t{\r\n\t\tif (temperature_limiting)\r\n\t\t{\r\n\t\t\ttemperature_limiting = false;\r\n\t\t\teventlog_write_data(EVT_DATA_THERMAL_LIMITING, 0);\r\n\t\t}\r\n\t}\r\n\r\n\treturn false;\r\n}\r\n\r\nbool apply_low_voltage_limit(uint8_t* target_current)\r\n{\r\n\tstatic uint32_t next_log_volt_ms = 10000;\r\n\tstatic bool lvc_limiting = false;\r\n\r\n\tstatic uint32_t next_voltage_reading_ms = 125;\r\n\tstatic int32_t flt_min_bat_volt_x100 = 100 * 100;\r\n\r\n\tif (system_ms() > next_voltage_reading_ms)\r\n\t{\r\n\t\tnext_voltage_reading_ms = system_ms() + 125;\r\n\t\tint32_t voltage_reading_x100 = motor_get_battery_voltage_x10() * 10ul;\r\n\r\n\t\tif (voltage_reading_x100 < flt_min_bat_volt_x100)\r\n\t\t{\r\n\t\t\tflt_min_bat_volt_x100 = EXPONENTIAL_FILTER(flt_min_bat_volt_x100, voltage_reading_x100, 8);\r\n\t\t}\r\n\r\n\t\tif (eventlog_is_enabled() && system_ms() > next_log_volt_ms)\r\n\t\t{\r\n\t\t\tnext_log_volt_ms = system_ms() + 10000;\r\n\t\t\teventlog_write_data(EVT_DATA_VOLTAGE, (uint16_t)voltage_reading_x100);\r\n\t\t}\r\n\t}\r\n\r\n\tuint16_t voltage_x100 = flt_min_bat_volt_x100;\r\n\r\n\tif (voltage_x100 <= lvc_ramp_down_start_voltage_x100)\r\n\t{\r\n\t\tif (!lvc_limiting)\r\n\t\t{\r\n\t\t\teventlog_write_data(EVT_DATA_LVC_LIMITING, voltage_x100);\r\n\t\t\tlvc_limiting = true;\r\n\t\t}\r\n\r\n\t\tif (voltage_x100 < lvc_voltage_x100)\r\n\t\t{\r\n\t\t\tvoltage_x100 = lvc_voltage_x100;\r\n\t\t}\r\n\r\n\t\t// Ramp down power until LVC_LOW_CURRENT_PERCENT when approaching LVC\r\n\t\tuint8_t tmp = (uint8_t)MAP32(\r\n\t\t\tvoltage_x100,\t\t\t\t\t\t// value\r\n\t\t\tlvc_ramp_down_end_voltage_x100,\t\t// in_min\r\n\t\t\tlvc_ramp_down_start_voltage_x100,\t// in_max\r\n\t\t\tLVC_LOW_CURRENT_PERCENT,\t\t\t// out_min\r\n\t\t\t100\t\t\t\t\t\t\t\t\t// out_max\r\n\t\t);\r\n\r\n\t\tif (*target_current > tmp)\r\n\t\t{\r\n\t\t\t*target_current = tmp;\r\n\t\t\treturn true;\r\n\t\t}\r\n\t}\r\n\r\n\treturn false;\r\n}\r\n\r\n#if HAS_SHIFT_SENSOR_SUPPORT\r\nbool apply_shift_sensor_interrupt(uint8_t* target_current)\r\n{\r\n\tstatic uint32_t shift_sensor_act_ms = 0;\r\n\tstatic bool shift_sensor_last = false;\r\n\tstatic bool shift_sensor_interrupting = false;\r\n\tstatic bool shift_sensor_logged = false;\r\n\r\n\t// Exit immediately if shift interrupts disabled.\r\n\tif (!g_config.use_shift_sensor)\r\n\t{\r\n\t\treturn false;\r\n\t}\r\n\r\n\tbool active = shift_sensor_is_activated();\r\n\tif (active)\r\n\t{\r\n\t\t// Check for new pulse from the gear sensor during shift interrupt\r\n\t\tif (!shift_sensor_last && shift_sensor_interrupting)\r\n\t\t{\r\n\t\t\t// Consecutive gear change, do restart.\r\n\t\t\tshift_sensor_interrupting = false;\r\n\t\t}\r\n\t\tif (!shift_sensor_interrupting)\r\n\t\t{\r\n\t\t\tuint16_t duration_ms = EXPAND_U16(\r\n\t\t\t\tg_config.shift_interrupt_duration_ms_u16h,\r\n\t\t\t\tg_config.shift_interrupt_duration_ms_u16l\r\n\t\t\t);\r\n\t\t\tshift_sensor_act_ms = system_ms() + duration_ms;\r\n\t\t\tshift_sensor_interrupting = true;\r\n\t\t}\r\n\t\tshift_sensor_last = true;\r\n\t}\r\n\telse\r\n\t{\r\n\t\tshift_sensor_last = false;\r\n\t}\r\n\r\n\tif (!shift_sensor_interrupting)\r\n\t{\r\n\t\treturn false;\r\n\t}\r\n\r\n\tif (system_ms() >= shift_sensor_act_ms)\r\n\t{\r\n\t\t// Shift is finished, reset function state.\r\n\t\tshift_sensor_interrupting = false;\r\n\t\t// Logging is skipped, unless current has been clamped during shift interrupt.\r\n\t\tif (shift_sensor_logged)\r\n\t\t{\r\n\t\t\tshift_sensor_logged = false;\r\n\t\t\teventlog_write_data(EVT_DATA_SHIFT_SENSOR, 0);\r\n\t\t}\r\n\t\treturn false;\r\n\t}\r\n\r\n\tif ((*target_current) > g_config.shift_interrupt_current_threshold_percent)\r\n\t{\r\n\t\tif (!shift_sensor_logged)\r\n\t\t{\r\n\t\t\t// Logging only once per shifting interrupt.\r\n\t\t\tshift_sensor_logged = true;\r\n\t\t\teventlog_write_data(EVT_DATA_SHIFT_SENSOR, 1);\r\n\t\t}\r\n\t\t// Set target current based on desired current threshold during shift.\r\n\t\t*target_current = g_config.shift_interrupt_current_threshold_percent;\r\n\r\n\t\treturn true;\r\n\t}\r\n\r\n\treturn false;\r\n}\r\n#endif\r\n\r\nbool apply_brake(uint8_t* target_current)\r\n{\r\n\tbool is_braking = brake_is_activated();\r\n\r\n\tif (g_config.lights_mode == LIGHTS_MODE_BRAKE_LIGHT)\r\n\t{\r\n\t\tlights_set(is_braking);\r\n\t}\r\n\r\n\tif (is_braking)\r\n\t{\r\n\t\t*target_current = 0;\r\n\t}\r\n\r\n\treturn is_braking;\r\n}\r\n\r\nvoid apply_current_ramp_up(uint8_t* target_current, bool enable)\r\n{\r\n\tstatic uint8_t ramp_up_target_current = 0;\r\n\tstatic uint32_t last_ramp_up_increment_ms = 0;\r\n\r\n\tif (enable && *target_current > ramp_up_target_current)\r\n\t{\r\n\t\tuint32_t now = system_ms();\r\n\t\tuint16_t time_diff = now - last_ramp_up_increment_ms;\r\n\r\n\t\tif (time_diff >= ramp_up_current_interval_ms)\r\n\t\t{\r\n\t\t\t++ramp_up_target_current;\r\n\r\n\t\t\tif (last_ramp_up_increment_ms == 0)\r\n\t\t\t{\r\n\t\t\t\tlast_ramp_up_increment_ms = now;\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\t// offset for time overshoot to not accumulate large ramp error\r\n\t\t\t\tlast_ramp_up_increment_ms = now - (uint8_t)(time_diff - ramp_up_current_interval_ms);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t*target_current = ramp_up_target_current;\r\n\t}\r\n\telse\r\n\t{\r\n\t\tramp_up_target_current = *target_current;\r\n\t\tlast_ramp_up_increment_ms = 0;\r\n\t}\r\n}\r\n\r\nvoid apply_current_ramp_down(uint8_t* target_current, bool enable)\r\n{\r\n\tstatic uint8_t ramp_down_target_current = 0;\r\n\tstatic uint32_t last_ramp_down_decrement_ms = 0;\r\n\r\n\t// apply fast ramp down if coming from high target current (> 50%)\r\n\tif (enable && *target_current < ramp_down_target_current)\r\n\t{\r\n\t\tuint32_t now = system_ms();\r\n\t\tuint16_t time_diff = now - last_ramp_down_decrement_ms;\r\n\r\n\t\tif (time_diff >= 10)\r\n\t\t{\r\n\t\t\tuint8_t diff = ramp_down_target_current - *target_current;\r\n\r\n\t\t\tif (diff >= CURRENT_RAMP_DOWN_PERCENT_10MS)\r\n\t\t\t{\r\n\t\t\t\tramp_down_target_current -= CURRENT_RAMP_DOWN_PERCENT_10MS;\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tramp_down_target_current -= diff;\r\n\t\t\t}\r\n\r\n\t\t\tif (last_ramp_down_decrement_ms == 0)\r\n\t\t\t{\r\n\t\t\t\tlast_ramp_down_decrement_ms = now;\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\t// offset for time overshoot to not accumulate large ramp error\r\n\t\t\t\tlast_ramp_down_decrement_ms = now - (uint8_t)(time_diff - 10);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t*target_current = ramp_down_target_current;\r\n\t}\r\n\telse\r\n\t{\r\n\t\tramp_down_target_current = *target_current;\r\n\t\tlast_ramp_down_decrement_ms = 0;\r\n\t}\r\n}\r\n\r\n\r\nbool check_power_block()\r\n{\r\n\tif (power_blocked_until_ms != 0)\r\n\t{\r\n\t\t// power block is active, check if time to release\r\n\t\tif (system_ms() > power_blocked_until_ms)\r\n\t\t{\r\n\t\t\tpower_blocked_until_ms = 0;\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\treturn true;\r\n\t}\r\n\r\n\treturn false;\r\n}\r\n\r\nvoid block_power_for(uint16_t ms)\r\n{\r\n\tpower_blocked_until_ms = system_ms() + ms;\r\n}\r\n\r\nvoid reload_assist_params()\r\n{\r\n\tif (assist_level < ASSIST_PUSH)\r\n\t{\r\n\t\tassist_level_data.level = g_config.assist_levels[operation_mode][assist_level];\r\n\r\n\t\tassist_level_data.max_wheel_speed_rpm_x10 = ((int32_t)global_speed_limit_rpm * assist_level_data.level.max_speed_percent) / 10;\r\n\r\n\t\tif (assist_level_data.level.flags & ASSIST_FLAG_PAS)\r\n\t\t{\r\n\t\t\tassist_level_data.keep_current_target_percent = (uint8_t)((uint16_t)g_config.pas_keep_current_percent * assist_level_data.level.target_current_percent / 100);\r\n\t\t\tassist_level_data.keep_current_ramp_start_rpm_x10 = g_config.pas_keep_current_cadence_rpm * 10;\r\n\t\t\tassist_level_data.keep_current_ramp_end_rpm_x10 = (uint16_t)(((uint32_t)assist_level_data.level.max_cadence_percent * MAX_CADENCE_RPM_X10) / 100);\r\n\t\t}\r\n\r\n\t\t// pause cruise if swiching level\r\n\t\tcruise_paused = true;\r\n\t}\r\n\t// only apply push walk params if push walk is active in config,\r\n\t// otherwise data of previous assist level is kept.\r\n\telse if (assist_level == ASSIST_PUSH && g_config.use_push_walk)\r\n\t{\r\n\t\tassist_level_data.level.flags = 0;\r\n\t\tassist_level_data.level.target_current_percent = 0;\r\n\t\tassist_level_data.level.max_speed_percent = 0;\r\n\t\tassist_level_data.level.max_cadence_percent = 15;\r\n\t\tassist_level_data.level.max_throttle_current_percent = 0;\r\n\r\n\t\tassist_level_data.max_wheel_speed_rpm_x10 = convert_wheel_speed_kph_to_rpm(WALK_MODE_SPEED_KPH) * 10;\r\n\t}\r\n}\r\n\r\nuint16_t convert_wheel_speed_kph_to_rpm(uint8_t speed_kph)\r\n{\r\n\tfloat radius_mm = EXPAND_U16(g_config.wheel_size_inch_x10_u16h, g_config.wheel_size_inch_x10_u16l) * 1.27f; // g_config.wheel_size_inch_x10 / 2.f * 2.54f;\r\n\treturn (uint16_t)(25000.f / (3 * 3.14159f * radius_mm) * speed_kph);\r\n}\r\n"
  },
  {
    "path": "src/firmware/app.h",
    "content": "/*\r\n * bbs-fw\r\n *\r\n * Copyright (C) Daniel Nilsson, 2022.\r\n *\r\n * Released under the GPL License, Version 3\r\n */\r\n\r\n#ifndef _APP_H_\r\n#define _APP_H_\r\n\r\n#include \"intellisense.h\"\r\n#include <stdint.h>\r\n#include <stdbool.h>\r\n\r\n\r\n#define ASSIST_0\t\t0x00\r\n#define ASSIST_1\t\t0x01\r\n#define ASSIST_2\t\t0x02\r\n#define ASSIST_3\t\t0x03\r\n#define ASSIST_4\t\t0x04\r\n#define ASSIST_5\t\t0x05\r\n#define ASSIST_6\t\t0x06\r\n#define ASSIST_7\t\t0x07\r\n#define ASSIST_8\t\t0x08\r\n#define ASSIST_9\t\t0x09\r\n#define ASSIST_PUSH\t\t0x0A\r\n\r\n#define OPERATION_MODE_DEFAULT\t0x00\r\n#define OPERATION_MODE_SPORT\t0x01\r\n\r\n// Matches status codes used by Bafang\r\n#define STATUS_NORMAL\t\t\t\t\t\t0x01\r\n#define STATUS_BRAKING\t\t\t\t\t\t0x03\r\n\r\n#define STATUS_ERROR_THROTTLE_HIGH\t\t\t0x04\r\n#define STATUS_ERROR_THROTTLE\t\t\t\t0x05\r\n#define STATUS_ERROR_LVC\t\t\t\t\t0x06\r\n#define STATUS_ERROR_HIGH_VOLTAGE\t\t\t0x07 // not implemented\r\n#define STATUS_ERROR_HALL_SENSOR\t\t\t0x08\r\n#define STATUS_ERROR_PHASE_LINE\t\t\t\t0x09\r\n#define STATUS_ERROR_CONTROLLER_OVER_TEMP\t0x10\r\n#define STATUS_ERROR_MOTOR_OVER_TEMP\t\t0x11\r\n#define STATUS_ERROR_CURRENT_SENSE\t\t\t0x12\r\n#define STATUS_ERROR_BATTERY_TEMP_SENSOR\t0x13 // n/a\r\n#define STATUS_ERROR_MOTOR_TEMP_SENSOR\t\t0x14 // not implemented\r\n#define STATUS_ERROR_CONTROLLER_TEMP_SENSOR 0x15 // not implemented\r\n#define STATUS_ERROR_SPEED_SENSOR\t\t\t0x21 // not implemented\r\n#define STATUS_ERROR_BMS_COMMUNICATION\t\t0x22 // n/a\r\n#define STATUS_ERROR_HEAD_LIGHT\t\t\t\t0x23 // not implemented\r\n#define STATUS_ERROR_HEAD_LIGHT_SENSOR\t\t0x24 // not implemented\r\n#define STATUS_ERROR_TORQUE_SENSOR\t\t\t0x25\r\n#define STATUS_ERROR_TORQUE_SPEED\t\t\t0x26 // n/a\r\n#define STATUS_ERROR_COMMUNICATION\t\t\t0x30 // n/a\r\n\r\n\r\nvoid app_init();\r\n\r\nvoid app_process();\r\n\r\nvoid app_set_assist_level(uint8_t level);\r\nvoid app_set_lights(bool on);\r\n\r\nvoid app_set_operation_mode(uint8_t mode);\r\nvoid app_set_wheel_max_speed_rpm(uint16_t value);\r\n\r\nuint8_t app_get_assist_level();\r\nuint8_t app_get_lights();\r\nuint8_t app_get_status_code();\r\nuint8_t app_get_temperature();\r\n\r\n#endif\r\n"
  },
  {
    "path": "src/firmware/battery.c",
    "content": "/*\n * bbs-fw\n *\n * Copyright (C) Daniel Nilsson, 2022.\n *\n * Released under the GPL License, Version 3\n */\n\n#include \"battery.h\"\n#include \"motor.h\"\n#include \"system.h\"\n#include \"util.h\"\n#include \"cfgstore.h\"\n#include \"fwconfig.h\"\n\nstatic int16_t battery_empty_x100v;\nstatic int16_t battery_full_x100v;\n\nstatic uint8_t battery_percent;\nstatic uint32_t motor_disabled_at_ms;\nstatic bool first_reading_done;\n\n/*\nNo attempt is made to have accurate battery state of charge display.\n\nThis is only a voltage based approch using configured max and min battery voltages.\nThe end values are padded 8% on each side (BATTERY_EMPTY_OFFSET_PERCENT, BATTERY_FULL_OFFSET_PERCENT).\n\nBattery voltage is measured when no motor power has been applied for\nat least 2 seconds (BATTERY_NO_LOAD_DELAY_MS). This is to mitigate measuring voltage sag\nbut is still problematic in cold weather.\n\nBattery SOC percentage is calculated from measured voltage using linear interpolation\nbetween the padded ranges.\n\nThe LVC rampdown starts at 10% battery SOC (LVC_RAMP_DOWN_OFFSET_PERCENT) and will linearly\nramp the current down to 20% (LVC_LOW_CURRENT_PERCENT) of the maximum configured current.\n\nFor example, if the maximum battery voltage is 58.8V and the low cutoff voltage is 42V, then:\n\n- The full voltage range is 58.8V - 42V = 16.8V\n- The padding amount is 0.08 * 16.8V = 1.3V\n- The battery is considered at 100% SOC at 58.8V - 1.3V = 57.5V\n- The battery is considered at   0% SOC at 42.0V + 1.3V = 43.3V\n- LVC rampdown will start at 10% SOC, so: 43.3V + 0.1 * (57.5V - 43.3V) = 44.7V\n- Full LVC limiting will occur at 0% SOC, so: 43.3V\n*/\n\nstatic uint8_t compute_battery_percent()\n{\n\tint16_t value_x100v = motor_get_battery_voltage_x10() * 10l;\n\tint16_t percent = (int16_t)MAP32(value_x100v, battery_empty_x100v, battery_full_x100v, 0, 100);\n\n\treturn (uint8_t)CLAMP(percent, 0, 100);\n}\n\n#if (BATTERY_PERCENT_MAP == BATTERY_PERCENT_MAP_SW102)\nstatic uint8_t map_percent_sw102(uint8_t percent)\n{\n\t// Measured on Display\n\t// -----------------------\n\t// 0bar\t\t0-5\n\t// 1bar\t\t5 - 10\n\t// 2bar\t\t10 - 30\n\t// 3bar\t\t31 - 51\n\t// 4bar\t\t52 - 78\n\t// 5bar\t\t78 - 100\n\n\tif (percent < 5)\t\t// 0bar\n\t{\n\t\treturn 0;\n\t}\n\telse if (percent < 21)\t// 1bar\n\t{\n\t\treturn 7;\n\t}\n\telse if (percent < 41)\t// 2bar\n\t{\n\t\treturn 20;\n\t}\n\telse if (percent < 61)\t// 3bar\n\t{\n\t\treturn 40;\n\t}\n\telse if (percent < 81)\t// 4bar\n\t{\n\t\treturn 60;\n\t}\n\telse\t\t\t\t\t// 5bar\n\t{\n\t\treturn 100;\n\t}\n}\n#endif\n\n\nvoid battery_init()\n{\n\t// default to 70% until first reading is available\n\tbattery_percent = 70;\n\tmotor_disabled_at_ms = 0;\n\tfirst_reading_done = false;\n\n\tuint16_t battery_min_voltage_x100v = g_config.low_cut_off_v * 100u;\n\tuint16_t battery_max_voltage_x100v =\n\t\tEXPAND_U16(g_config.max_battery_x100v_u16h, g_config.max_battery_x100v_u16l);\n\n\tuint16_t battery_range_x100v = battery_max_voltage_x100v - battery_min_voltage_x100v;\n\n\tbattery_full_x100v = battery_max_voltage_x100v -\n\t\t((BATTERY_FULL_OFFSET_PERCENT * battery_range_x100v) / 100);\n\n\tbattery_empty_x100v = battery_min_voltage_x100v +\n\t\t((BATTERY_EMPTY_OFFSET_PERCENT * battery_range_x100v) / 100);\n}\n\nvoid battery_process()\n{\n\tif (!first_reading_done)\n\t{\n\t\tif (motor_get_battery_voltage_x10() > 0)\n\t\t{\n\t\t\tbattery_percent = compute_battery_percent();\n\t\t\tfirst_reading_done = true;\n\t\t}\n\t}\n\telse\n\t{\n\t\tuint8_t target_current = motor_get_target_current();\n\n\t\tif (motor_disabled_at_ms == 0 && target_current == 0)\n\t\t{\n\t\t\tmotor_disabled_at_ms = system_ms();\n\t\t}\n\t\telse if (target_current > 0)\n\t\t{\n\t\t\tmotor_disabled_at_ms = 0;\n\t\t}\n\n\t\tif (target_current == 0 && (system_ms() - motor_disabled_at_ms) > BATTERY_NO_LOAD_DELAY_MS)\n\t\t{\n\t\t\tbattery_percent = compute_battery_percent();\n\t\t}\n\t}\n}\n\nuint8_t battery_get_percent()\n{\n\treturn battery_percent;\n}\n\nuint8_t battery_get_mapped_percent()\n{\n#if (BATTERY_PERCENT_MAP == BATTERY_PERCENT_MAP_SW102)\n\treturn map_percent_sw102(battery_percent);\n#else\n\treturn battery_percent;\n#endif\n}\n"
  },
  {
    "path": "src/firmware/battery.h",
    "content": "/*\n * bbs-fw\n *\n * Copyright (C) Daniel Nilsson, 2022.\n *\n * Released under the GPL License, Version 3\n */\n\n#ifndef _BATTERY_H_\n#define _BATTERY_H_\n\n#include <stdint.h>\n\nvoid battery_init();\nvoid battery_process();\n\nuint8_t battery_get_percent();\nuint8_t battery_get_mapped_percent();\n\n#endif\n"
  },
  {
    "path": "src/firmware/bbs-fw.sln",
    "content": "﻿\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio Version 17\nVisualStudioVersion = 17.4.33205.214\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"bbs-fw\", \"bbs-fw.vcxproj\", \"{1D7732D0-C5BC-4E67-9A24-EFF8000C007D}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tBBS02|SDCC = BBS02|SDCC\n\t\tBBSHD|SDCC = BBSHD|SDCC\n\t\tTSDZ2|SDCC = TSDZ2|SDCC\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{1D7732D0-C5BC-4E67-9A24-EFF8000C007D}.BBS02|SDCC.ActiveCfg = BBS02|x64\n\t\t{1D7732D0-C5BC-4E67-9A24-EFF8000C007D}.BBS02|SDCC.Build.0 = BBS02|x64\n\t\t{1D7732D0-C5BC-4E67-9A24-EFF8000C007D}.BBSHD|SDCC.ActiveCfg = BBSHD|x64\n\t\t{1D7732D0-C5BC-4E67-9A24-EFF8000C007D}.BBSHD|SDCC.Build.0 = BBSHD|x64\n\t\t{1D7732D0-C5BC-4E67-9A24-EFF8000C007D}.TSDZ2|SDCC.ActiveCfg = TSDZ2|x64\n\t\t{1D7732D0-C5BC-4E67-9A24-EFF8000C007D}.TSDZ2|SDCC.Build.0 = TSDZ2|x64\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\n\tGlobalSection(ExtensibilityGlobals) = postSolution\n\t\tSolutionGuid = {2359A0E3-B5F4-4356-ACB7-0730EF01FF2F}\n\tEndGlobalSection\nEndGlobal\n"
  },
  {
    "path": "src/firmware/bbs-fw.vcxproj",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <ItemGroup Label=\"ProjectConfigurations\">\n    <ProjectConfiguration Include=\"BBS02|x64\">\n      <Configuration>BBS02</Configuration>\n      <Platform>x64</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"BBSHD|x64\">\n      <Configuration>BBSHD</Configuration>\n      <Platform>x64</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"TSDZ2|x64\">\n      <Configuration>TSDZ2</Configuration>\n      <Platform>x64</Platform>\n    </ProjectConfiguration>\n  </ItemGroup>\n  <PropertyGroup Label=\"Globals\">\n    <VCProjectVersion>16.0</VCProjectVersion>\n    <ProjectGuid>{1D7732D0-C5BC-4E67-9A24-EFF8000C007D}</ProjectGuid>\n    <Keyword>Win32Proj</Keyword>\n  </PropertyGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='BBSHD|x64'\" Label=\"Configuration\">\n    <ConfigurationType>Makefile</ConfigurationType>\n    <UseDebugLibraries>true</UseDebugLibraries>\n    <PlatformToolset>v143</PlatformToolset>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='TSDZ2|x64'\" Label=\"Configuration\">\n    <ConfigurationType>Makefile</ConfigurationType>\n    <UseDebugLibraries>true</UseDebugLibraries>\n    <PlatformToolset>v143</PlatformToolset>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='BBS02|x64'\" Label=\"Configuration\">\n    <ConfigurationType>Makefile</ConfigurationType>\n    <UseDebugLibraries>true</UseDebugLibraries>\n    <PlatformToolset>v143</PlatformToolset>\n  </PropertyGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.props\" />\n  <ImportGroup Label=\"ExtensionSettings\">\n  </ImportGroup>\n  <ImportGroup Label=\"Shared\">\n  </ImportGroup>\n  <ImportGroup Condition=\"'$(Configuration)|$(Platform)'=='BBSHD|x64'\" Label=\"PropertySheets\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <ImportGroup Condition=\"'$(Configuration)|$(Platform)'=='TSDZ2|x64'\" Label=\"PropertySheets\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <ImportGroup Condition=\"'$(Configuration)|$(Platform)'=='BBS02|x64'\" Label=\"PropertySheets\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <PropertyGroup Label=\"UserMacros\" />\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='BBSHD|x64'\">\n    <NMakeBuildCommandLine>make all TARGET_CONTROLLER=BBSHD</NMakeBuildCommandLine>\n    <NMakeOutput>bbs-fw.hex</NMakeOutput>\n    <NMakeCleanCommandLine>make clean</NMakeCleanCommandLine>\n    <NMakeReBuildCommandLine>make clean\nmake all TARGET_CONTROLLER=BBSHD</NMakeReBuildCommandLine>\n    <NMakePreprocessorDefinitions>BBSHD;$(NMakePreprocessorDefinitions)</NMakePreprocessorDefinitions>\n    <NMakeIncludeSearchPath>C:/Program Files/SDCC/include;C:/Program Files/SDCC/include/mcs51;./</NMakeIncludeSearchPath>\n    <OutDir>$(SolutionDir)</OutDir>\n    <IntDir>build\\$(Platform)\\$(Configuration)\\</IntDir>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='TSDZ2|x64'\">\n    <NMakeBuildCommandLine>make all TARGET_CONTROLLER=TSDZ2</NMakeBuildCommandLine>\n    <NMakeOutput>bbs-fw.hex</NMakeOutput>\n    <NMakeCleanCommandLine>make clean</NMakeCleanCommandLine>\n    <NMakeReBuildCommandLine>make clean\nmake all TARGET_CONTROLLER=TSDZ2</NMakeReBuildCommandLine>\n    <NMakePreprocessorDefinitions>TSDZ2;$(NMakePreprocessorDefinitions)</NMakePreprocessorDefinitions>\n    <NMakeIncludeSearchPath>C:/Program Files/SDCC/include;./</NMakeIncludeSearchPath>\n    <OutDir>$(SolutionDir)</OutDir>\n    <IntDir>build\\$(Platform)\\$(Configuration)\\</IntDir>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='BBS02|x64'\">\n    <NMakeBuildCommandLine>make all TARGET_CONTROLLER=BBS02</NMakeBuildCommandLine>\n    <NMakeOutput>bbs-fw.hex</NMakeOutput>\n    <NMakeCleanCommandLine>make clean</NMakeCleanCommandLine>\n    <NMakeReBuildCommandLine>make clean\nmake all TARGET_CONTROLLER=BBS02</NMakeReBuildCommandLine>\n    <NMakePreprocessorDefinitions>BBS02;$(NMakePreprocessorDefinitions)</NMakePreprocessorDefinitions>\n    <NMakeIncludeSearchPath>C:/Program Files/SDCC/include;C:/Program Files/SDCC/include/mcs51;./</NMakeIncludeSearchPath>\n    <OutDir>$(SolutionDir)</OutDir>\n    <IntDir>build\\$(Platform)\\$(Configuration)\\</IntDir>\n  </PropertyGroup>\n  <ItemDefinitionGroup>\n  </ItemDefinitionGroup>\n  <ItemGroup>\n    <ClCompile Include=\"app.c\" />\n    <ClCompile Include=\"battery.c\" />\n    <ClCompile Include=\"bbsx\\adc.c\" />\n    <ClCompile Include=\"bbsx\\eeprom.c\" />\n    <ClCompile Include=\"bbsx\\lights.c\" />\n    <ClCompile Include=\"bbsx\\motor.c\" />\n    <ClCompile Include=\"bbsx\\sensors.c\" />\n    <ClCompile Include=\"bbsx\\system.c\" />\n    <ClCompile Include=\"bbsx\\timers.c\" />\n    <ClCompile Include=\"bbsx\\uart.c\" />\n    <ClCompile Include=\"bbsx\\watchdog.c\" />\n    <ClCompile Include=\"cfgstore.c\" />\n    <ClCompile Include=\"eventlog.c\" />\n    <ClCompile Include=\"extcom.c\" />\n    <ClCompile Include=\"main.c\" />\n    <ClCompile Include=\"throttle.c\" />\n    <ClCompile Include=\"tsdz2\\adc.c\" />\n    <ClCompile Include=\"tsdz2\\eeprom.c\" />\n    <ClCompile Include=\"tsdz2\\lights.c\" />\n    <ClCompile Include=\"tsdz2\\motor.c\" />\n    <ClCompile Include=\"tsdz2\\sensors.c\" />\n    <ClCompile Include=\"tsdz2\\system.c\" />\n    <ClCompile Include=\"tsdz2\\timers.c\" />\n    <ClCompile Include=\"tsdz2\\torquesensor.c\" />\n    <ClCompile Include=\"tsdz2\\uart.c\" />\n    <ClCompile Include=\"tsdz2\\watchdog.c\" />\n  </ItemGroup>\n  <ItemGroup>\n    <ClInclude Include=\"adc.h\" />\n    <ClInclude Include=\"app.h\" />\n    <ClInclude Include=\"battery.h\" />\n    <ClInclude Include=\"bbsx\\cpu.h\" />\n    <ClInclude Include=\"bbsx\\interrupt.h\" />\n    <ClInclude Include=\"bbsx\\pins.h\" />\n    <ClInclude Include=\"bbsx\\stc15.h\" />\n    <ClInclude Include=\"bbsx\\timers.h\" />\n    <ClInclude Include=\"bbsx\\uart_motor.h\" />\n    <ClInclude Include=\"cfgstore.h\" />\n    <ClInclude Include=\"fwconfig.h\" />\n    <ClInclude Include=\"eeprom.h\" />\n    <ClInclude Include=\"eventlog.h\" />\n    <ClInclude Include=\"extcom.h\" />\n    <ClInclude Include=\"intellisense.h\" />\n    <ClInclude Include=\"interrupt.h\" />\n    <ClInclude Include=\"lights.h\" />\n    <ClInclude Include=\"sensors.h\" />\n    <ClInclude Include=\"throttle.h\" />\n    <ClInclude Include=\"timers.h\" />\n    <ClInclude Include=\"tsdz2\\cpu.h\" />\n    <ClInclude Include=\"tsdz2\\interrupt.h\" />\n    <ClInclude Include=\"tsdz2\\pins.h\" />\n    <ClInclude Include=\"tsdz2\\stm8.h\" />\n    <ClInclude Include=\"tsdz2\\timers.h\" />\n    <ClInclude Include=\"uart.h\" />\n    <ClInclude Include=\"util.h\" />\n    <ClInclude Include=\"motor.h\" />\n    <ClInclude Include=\"system.h\" />\n    <ClInclude Include=\"version.h\" />\n    <ClInclude Include=\"watchdog.h\" />\n  </ItemGroup>\n  <ItemGroup>\n    <None Include=\"makefile\" />\n  </ItemGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.targets\" />\n  <ImportGroup Label=\"ExtensionTargets\">\n  </ImportGroup>\n</Project>"
  },
  {
    "path": "src/firmware/bbs-fw.vcxproj.filters",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <ItemGroup>\n    <Filter Include=\"Source Files\">\n      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>\n      <Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>\n    </Filter>\n    <Filter Include=\"Header Files\">\n      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>\n      <Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>\n    </Filter>\n    <Filter Include=\"Resource Files\">\n      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>\n      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>\n    </Filter>\n    <Filter Include=\"Source Files\\bbsx\">\n      <UniqueIdentifier>{3afcc16a-9b6d-48ec-8c37-3d76d5814243}</UniqueIdentifier>\n    </Filter>\n    <Filter Include=\"Source Files\\tsdz2\">\n      <UniqueIdentifier>{0753682d-650f-4c13-a2b2-7a748cc9fdee}</UniqueIdentifier>\n    </Filter>\n  </ItemGroup>\n  <ItemGroup>\n    <ClCompile Include=\"main.c\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"throttle.c\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"app.c\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"eventlog.c\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"extcom.c\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"cfgstore.c\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"battery.c\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"bbsx\\adc.c\">\n      <Filter>Source Files\\bbsx</Filter>\n    </ClCompile>\n    <ClCompile Include=\"bbsx\\eeprom.c\">\n      <Filter>Source Files\\bbsx</Filter>\n    </ClCompile>\n    <ClCompile Include=\"bbsx\\motor.c\">\n      <Filter>Source Files\\bbsx</Filter>\n    </ClCompile>\n    <ClCompile Include=\"bbsx\\timers.c\">\n      <Filter>Source Files\\bbsx</Filter>\n    </ClCompile>\n    <ClCompile Include=\"bbsx\\uart.c\">\n      <Filter>Source Files\\bbsx</Filter>\n    </ClCompile>\n    <ClCompile Include=\"bbsx\\watchdog.c\">\n      <Filter>Source Files\\bbsx</Filter>\n    </ClCompile>\n    <ClCompile Include=\"tsdz2\\motor.c\">\n      <Filter>Source Files\\tsdz2</Filter>\n    </ClCompile>\n    <ClCompile Include=\"tsdz2\\eeprom.c\">\n      <Filter>Source Files\\tsdz2</Filter>\n    </ClCompile>\n    <ClCompile Include=\"tsdz2\\watchdog.c\">\n      <Filter>Source Files\\tsdz2</Filter>\n    </ClCompile>\n    <ClCompile Include=\"bbsx\\sensors.c\">\n      <Filter>Source Files\\bbsx</Filter>\n    </ClCompile>\n    <ClCompile Include=\"bbsx\\lights.c\">\n      <Filter>Source Files\\bbsx</Filter>\n    </ClCompile>\n    <ClCompile Include=\"bbsx\\system.c\">\n      <Filter>Source Files\\bbsx</Filter>\n    </ClCompile>\n    <ClCompile Include=\"tsdz2\\adc.c\">\n      <Filter>Source Files\\tsdz2</Filter>\n    </ClCompile>\n    <ClCompile Include=\"tsdz2\\lights.c\">\n      <Filter>Source Files\\tsdz2</Filter>\n    </ClCompile>\n    <ClCompile Include=\"tsdz2\\sensors.c\">\n      <Filter>Source Files\\tsdz2</Filter>\n    </ClCompile>\n    <ClCompile Include=\"tsdz2\\system.c\">\n      <Filter>Source Files\\tsdz2</Filter>\n    </ClCompile>\n    <ClCompile Include=\"tsdz2\\timers.c\">\n      <Filter>Source Files\\tsdz2</Filter>\n    </ClCompile>\n    <ClCompile Include=\"tsdz2\\uart.c\">\n      <Filter>Source Files\\tsdz2</Filter>\n    </ClCompile>\n    <ClCompile Include=\"tsdz2\\torquesensor.c\">\n      <Filter>Source Files\\tsdz2</Filter>\n    </ClCompile>\n  </ItemGroup>\n  <ItemGroup>\n    <ClInclude Include=\"motor.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"system.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"util.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"watchdog.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"uart.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"throttle.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"app.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"eventlog.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"sensors.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"extcom.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"cfgstore.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"eeprom.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"version.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"lights.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"adc.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"battery.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"timers.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"bbsx\\timers.h\">\n      <Filter>Source Files\\bbsx</Filter>\n    </ClInclude>\n    <ClInclude Include=\"bbsx\\uart_motor.h\">\n      <Filter>Source Files\\bbsx</Filter>\n    </ClInclude>\n    <ClInclude Include=\"bbsx\\interrupt.h\">\n      <Filter>Source Files\\bbsx</Filter>\n    </ClInclude>\n    <ClInclude Include=\"bbsx\\stc15.h\">\n      <Filter>Source Files\\bbsx</Filter>\n    </ClInclude>\n    <ClInclude Include=\"interrupt.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"tsdz2\\interrupt.h\">\n      <Filter>Source Files\\tsdz2</Filter>\n    </ClInclude>\n    <ClInclude Include=\"intellisense.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"bbsx\\pins.h\">\n      <Filter>Source Files\\bbsx</Filter>\n    </ClInclude>\n    <ClInclude Include=\"bbsx\\cpu.h\">\n      <Filter>Source Files\\bbsx</Filter>\n    </ClInclude>\n    <ClInclude Include=\"tsdz2\\cpu.h\">\n      <Filter>Source Files\\tsdz2</Filter>\n    </ClInclude>\n    <ClInclude Include=\"tsdz2\\pins.h\">\n      <Filter>Source Files\\tsdz2</Filter>\n    </ClInclude>\n    <ClInclude Include=\"tsdz2\\stm8.h\">\n      <Filter>Source Files\\tsdz2</Filter>\n    </ClInclude>\n    <ClInclude Include=\"tsdz2\\timers.h\">\n      <Filter>Source Files\\tsdz2</Filter>\n    </ClInclude>\n    <ClInclude Include=\"fwconfig.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n  </ItemGroup>\n  <ItemGroup>\n    <None Include=\"makefile\" />\n  </ItemGroup>\n</Project>"
  },
  {
    "path": "src/firmware/bbsx/adc.c",
    "content": "/*\r\n * bbs-fw\r\n *\r\n * Copyright (C) Daniel Nilsson, 2022.\r\n *\r\n * Released under the GPL License, Version 3\r\n */\r\n\r\n#include \"adc.h\"\r\n#include \"bbsx/stc15.h\"\r\n#include \"bbsx/pins.h\"\r\n\r\n\r\nstatic uint8_t next_channel;\r\nstatic uint8_t no_adc_reading_counter;\r\n\r\nstatic uint8_t throttle_value;\r\nstatic uint16_t temperature_contr_value;\r\nstatic uint16_t temperature_motor_value;\r\n\r\n\r\nvoid adc_init()\r\n{\r\n\t// Setup pin voltage as high impedance input even though it is not used\r\n\tSET_PIN_INPUT(PIN_VOLTAGE);\r\n\r\n\t// Setup pin throttle as adc input\r\n\tSET_PIN_INPUT(PIN_THROTTLE);\r\n\tSET_PIN_LOW(PIN_THROTTLE);\r\n\tSET_BIT(P1ASF, GET_PIN_NUM(PIN_THROTTLE));\r\n\r\n\t// Setup pin controller temperature pin as adc input\r\n\tSET_PIN_INPUT(PIN_TEMPERATURE_CONTR);\r\n\tSET_PIN_LOW(PIN_TEMPERATURE_CONTR);\r\n\tSET_BIT(P1ASF, GET_PIN_NUM(PIN_TEMPERATURE_CONTR));\r\n\r\n#ifdef BBSHD\r\n\t// Setup pin motor temperature pin as adc input\r\n\tSET_PIN_INPUT(PIN_TEMPERATURE_MOTOR);\r\n\tSET_PIN_LOW(PIN_TEMPERATURE_MOTOR);\r\n\tSET_BIT(P1ASF, GET_PIN_NUM(PIN_TEMPERATURE_MOTOR));\r\n#endif\r\n\r\n\tADC_RES = 0;\r\n\tADC_RESL = 0;\r\n\r\n\t// Arrange adc result for 8bit reading\r\n\tCLEAR_BIT(PCON2, 5);\r\n\r\n\tADC_CONTR = (uint8_t)((1 << 7));\r\n\r\n\tno_adc_reading_counter = 0;\r\n\tthrottle_value = 0;\r\n\ttemperature_contr_value = 0;\r\n\ttemperature_motor_value = 0;\r\n\tnext_channel = GET_PIN_NUM(PIN_THROTTLE);\r\n\r\n\r\n\t// throttle is read during init since a valid value must be\r\n\t// needs to be available for fir throttle_process to not mess\r\n\t// up safeguard logic\r\n\r\n\t// enable adc power and read throttle\r\n\tADC_CONTR = (uint8_t)((1 << 7) | (1 << 3) | next_channel);\r\n\r\n\t// wait for throttle reading and process\r\n\twhile (!IS_BIT_SET(ADC_CONTR, 4));\r\n\tadc_process();\r\n}\r\n\r\nvoid adc_process()\r\n{\r\n\t// adc reading available\r\n\tif (IS_BIT_SET(ADC_CONTR, 4))\r\n\t{\r\n\t\tno_adc_reading_counter = 0;\r\n\r\n\t\tADC_CONTR = (uint8_t)((1 << 7)); // Clear ADC_FLAG \r\n\r\n\t\tswitch (next_channel)\r\n\t\t{\r\n\t\tcase GET_PIN_NUM(PIN_THROTTLE):\r\n\t\t{\r\n\t\t\tthrottle_value = ADC_RES;\r\n\t\t\tnext_channel = GET_PIN_NUM(PIN_TEMPERATURE_CONTR);\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tcase GET_PIN_NUM(PIN_TEMPERATURE_CONTR):\r\n\t\t{\r\n\t\t\ttemperature_contr_value = (((uint16_t)ADC_RES) << 2) | ADC_RESL;\r\n#ifdef BBSHD\r\n\t\t\tnext_channel = GET_PIN_NUM(PIN_TEMPERATURE_MOTOR);\r\n#else\r\n\t\t\tnext_channel = GET_PIN_NUM(PIN_THROTTLE);\r\n#endif\r\n\t\t\tbreak;\r\n\t\t}\r\n#ifdef BBSHD\r\n\t\tcase GET_PIN_NUM(PIN_TEMPERATURE_MOTOR):\r\n\t\t{\r\n\t\t\ttemperature_motor_value = (((uint16_t)ADC_RES) << 2) | ADC_RESL;\r\n\t\t\tnext_channel = GET_PIN_NUM(PIN_THROTTLE);\r\n\t\t\tbreak;\r\n\t\t}\r\n#endif\r\n\t\t}\r\n\t}\r\n\telse if (++no_adc_reading_counter == 0)\r\n\t{\r\n\t\t// reinitialize adc\r\n\t\tADC_RES = 0;\r\n\t\tADC_CONTR = (uint8_t)(1 << 7);\r\n\t\tno_adc_reading_counter = 0;\r\n\t\tthrottle_value = 0;\r\n\t\ttemperature_motor_value = 0;\r\n\t\ttemperature_contr_value = 0;\r\n\t\tnext_channel = GET_PIN_NUM(PIN_THROTTLE);\r\n\t}\r\n\telse\r\n\t{\r\n\t\treturn;\r\n\t}\r\n\r\n\t// start next reading\r\n\tADC_RES = 0;\r\n\tADC_CONTR = (uint8_t)((1 << 7) | (1 << 3) | next_channel);\r\n}\r\n\r\n\r\nuint8_t adc_get_throttle()\r\n{\r\n\treturn throttle_value;\r\n}\r\n\r\nuint16_t adc_get_torque()\r\n{\r\n\treturn 0;\r\n}\r\n\r\nuint16_t adc_get_temperature_contr()\r\n{\r\n\treturn temperature_contr_value;\r\n}\r\n\r\nuint16_t adc_get_temperature_motor()\r\n{\r\n\treturn temperature_motor_value;\r\n}\r\n\r\nuint16_t adc_get_battery_voltage()\r\n{\r\n\t// not implemented, motor MCU sends adc battery voltage value\r\n\treturn 0;\r\n}\r\n"
  },
  {
    "path": "src/firmware/bbsx/cpu.h",
    "content": "/*\n * bbs-fw\n *\n * Copyright (C) Daniel Nilsson, 2022.\n *\n * Released under the GPL License, Version 3\n */\n\n#ifndef _BBSX_CPU_H_\n#define _BBSX_CPU_H_\n\n#define CPU_FREQ\t20000000L\n\n#endif\n"
  },
  {
    "path": "src/firmware/bbsx/eeprom.c",
    "content": "/*\n * bbs-fw\n *\n * Copyright (C) Daniel Nilsson, 2022.\n *\n * Released under the GPL License, Version 3\n */\n\n#include \"eeprom.h\"\n#include \"bbsx/stc15.h\"\n\n\n#define EEPROM_NUM_SECTORS\t\t\t4\n\n // STC chips has a special area in flash for eeprom.\n#define EEPROM_STC_ADDRESS_OFFSET\t0x0000\n\n// IAP chips have no special area, same area as program\n// memory and address space is the same. We define the last\n// four sectors for eeprom usage ourself.\n#define EEPROM_IAP_ADDRESS_OFFSET\t0xEC00\n\n#define IAP_CMD_IDLE\t\t0\n#define IAP_CMD_READ\t\t1\n#define IAP_CMD_PROGRAM\t\t2\n#define IAP_CMD_ERASE\t\t3\n\n#define IAP_ENABLE\t\t\t0x82\t\t// Wait time, CPU_FREQ < 20MHz\n\n\nstatic uint16_t address_offset = 0x0000;\nstatic uint16_t selected_sector_offset = 0;\n\n\nstatic void eeprom_begin(uint8_t cmd, int offset)\n{\n\tIAP_CONTR = IAP_ENABLE;\n\tIAP_CMD = cmd;\n\n\tuint16_t addr = selected_sector_offset + offset;\n\tIAP_ADDRH = addr >> 8;\n\tIAP_ADDRL = addr;\n}\n\nstatic bool eeprom_trigger()\n{\n\tIAP_TRIG = 0x5a;\n\tIAP_TRIG = 0xa5;\n\tNOP();\n\n\treturn !IS_BIT_SET(IAP_CONTR, 4);\n}\n\nstatic void eeprom_end()\n{\n\tIAP_CONTR = 0;\n\tIAP_CMD = 0;\n\tIAP_TRIG = 0;\n\tIAP_ADDRH = 0xff;\n\tIAP_ADDRL = 0xff;\n}\n\nvoid eeprom_init()\n{\n\t// Detect if we are running on IAP or STC model dependeing on if\n\t// we can read from IAP address offset which is outside eeprom\n\t// address space on STC model.\n\n\taddress_offset = EEPROM_IAP_ADDRESS_OFFSET;\n\teeprom_select_page(0);\n\tif (eeprom_read_byte(0) == -1)\n\t{\n\t\taddress_offset = EEPROM_STC_ADDRESS_OFFSET;\n\t}\n}\n\nbool eeprom_select_page(int page)\n{\n\tif (page >= 0 && page < EEPROM_NUM_SECTORS)\n\t{\n\t\tselected_sector_offset = address_offset + page * 512;\n\t\treturn true;\n\t}\n\n\treturn false;\n}\n\nbool eeprom_erase_page()\n{\n\tbool res;\n\n\teeprom_begin(IAP_CMD_ERASE, 0);\n\tres = eeprom_trigger();\n\teeprom_end();\n\n\treturn res;\n}\n\nint eeprom_read_byte(int offset)\n{\n\tint res = -1;\n\n\teeprom_begin(IAP_CMD_READ, offset);\n\n\tif (eeprom_trigger())\n\t{\n\t\tres = IAP_DATA;\n\t}\n\n\teeprom_end();\n\n\treturn res;\n}\n\nbool eeprom_write_byte(int offset, uint8_t value)\n{\n\tbool res;\n\n\teeprom_begin(IAP_CMD_PROGRAM, offset);\n\tIAP_DATA = value;\n\tres = eeprom_trigger();\n\teeprom_end();\n\n\treturn res;\n}\n\nbool eeprom_end_write()\n{\n\treturn true;\n}\n"
  },
  {
    "path": "src/firmware/bbsx/interrupt.h",
    "content": "/*\n * bbs-fw\n *\n * Copyright (C) Daniel Nilsson, 2022.\n *\n * Released under the GPL License, Version 3\n */\n\n#ifndef  _BBSX_INTERRUPT_H_\n#define _BBSX_INTERRUPT_H_\n\n#include <stc12.h>\n#include \"intellisense.h\"\n\n#define IRQ_TIMER0\t\t1\n#define IRQ_UART1\t\t4\n#define IRQ_UART2\t\t8\n\nINTERRUPT_USING(isr_timer0, IRQ_TIMER0, 1);\t\t// system.c\nINTERRUPT_USING(isr_uart1, IRQ_UART1, 3);\t\t// uart.c\nINTERRUPT_USING(isr_uart2, IRQ_UART2, 3);\t\t// uart.c\n\n#endif\n"
  },
  {
    "path": "src/firmware/bbsx/lights.c",
    "content": "/*\n * bbs-fw\n *\n * Copyright (C) Daniel Nilsson, 2022.\n *\n * Released under the GPL License, Version 3\n */\n\n#include \"lights.h\"\n#include \"bbsx/pins.h\"\n#include \"bbsx/stc15.h\"\n\n\nvoid lights_init()\n{\n\tSET_PIN_OUTPUT(PIN_LIGHTS_POWER);\n\tSET_PIN_OUTPUT(PIN_LIGHTS);\n\n\tlights_disable();\n\tlights_set(false);\n}\n\nvoid lights_enable()\n{\n\t// enable signal level is swapped on BBSHD vs BBS02...\n#if defined(BBSHD)\n\tSET_PIN_HIGH(PIN_LIGHTS_POWER);\n#elif defined(BBS02)\n\tSET_PIN_LOW(PIN_LIGHTS_POWER);\n#endif\n}\n\nvoid lights_disable()\n{\n\t// enable signal level is swapped on BBSHD vs BBS02...\n#if defined(BBSHD)\n\tSET_PIN_LOW(PIN_LIGHTS_POWER);\n#elif defined(BBS02)\n\tSET_PIN_HIGH(PIN_LIGHTS_POWER);\n#endif\n}\n\nvoid lights_set(bool on)\n{\n\tif (on)\n\t{\n\t\tSET_PIN_LOW(PIN_LIGHTS);\n\t}\n\telse\n\t{\n\t\tSET_PIN_HIGH(PIN_LIGHTS);\n\t}\n}\n"
  },
  {
    "path": "src/firmware/bbsx/motor.c",
    "content": "/*\n * bbs-fw\n *\n * Copyright (C) Daniel Nilsson, 2022.\n *\n * Released under the GPL License, Version 3\n */\n\n#include \"motor.h\"\n#include \"sensors.h\"\n#include \"system.h\"\n#include \"eventlog.h\"\n#include \"bbsx/uart_motor.h\"\n#include \"bbsx/pins.h\"\n\n#include <stdbool.h>\n\n#define OPCODE_LVC\t\t\t\t0x60\n#define OPCODE_MAX_CURRENT\t\t0x61\n#define OPCODE_TARGET_SPEED\t\t0x63\n#define OPCODE_TARGET_CURRENT\t0x64\n#define OPCODE_HELLO\t\t\t0x67\n#define OPCODE_UNKNOWN1\t\t\t0x68\n#define OPCODE_UNKNOWN2\t\t\t0x69\n#define OPCODE_UNKNOWN3\t\t\t0x6A\n#define OPCODE_UNKNOWN4\t\t\t0x6B\n#define OPCODE_UNKNOWN5\t\t\t0x6C\n#define OPCODE_UNKNOWN5\t\t\t0x6C\n#define OPCODE_UNKNOWN6\t\t\t0x6D\n#define OPCODE_UNKNOWN7\t\t\t0x6E\n\n#define OPCODE_READ_STATUS\t\t0x40\n#define OPCODE_READ_CURRENT\t\t0x41\n#define OPCODE_READ_VOLTAGE\t\t0x42\n\n#define READ_TIMEOUT\t\t\t100\n\n#if defined(BBSHD)\n\t#define ADC_STEPS_PER_AMP_X10\t\t69\n\t#define ADC_STEPS_PER_VOLT_X100\t\t1490 // 1460 in orginal firmware\n#elif defined(BBS02)\n\t#define ADC_STEPS_PER_AMP_X10\t\t56\n\t#define ADC_STEPS_PER_VOLT_X100\t\t1510\n#endif\n\n#define SPEED_STEPS\t\t\t\t\t250\n\n// async om state machine\n#define COM_STATE_IDLE\t\t\t\t0x01\n#define COM_STATE_WAIT_RESPONSE\t\t0x02\n#define COM_STATE_SET_CURRENT\t\t0x03\n#define COM_STATE_SET_SPEED\t\t\t0x04\n#define COM_STATE_READ_STATUS\t\t0x05\n#define COM_STATE_READ_CURRENT\t\t0x06\n#define COM_STATE_READ_VOLTAGE\t\t0x07\n\n#define MSGBUF_SIZE\t\t\t\t\t8\n\nstatic uint8_t is_connected;\nstatic uint8_t msgbuf[MSGBUF_SIZE];\n\nstatic bool target_speed_changed;\nstatic uint8_t target_speed;\n\nstatic bool target_current_changed;\nstatic uint8_t target_current;\n\nstatic uint16_t adc_steps_per_volt_x100;\nstatic uint16_t lvc_volt_x10;\n\nstatic uint16_t status_flags;\nstatic uint16_t battery_volt_x10;\nstatic uint16_t battery_adc_steps;\nstatic uint16_t battery_amp_x10;\n\n// state machine state\nstatic uint8_t com_state;\nstatic uint8_t last_sent_opcode;\nstatic uint32_t last_request_write_ms;\nstatic uint32_t last_status_read_ms;\nstatic uint8_t next_status_read_opcode;\n\n\nstatic uint8_t compute_checksum(uint8_t* msg, uint8_t len);\nstatic void send_request(uint8_t opcode, uint16_t data);\nstatic void send_request_async(uint8_t opcode, uint16_t data);\n\nstatic int read_response(uint8_t opcode, uint16_t* out_data);\nstatic int try_read_response(uint8_t opcode, uint16_t* out_data);\nstatic int connect();\nstatic int configure(uint16_t max_current_mA, uint8_t lvc_V);\n\nstatic void process_com_state_machine();\n\n\nvoid motor_pre_init()\n{\n\tSET_PIN_OUTPUT(PIN_MOTOR_POWER_ENABLE);\n\tSET_PIN_OUTPUT(PIN_MOTOR_CONTROL_ENABLE);\n\tSET_PIN_OUTPUT(PIN_MOTOR_EXTRA);\n\n\tSET_PIN_LOW(PIN_MOTOR_POWER_ENABLE);\n\tSET_PIN_HIGH(PIN_MOTOR_CONTROL_ENABLE);\n\tSET_PIN_HIGH(PIN_MOTOR_EXTRA);\n}\n\nvoid motor_init(uint16_t max_current_mA, uint8_t lvc_V, int16_t adc_calib_volt_steps_x100)\n{\n\tmotor_pre_init();\n\n\tis_connected = 0;\n\ttarget_speed_changed = false;\n\ttarget_speed = 0;\n\ttarget_current_changed = false;\n\ttarget_current = 0;\n\tstatus_flags = 0;\n\tadc_steps_per_volt_x100 = ADC_STEPS_PER_VOLT_X100 + adc_calib_volt_steps_x100;\n\tlvc_volt_x10 = (uint16_t)lvc_V * 10;\n\tbattery_volt_x10 = 0;\n\tbattery_adc_steps = 0;\n\tbattery_amp_x10 = 0;\n\n\tcom_state = COM_STATE_IDLE;\n\tlast_sent_opcode = 0;\n\tlast_request_write_ms = 0;\n\tlast_status_read_ms = 0;\n\tnext_status_read_opcode = OPCODE_READ_STATUS;\n\n\tuart_motor_open(4800);\n\n\t// Give other MCU time to power on\n\twhile (system_ms() < 100);\n\n\tif (connect() && configure(max_current_mA, lvc_V))\n\t{\n\t\tis_connected = 1;\n\n\t\teventlog_write(EVT_MSG_MOTOR_INIT_OK);\n\n\t\tmotor_set_target_speed(0);\n\t\tmotor_set_target_current(0);\n\t\ttarget_current_changed = true;\n\t\ttarget_speed_changed = true;\n\t}\n\telse\n\t{\n\t\teventlog_write(EVT_ERROR_INIT_MOTOR);\n\t}\n}\n\nvoid motor_process()\n{\n\tif (!is_connected)\n\t{\n\t\treturn;\n\t}\n\n\tprocess_com_state_machine();\n}\n\nvoid motor_enable()\n{\n\tSET_PIN_HIGH(PIN_MOTOR_POWER_ENABLE);\n}\n\nvoid motor_disable()\n{\n\tif (!brake_is_activated())\n\t{\n\t\t// Brake signal is also connected to motor control MCU.\n\t\t// If we disable motor power here during braking it causes\n\t\t// a small issue where change in target current is not accepted\n\t\t// while in disabled state. This will result in a short power spike\n\t\t// when brake eventually released.\n\n\t\tSET_PIN_LOW(PIN_MOTOR_POWER_ENABLE);\n\t}\t\n}\n\nuint16_t motor_status()\n{\n\treturn status_flags;\n}\n\nuint8_t motor_get_target_speed()\n{\n\treturn target_speed;\n}\n\nuint8_t motor_get_target_current()\n{\n\treturn target_current;\n}\n\n\nvoid motor_set_target_speed(uint8_t percent)\n{\n\tif (percent > 100)\n\t{\n\t\tpercent = 100;\n\t}\n\n\tif (target_speed != percent)\n\t{\n\t\ttarget_speed = percent;\n\t\ttarget_speed_changed = true;\n\t}\n}\n\nvoid motor_set_target_current(uint8_t percent)\n{\n\tif (percent > 100)\n\t{\n\t\tpercent = 100;\n\t}\n\n\tif (target_current != percent)\n\t{\n\t\ttarget_current = percent;\n\t\ttarget_current_changed = true;\n\t}\n}\n\nint16_t motor_calibrate_battery_voltage(uint16_t actual_voltage_x100)\n{\n\tint16_t diff = 0;\n\tif (actual_voltage_x100 != 0)\n\t{\n\t\tuint16_t calibrated_adc_steps_volt_x100 = (uint16_t)(((uint32_t)battery_adc_steps * 10000u) / actual_voltage_x100);\n\t\tdiff = calibrated_adc_steps_volt_x100 - ADC_STEPS_PER_VOLT_X100;\n\n\t\tadc_steps_per_volt_x100 = calibrated_adc_steps_volt_x100;\n\t}\n\telse\n\t{\n\t\t// reset calibration if 0 is received\n\t\tadc_steps_per_volt_x100 = ADC_STEPS_PER_VOLT_X100;\n\t\tdiff = 0;\n\t}\n\n\teventlog_write_data(EVT_DATA_CALIBRATE_VOLTAGE, adc_steps_per_volt_x100);\n\n\treturn diff;\n}\n\n\nuint16_t motor_get_battery_lvc_x10()\n{\n\treturn lvc_volt_x10;\n}\n\nuint16_t motor_get_battery_current_x10()\n{\n\treturn battery_amp_x10;\n}\n\nuint16_t motor_get_battery_voltage_x10()\n{\n\treturn battery_volt_x10;\n}\n\nstatic uint8_t compute_checksum(uint8_t* msg, uint8_t len)\n{\n\tuint8_t checksum = 0;\n\tfor (int i = 0; i < len; ++i)\n\t{\n\t\tchecksum += *(msg + i);\n\t}\n\n\treturn checksum;\n}\n\nstatic void send_request(uint8_t opcode, uint16_t data)\n{\n\t// empty rx buffer\n\twhile (uart_motor_available()) uart_motor_read();\n\n\tsend_request_async(opcode, data);\n\n\tuart_motor_flush();\n}\n\nstatic void send_request_async(uint8_t opcode, uint16_t data)\n{\n\tuint8_t idx = 0;\n\n\tmsgbuf[idx++] = 0xaa; // start of message\n\tmsgbuf[idx++] = opcode;\n\n\tif (opcode == OPCODE_LVC)\n\t{\n\t\tmsgbuf[idx++] = data >> 8;\n\t\tmsgbuf[idx++] = data;\n\t}\n\telse if (opcode != OPCODE_READ_STATUS && opcode != OPCODE_READ_CURRENT && opcode != OPCODE_READ_VOLTAGE)\n\t{\n\t\tmsgbuf[idx++] = data;\n\t}\n\n\tuint8_t checksum = compute_checksum(msgbuf + 1, idx - 1);\n\tmsgbuf[idx++] = checksum;\n\n\tfor (uint8_t i = 0; i < idx; ++i)\n\t{\n\t\tuart_motor_write(msgbuf[i]);\n\t}\n}\n\nstatic int read_response(uint8_t opcode, uint16_t* out_data)\n{\n\tuint32_t end = system_ms() + READ_TIMEOUT;\n\n\tuint8_t len = (opcode == OPCODE_LVC || opcode == OPCODE_READ_STATUS || opcode == OPCODE_READ_VOLTAGE) ? 5 : 4;\n\n\tuint8_t i = 0;\n\twhile (i < len && system_ms() < end)\n\t{\n\t\tif (uart_motor_available())\n\t\t{\n\t\t\tmsgbuf[i++] = uart_motor_read();\n\t\t}\n\t}\n\n\tif (i == len && msgbuf[1] == opcode)\n\t{\n\t\tuint8_t checksum = compute_checksum(&msgbuf[1], (uint8_t)(i - 2));\n\t\tif (checksum == msgbuf[i - 1])\n\t\t{\n\t\t\tif (out_data != 0)\n\t\t\t{\n\t\t\t\tif (opcode == OPCODE_LVC || opcode == OPCODE_READ_STATUS || opcode == OPCODE_READ_VOLTAGE)\n\t\t\t\t{\n\t\t\t\t\t*out_data = msgbuf[2] << 8 | msgbuf[3];\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t*out_data = msgbuf[2];\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn 1;\n\t\t}\n\n\t\treturn 0; // failed to verify message\n\t}\n\n\t// read failure\n\treturn 0;\n}\n\nstatic int try_read_response(uint8_t opcode, uint16_t* out_data)\n{\n\tuint8_t len = (opcode == OPCODE_LVC || opcode == OPCODE_READ_STATUS || opcode == OPCODE_READ_VOLTAGE) ? 5 : 4;\n\n\tuint8_t i = 0;\n\twhile (uart_motor_available() && i < MSGBUF_SIZE)\n\t{\n\t\tmsgbuf[i++] = uart_motor_read();\n\t}\n\n\t// clear anything that could be left in rxbuffer in case of error.\n\twhile (uart_motor_available()) uart_motor_read();\n\n\tif (i < len)\n\t{\n\t\t// failed to read entire response\n\t\treturn 0;\n\t}\n\n\tif (i == len && msgbuf[1] == opcode)\n\t{\n\t\tuint8_t checksum = compute_checksum(&msgbuf[1], (uint8_t)(i - 2));\n\t\tif (checksum == msgbuf[i - 1])\n\t\t{\n\t\t\tif (out_data != 0)\n\t\t\t{\n\t\t\t\tif (opcode == OPCODE_LVC || opcode == OPCODE_READ_STATUS || opcode == OPCODE_READ_VOLTAGE)\n\t\t\t\t{\n\t\t\t\t\t*out_data = ((uint16_t)msgbuf[2] << 8) | msgbuf[3];\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t*out_data = msgbuf[2];\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn 1;\n\t\t}\n\n\t\treturn 0; // failed to verify message\n\t}\n\n\t// read failure\n\treturn 0;\n}\n\n\nstatic int connect()\n{\n\tfor (int i = 0; i < 10; ++i)\n\t{\n\t\tsend_request(OPCODE_HELLO, 0x00);\n\n\t\tif (read_response(OPCODE_HELLO, 0))\n\t\t{\n\t\t\tsystem_delay_ms(4);\n\t\t\treturn 1;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tsystem_delay_ms(1000);\n\t\t}\n\t}\n\n\treturn 0;\n}\n\nstatic int configure(uint16_t max_current_mA, uint8_t lvc_V)\n{\n\tuint16_t tmp = 0;\n\n\t// This initialization is done exactly as in orginal firmware for BBSHD/BBS02.\n\t// The meaning of most parameters is unknown.\n\n#if defined (BBSHD)\n\tsend_request(OPCODE_UNKNOWN1, 0x5a);\n#elif defined (BBS02)\n\tsend_request(OPCODE_UNKNOWN1, 0x5f);\n#else\n\treturn 0;\n#endif\n\n\tif (!read_response(OPCODE_UNKNOWN1, 0))\n\t{\n\t\treturn 0;\n\t}\n\n\tsystem_delay_ms(4);\n\n\tsend_request(OPCODE_UNKNOWN2, 0x11);\n\tif (!read_response(OPCODE_UNKNOWN2, 0))\n\t{\n\t\treturn 0;\n\t}\n\n\tsystem_delay_ms(4);\n\n\tsend_request(OPCODE_UNKNOWN3, 0x78);\n\tif (!read_response(OPCODE_UNKNOWN3, 0))\n\t{\n\t\treturn 0;\n\t}\n\n\tsystem_delay_ms(4);\n\n\tsend_request(OPCODE_UNKNOWN4, 0x64);\n\tif (!read_response(OPCODE_UNKNOWN4, 0))\n\t{\n\t\treturn 0;\n\t}\n\n\tsystem_delay_ms(4);\n\n\tsend_request(OPCODE_UNKNOWN5, 0x50);\n\tif (!read_response(OPCODE_UNKNOWN5, 0))\n\t{\n\t\treturn 0;\n\t}\n\n\tsystem_delay_ms(4);\n\n\tsend_request(OPCODE_UNKNOWN6, 0x46);\n\tif (!read_response(OPCODE_UNKNOWN6, 0))\n\t{\n\t\treturn 0;\n\t}\n\n\tsystem_delay_ms(4);\n\n\tsend_request(OPCODE_UNKNOWN7, 0x0c);\n\tif (!read_response(OPCODE_UNKNOWN7, 0))\n\t{\n\t\treturn 0;\n\t}\n\n\tsystem_delay_ms(4);\n\n\tsend_request(OPCODE_LVC, (uint32_t)(((uint32_t)lvc_V * adc_steps_per_volt_x100) / 100u));\n\tif (!read_response(OPCODE_LVC, 0))\n\t{\n\t\treturn 0;\n\t}\n\n\tsystem_delay_ms(4);\n\n\ttmp = (uint16_t)((max_current_mA * (uint32_t)ADC_STEPS_PER_AMP_X10) / 10000UL);\n\tif (tmp > 255)\n\t{\n\t\ttmp = 255;\n\t}\n\teventlog_write_data(EVT_DATA_MAX_CURRENT_ADC_REQUEST, tmp);\n\n\tsend_request(OPCODE_MAX_CURRENT, tmp);\n\tif (!read_response(OPCODE_MAX_CURRENT, &tmp))\n\t{\n\t\treturn 0;\n\t}\n\telse\n\t{\n\t\teventlog_write_data(EVT_DATA_MAX_CURRENT_ADC_RESPONSE, tmp);\n\t}\n\n\tsystem_delay_ms(4);\n\n\treturn 1;\n}\n\n\nstatic void process_com_state_machine_idle()\n{\n\t// Async state machine loop for serial communication with motor control MCU.\n\t//\n\t// Handles:\n\t// * Set target current\n\t// * Set target speed\n\t// * Read motor status\n\t// * Read motor current\n\t// * Read battery voltage\n\t//\n\t// Set target speed/current are prioritzed over status reading (shorter check interval).\n\n\tuint32_t now = system_ms();\n\n\t// make sure requests have some space between them\n\tif (now - last_request_write_ms < 32)\n\t{\n\t\treturn;\n\t}\n\n\tif (target_current_changed)\n\t{\n\t\tsend_request_async(OPCODE_TARGET_CURRENT, target_current);\n\t\tlast_sent_opcode = OPCODE_TARGET_CURRENT;\n\t\tlast_request_write_ms = now;\n\t\tcom_state = COM_STATE_WAIT_RESPONSE;\n\t\ttarget_current_changed = false;\n\t\treturn;\n\t}\n\n\tif (target_speed_changed)\n\t{\n\t\tsend_request_async(OPCODE_TARGET_SPEED, (uint8_t)(((uint16_t)SPEED_STEPS * target_speed) / 100));\n\t\tlast_sent_opcode = OPCODE_TARGET_SPEED;\n\t\tlast_request_write_ms = now;\n\t\tcom_state = COM_STATE_WAIT_RESPONSE;\n\t\ttarget_speed_changed = false;\n\t\treturn;\n\t}\n\n\tif ((now - last_status_read_ms) > 200)\n\t{\n\t\tsend_request_async(next_status_read_opcode, 0);\n\t\tlast_sent_opcode = next_status_read_opcode;\n\t\tlast_request_write_ms = now;\n\t\tcom_state = COM_STATE_WAIT_RESPONSE;\n\t\tif (next_status_read_opcode == OPCODE_READ_STATUS)\n\t\t{\n\t\t\tlast_status_read_ms = now;\n\t\t}\n\t\treturn;\n\t}\n}\n\nstatic void process_com_state_machine_wait_response()\n{\n\tuint8_t response_length = 0;\n\n\tswitch (last_sent_opcode)\n\t{\n\tcase OPCODE_TARGET_CURRENT:\n\tcase OPCODE_TARGET_SPEED:\n\tcase OPCODE_READ_CURRENT:\n\t\tresponse_length = 4;\n\t\tbreak;\n\tcase OPCODE_READ_VOLTAGE:\n\tcase OPCODE_READ_STATUS:\n\t\tresponse_length = 5;\n\t\tbreak;\n\t}\n\n\tif (uart_motor_available() >= response_length || (system_ms() - last_request_write_ms) > 32)\n\t{\n\t\tswitch (last_sent_opcode)\n\t\t{\n\t\tcase OPCODE_TARGET_CURRENT:\n\t\t\tcom_state = COM_STATE_SET_CURRENT;\n\t\t\tbreak;\n\t\tcase OPCODE_TARGET_SPEED:\n\t\t\tcom_state = COM_STATE_SET_SPEED;\n\t\t\tbreak;\n\t\tcase OPCODE_READ_CURRENT:\n\t\t\tcom_state = COM_STATE_READ_CURRENT;\n\t\t\tbreak;\n\t\tcase OPCODE_READ_VOLTAGE:\n\t\t\tcom_state = COM_STATE_READ_VOLTAGE;\n\t\t\tbreak;\n\t\tcase OPCODE_READ_STATUS:\n\t\t\tcom_state = COM_STATE_READ_STATUS;\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tcom_state = COM_STATE_IDLE;\n\t\t\tbreak;\n\t\t}\n\t}\n}\n\nstatic void process_com_state_machine()\n{\n\tuint16_t data;\n\tswitch (com_state)\n\t{\n\tcase COM_STATE_IDLE:\n\t\tprocess_com_state_machine_idle();\n\t\tbreak;\n\n\tcase COM_STATE_WAIT_RESPONSE:\n\t\tprocess_com_state_machine_wait_response();\n\t\tbreak;\n\n\tcase COM_STATE_SET_CURRENT:\n\t\tif (try_read_response(OPCODE_TARGET_CURRENT, &data))\n\t\t{\n\t\t\teventlog_write_data(EVT_DATA_TARGET_CURRENT, data);\n\t\t}\n\t\telse\n\t\t{\n\t\t\teventlog_write(EVT_ERROR_CHANGE_TARGET_CURRENT);\n\t\t}\n\n\t\tcom_state = COM_STATE_IDLE;\n\t\tbreak;\n\n\tcase COM_STATE_SET_SPEED:\n\t\tif (try_read_response(OPCODE_TARGET_SPEED, &data))\n\t\t{\n\t\t\teventlog_write_data(EVT_DATA_TARGET_SPEED, (uint8_t)((data * 100) / SPEED_STEPS));\n\t\t}\n\t\telse\n\t\t{\n\t\t\teventlog_write(EVT_ERROR_CHANGE_TARGET_SPEED);\n\t\t}\n\n\t\tcom_state = COM_STATE_IDLE;\n\t\tbreak;\n\n\tcase COM_STATE_READ_STATUS:\n\t\tif (try_read_response(OPCODE_READ_STATUS, &data))\n\t\t{\n\t\t\tif (data != status_flags)\n\t\t\t{\n\t\t\t\tstatus_flags = data;\n\t\t\t\teventlog_write_data(EVT_DATA_MOTOR_STATUS, status_flags);\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\teventlog_write(EVT_ERROR_READ_MOTOR_STATUS);\n\t\t}\n\n\t\tnext_status_read_opcode = OPCODE_READ_CURRENT;\n\t\tcom_state = COM_STATE_IDLE;\n\t\tbreak;\n\n\tcase COM_STATE_READ_CURRENT:\n\t\tif (try_read_response(OPCODE_READ_CURRENT, &data))\n\t\t{\n\t\t\tbattery_amp_x10 = (data * 100) / ADC_STEPS_PER_AMP_X10;\n\t\t}\n\t\telse\n\t\t{\n\t\t\teventlog_write(EVT_ERROR_READ_MOTOR_CURRENT);\n\t\t}\n\n\t\tnext_status_read_opcode = OPCODE_READ_VOLTAGE;\n\t\tcom_state = COM_STATE_IDLE;\n\t\tbreak;\n\n\tcase COM_STATE_READ_VOLTAGE:\n\t\tif (try_read_response(OPCODE_READ_VOLTAGE, &data))\n\t\t{\n\t\t\tbattery_adc_steps = data;\n\t\t\tbattery_volt_x10 = (uint16_t)(((uint32_t)battery_adc_steps * 1000) / adc_steps_per_volt_x100);\n\t\t}\n\t\telse\n\t\t{\n\t\t\teventlog_write(EVT_ERROR_READ_MOTOR_VOLTAGE);\n\t\t}\n\n\t\tnext_status_read_opcode = OPCODE_READ_STATUS;\n\t\tcom_state = COM_STATE_IDLE;\n\t\tbreak;\n\n\t}\n}\n"
  },
  {
    "path": "src/firmware/bbsx/pins.h",
    "content": "/*\n * bbs-fw\n *\n * Copyright (C) Daniel Nilsson, 2022.\n *\n * Released under the GPL License, Version 3\n */\n\n#ifndef  _PINS_H_\n#define _PINS_H_\n\n// PORT, PIN\n\n#if defined(BBSHD)\n\n\t#define PIN_MOTOR_POWER_ENABLE\t\t\t2, 0\n\t#define PIN_MOTOR_CONTROL_ENABLE\t\t2, 1\n\t#define PIN_MOTOR_EXTRA\t\t\t\t\t4, 4\n\t#define PIN_MOTOR_RX\t\t\t\t\t1, 0\n\t#define PIN_MOTOR_TX\t\t\t\t\t1, 1\n\t\n\t#define PIN_VOLTAGE\t\t\t\t\t\t1, 6\n\t#define PIN_TEMPERATURE_CONTR\t\t\t1, 7\n\t#define PIN_TEMPERATURE_MOTOR\t\t\t1, 4\n\t\n\t#define PIN_PAS1\t\t\t\t\t\t4, 5\n\t#define PIN_PAS2\t\t\t\t\t\t4, 6\n\t\n\t//#define PIN_HALL_U\t\t\t\t\t5, 0\n\t//#define PIN_HALL_V\t\t\t\t\t3, 4\n\t//#define PIN_HALL_W\t\t\t\t\t0, 6\n\t\n\t#define PIN_SPEED_SENSOR\t\t\t\t2, 2\n\t#define PIN_BRAKE\t\t\t\t\t\t2, 4\n\t#define PIN_SHIFT_SENSOR\t\t\t\t2, 6\n\t#define PIN_THROTTLE\t\t\t\t\t1, 3\n\t#define PIN_LIGHTS_POWER\t\t\t\t2, 3 // P+\n\t#define PIN_LIGHTS\t\t\t\t\t\t5, 1 // Q\n\t\n\t#define PIN_EXTERNAL_RX\t\t\t\t\t3, 0\n\t#define PIN_EXTERNAL_TX\t\t\t\t\t3, 1\n\n#elif defined(BBS02)\n\n\t#define PIN_MOTOR_POWER_ENABLE\t\t\t2, 0\n\t#define PIN_MOTOR_CONTROL_ENABLE\t\t5, 4\n\t#define PIN_MOTOR_EXTRA\t\t\t\t\t5, 5\n\t#define PIN_MOTOR_RX\t\t\t\t\t1, 0\n\t#define PIN_MOTOR_TX\t\t\t\t\t1, 1\n\n\t#define PIN_VOLTAGE\t\t\t\t\t\t1, 7\n\t#define PIN_TEMPERATURE_CONTR\t\t\t1, 2\n\t\n\t#define PIN_PAS1\t\t\t\t\t\t2, 3\n\t#define PIN_PAS2\t\t\t\t\t\t2, 4\n\t\n\t#define PIN_SPEED_SENSOR\t\t\t\t2, 6\n\t#define PIN_BRAKE\t\t\t\t\t\t3, 3\n\t#define PIN_SHIFT_SENSOR\t\t\t\t3, 6\n\t#define PIN_THROTTLE\t\t\t\t\t1, 5\n\t#define PIN_LIGHTS_POWER\t\t\t\t0, 3 // P+\n\t#define PIN_LIGHTS\t\t\t\t\t\t0, 2 // Q\n\t\n\t#define PIN_EXTERNAL_RX\t\t\t\t\t3, 0\n\t#define PIN_EXTERNAL_TX\t\t\t\t\t3, 1\n\n#endif\n\n#endif\n"
  },
  {
    "path": "src/firmware/bbsx/sensors.c",
    "content": "/*\r\n * bbs-fw\r\n *\r\n * Copyright (C) Daniel Nilsson, 2022.\r\n *\r\n * Released under the GPL License, Version 3\r\n */\r\n\r\n#include \"sensors.h\"\r\n#include \"system.h\"\r\n#include \"adc.h\"\r\n#include \"util.h\"\r\n#include \"cfgstore.h\"\r\n#include \"eventlog.h\"\r\n#include \"fwconfig.h\"\r\n#include \"bbsx/pins.h\"\r\n#include \"bbsx/stc15.h\"\r\n#include \"bbsx/timers.h\"\r\n\r\n#include <stdint.h>\r\n#include <stdbool.h>\r\n#include <math.h>\r\n\r\n// interrupt runs at 100us interval, see timer0 in timers.c\r\n// timer0 is shared between system and sensors modules\r\n\r\n#define PAS_SENSOR_NUM_SIGNALS\t\t\tPAS_PULSES_REVOLUTION\r\n#define PAS_SENSOR_MIN_PULSE_MS_X10\t\t50\t// 500rpm limit\r\n\r\n#define SPEED_SENSOR_MIN_PULSE_MS_X10\t500\r\n#define SPEED_SENSOR_TIMEOUT_MS_X10\t\t25000\r\n\r\n\r\n// Some versions of the BBSHD motor (hall sensor board)\r\n// has a PTC thermistor instead of a NTC thermistor.\r\n// Using standard PT1000 table.\r\n// [R_x100, C_x100]\r\n\r\n#ifdef BBSHD\r\n#define BBSHD_PTC_LUT_SIZE\t21\r\ntypedef struct { int32_t x; int16_t y; } pt_t;\r\nstatic const pt_t bbshd_ptc_lut[BBSHD_PTC_LUT_SIZE] =\r\n{\r\n\t{ 92100, -2000 },\r\n\t{ 96090, -1000 },\r\n\t{ 100000, 0000 },\r\n\t{ 103900, 1000 },\r\n\t{ 107790, 2000 },\r\n\t{ 109730, 2500 },\r\n\t{ 111670, 3000 },\r\n\t{ 113610, 3500 },\r\n\t{ 115540, 4000 },\r\n\t{ 117470, 4500 },\r\n\t{ 119400, 5000 },\r\n\t{ 121320, 5500 },\r\n\t{ 123240, 6000 },\r\n\t{ 125160, 6500 },\r\n\t{ 127080, 7000 },\r\n\t{ 128990, 7500 },\r\n\t{ 130900, 8000 },\r\n\t{ 132800, 8500 },\r\n\t{ 134710, 9000 },\r\n\t{ 136610, 9500 },\r\n\t{ 138510, 10000 }\r\n};\r\nstatic bool bbshd_ptc_thermistor;\r\n#endif\r\n\r\n\r\nstatic volatile uint16_t pas_pulse_counter;\r\nstatic volatile bool pas_direction_backward;\r\nstatic volatile uint16_t pas_period_length;\t// pulse length counted in interrupt frequency (100us)\r\nstatic uint16_t pas_period_counter;\r\nstatic bool pas_prev1;\r\nstatic bool pas_prev2;\r\nstatic uint16_t pas_stop_delay_periods;\r\n\r\nstatic volatile uint16_t speed_ticks_period_length; // pulse length counted in interrupt frequency (100us)\r\nstatic uint16_t speed_period_counter;\r\nstatic bool speed_prev_state;\r\nstatic uint8_t speed_ticks_per_rpm;\r\n\r\n\r\nstatic float thermistor_ntc_calculate_temperature(float R, float invBeta)\r\n{\r\n\tconst float invT0 = 1.f / 298.15f;\r\n\r\n\tfloat K = 1.f / (invT0 + invBeta * (logf(R / 10000.f)));\r\n\tfloat C = K - 273.15f;\r\n\r\n\treturn C;\r\n}\r\n\r\n#ifdef BBSHD\r\nstatic int16_t thermistor_ptc_bbshd_calculate_temperature(int32_t R_x100)\r\n{\r\n\t// interpolate in lookup table\r\n\r\n\tif (R_x100 < bbshd_ptc_lut[0].x)\r\n\t{\r\n\t\t// use minimum value\r\n\t\treturn bbshd_ptc_lut[0].y;\r\n\t}\r\n\telse if (R_x100 > bbshd_ptc_lut[BBSHD_PTC_LUT_SIZE - 1].x)\r\n\t{\r\n\t\t// use maximum value\r\n\t\treturn bbshd_ptc_lut[BBSHD_PTC_LUT_SIZE - 1].y;\r\n\t}\r\n\r\n\tuint8_t i = 0;\r\n\tfor (i = 0; i < BBSHD_PTC_LUT_SIZE - 1; i++)\r\n\t{\r\n\t\tif (bbshd_ptc_lut[i + 1].x > R_x100)\r\n\t\t{\r\n\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\r\n\treturn (uint16_t)MAP32(R_x100,\r\n\t\tbbshd_ptc_lut[i].x,\r\n\t\tbbshd_ptc_lut[i + 1].x,\r\n\t\tbbshd_ptc_lut[i].y,\r\n\t\tbbshd_ptc_lut[i + 1].y);\r\n}\r\n#endif\r\n\r\n\r\nvoid sensors_init()\r\n{\r\n\t// will be evaulated when first reading take place\r\n#ifdef BBSHD\r\n\tbbshd_ptc_thermistor = false;\r\n#endif\r\n\r\n\tpas_period_counter = 0;\r\n\tpas_pulse_counter = 0;\r\n\tpas_direction_backward = false;\r\n\tpas_period_length = 0;\r\n\tpas_stop_delay_periods = 1500;\r\n\tspeed_period_counter = 0;\r\n\tspeed_ticks_period_length = 0;\r\n\tspeed_prev_state = false;\r\n\tspeed_ticks_per_rpm = 1;\r\n\r\n\t// pins do not have external interrupt, use timer0 to evaluate state frequently\r\n\tSET_PIN_INPUT(PIN_PAS1);\r\n\tSET_PIN_INPUT(PIN_PAS2);\r\n\tSET_PIN_INPUT(PIN_SPEED_SENSOR);\r\n\r\n\tSET_PIN_QUASI(PIN_BRAKE); // input pullup\r\n\tSET_PIN_QUASI(PIN_SHIFT_SENSOR); // input pullup\r\n\r\n\tpas_prev1 = GET_PIN_STATE(PIN_PAS1);\r\n\tpas_prev2 = GET_PIN_STATE(PIN_PAS2);\r\n\r\n\ttimer0_init_sensors();\r\n}\r\n\r\nvoid sensors_process()\r\n{\r\n\r\n}\r\n\r\nvoid pas_set_stop_delay(uint16_t delay_ms)\r\n{\r\n\tpas_stop_delay_periods = delay_ms * 10;\r\n}\r\n\r\nuint16_t pas_get_cadence_rpm_x10()\r\n{\r\n\tuint16_t tmp;\r\n\tET0 = 0; // disable timer0 interrupts\r\n\ttmp = pas_period_length;\r\n\tET0 = 1;\r\n\r\n\tif (tmp > 0)\r\n\t{\r\n\t\treturn (uint16_t)((6000000ul / PAS_SENSOR_NUM_SIGNALS) / tmp);\r\n\t}\r\n\telse\r\n\t{\r\n\t\treturn 0;\r\n\t}\r\n}\r\n\r\nuint16_t pas_get_pulse_counter()\r\n{\r\n\tuint16_t tmp;\r\n\tET0 = 0; // disable timer0 interrupts\r\n\ttmp = pas_pulse_counter;\r\n\tET0 = 1;\r\n\r\n\treturn tmp;\r\n}\r\n\r\nbool pas_is_pedaling_forwards()\r\n{\r\n\tuint16_t period_length;\r\n\tuint8_t direction_backward;\r\n\tET0 = 0; // disable timer0 interrupts\r\n\tperiod_length = pas_period_length;\r\n\tdirection_backward = pas_direction_backward;\r\n\tET0 = 1;\r\n\r\n\t// atomic read operation, no need to disable timer interrupt\r\n\treturn period_length > 0 && !direction_backward;\r\n}\r\n\r\nbool pas_is_pedaling_backwards()\r\n{\r\n\tuint16_t period_length;\r\n\tuint8_t direction_backward;\r\n\tET0 = 0; // disable timer0 interrupts\r\n\tperiod_length = pas_period_length;\r\n\tdirection_backward = pas_direction_backward;\r\n\tET0 = 1;\r\n\r\n\treturn period_length > 0 && direction_backward;\r\n}\r\n\r\nvoid speed_sensor_set_signals_per_rpm(uint8_t num_signals)\r\n{\r\n\tspeed_ticks_per_rpm = num_signals;\r\n}\r\n\r\nbool speed_sensor_is_moving()\r\n{\r\n\tuint16_t tmp;\r\n\tET0 = 0; // disable timer0 interrupts\r\n\ttmp = speed_ticks_period_length;\r\n\tET0 = 1;\r\n\r\n\treturn tmp > 0;\r\n}\r\n\r\nuint16_t speed_sensor_get_rpm_x10()\r\n{\r\n\tuint16_t tmp;\r\n\tET0 = 0; // disable timer0 interrupts\r\n\ttmp = speed_ticks_period_length;\r\n\tET0 = 1;\r\n\r\n\tif (tmp > 0)\r\n\t{\r\n\t\treturn 6000000ul / tmp / speed_ticks_per_rpm;\r\n\t}\r\n\r\n\treturn 0;\r\n}\r\n\r\nuint16_t torque_sensor_get_nm_x100()\r\n{\r\n\treturn 0;\r\n}\r\n\r\nbool torque_sensor_ok()\r\n{\r\n\treturn true;\r\n}\r\n\r\n\r\nint16_t temperature_contr_x100()\r\n{\r\n\tconst float R1 = 5100.f;\r\n\tconst float invBeta = 1.f / 3600.f;\r\n\tstatic int32_t adc_contr_x100 = 0;\r\n\r\n\tif (g_config.use_temperature_sensor & TEMPERATURE_SENSOR_CONTR)\r\n\t{\r\n\t\tif (adc_contr_x100 == 0)\r\n\t\t{\r\n\t\t\tadc_contr_x100 = adc_get_temperature_contr() * 100l;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tadc_contr_x100 = EXPONENTIAL_FILTER(adc_contr_x100, adc_get_temperature_contr() * 100l, 4);\r\n\t\t}\r\n\r\n\t\tif (adc_contr_x100 != 0)\r\n\t\t{\r\n\t\t\tfloat R = R1 * ((102300.f / (102300.f - adc_contr_x100)) - 1.f);\r\n\t\t\treturn (int16_t)(thermistor_ntc_calculate_temperature(R, invBeta) * 100.f + 0.5f);\r\n\t\t}\r\n\t}\r\n\r\n\treturn 0;\r\n}\r\n\r\nint16_t temperature_motor_x100()\r\n{\r\n\t// Sensor only present in the BBSHD motor\r\n#if HAS_MOTOR_TEMP_SENSOR\r\n\tconst float R1 = 5100.f;\r\n\tconst float invBeta = 1.f / 3990.f;\r\n\r\n\tstatic int32_t adc_motor_x100 = 0;\r\n\r\n\tif (g_config.use_temperature_sensor & TEMPERATURE_SENSOR_MOTOR)\r\n\t{\r\n\t\tbool first = false;\r\n\t\tif (adc_motor_x100 == 0)\r\n\t\t{\r\n\t\t\tfirst = true;\r\n\t\t\tadc_motor_x100 = adc_get_temperature_motor() * 100l;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tadc_motor_x100 = EXPONENTIAL_FILTER(adc_motor_x100, adc_get_temperature_motor() * 100l, 4);\r\n\t\t}\r\n\r\n\t\tif (adc_motor_x100 != 0)\r\n\t\t{\r\n\t\t\tfloat R = R1 * ((102300.f / (102300.f - adc_motor_x100)) - 1.f);\r\n\r\n\t\t\tif (first)\r\n\t\t\t{\r\n\t\t\t\tif (R > 1500.f)\r\n\t\t\t\t{\r\n\t\t\t\t\t// not likely to be a 1k ptc thermistor, assume 10k ntc\r\n\t\t\t\t\tbbshd_ptc_thermistor = false;\r\n\t\t\t\t\teventlog_write_data(EVT_DATA_BBSHD_THERMISTOR, 0);\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tbbshd_ptc_thermistor = true;\r\n\t\t\t\t\teventlog_write_data(EVT_DATA_BBSHD_THERMISTOR, 1);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\r\n\t\t\tif (bbshd_ptc_thermistor)\r\n\t\t\t{\r\n\t\t\t\treturn thermistor_ptc_bbshd_calculate_temperature((int32_t)(R * 100.f + 0.5f));\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\treturn(int16_t)(thermistor_ntc_calculate_temperature(R, invBeta) * 100.f + 0.5f);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n#endif\r\n\r\n\treturn 0;\r\n}\r\n\r\n\r\nbool brake_is_activated()\r\n{\r\n\treturn !GET_PIN_STATE(PIN_BRAKE);\r\n}\r\n\r\nbool shift_sensor_is_activated()\r\n{\r\n\treturn !GET_PIN_STATE(PIN_SHIFT_SENSOR);\r\n}\r\n\r\n\r\n#pragma save  \r\n#pragma nooverlay // See SDCC manual about function calls in ISR\r\nvoid sensors_timer0_isr() // runs every 100us, see timers.c\r\n{\r\n\t// WARNING:\r\n\t// No 16/32 bit or float computations in ISR (multiply/divide/modulo).\r\n\t// Read SDCC compiler manual for more info.\r\n\r\n\t// Pas\r\n\t{\r\n\t\tbool pas1 = GET_PIN_STATE(PIN_PAS1);\r\n\t\tbool pas2 = GET_PIN_STATE(PIN_PAS2);\r\n\r\n\t\tif (pas1 && !pas_prev1 /* && pas_period_counter > PAS_SENSOR_MIN_PULSE_MS_X10 */)\r\n\t\t{\r\n\t\t\tpas_pulse_counter++;\r\n\r\n\t\t\tif (pas_direction_backward != pas2)\r\n\t\t\t{\r\n\t\t\t\tpas_direction_backward = pas2;\r\n\r\n\t\t\t\t// Reset pas pulse counter if pedal direction is changed,\r\n\t\t\t\t// this variable counts the number of pulses since start of pedaling session.\r\n\t\t\t\tpas_pulse_counter = 0;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif (pas_period_counter > 0)\r\n\t\t\t{\r\n\t\t\t\tif (pas_period_counter <= pas_stop_delay_periods)\r\n\t\t\t\t{\r\n\t\t\t\t\tpas_period_length = pas_period_counter; // save in order to be able to calculate rpm when needed\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tpas_period_length = 0;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tpas_period_counter = 0;\r\n\t\t\t}\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t// Do not allow wraparound or computed pedaling cadence will wrong after pedals has been still.\r\n\t\t\tif (pas_period_counter < 65535)\r\n\t\t\t{\r\n\t\t\t\tpas_period_counter++;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif (pas_period_length > 0 && pas_period_counter > pas_stop_delay_periods)\r\n\t\t\t{\r\n\t\t\t\tpas_period_length = 0;\r\n\t\t\t\tpas_pulse_counter = 0;\r\n\t\t\t\tpas_direction_backward = false;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tpas_prev1 = pas1;\r\n\t\tpas_prev2 = pas2;\r\n\t}\r\n\r\n\r\n\t// Speed sensor\r\n\t{\r\n\t\tbool spd = GET_PIN_STATE(PIN_SPEED_SENSOR);\r\n\r\n\t\tif (spd && !speed_prev_state && speed_period_counter > SPEED_SENSOR_MIN_PULSE_MS_X10)\r\n\t\t{\r\n\t\t\tif (speed_period_counter <= SPEED_SENSOR_TIMEOUT_MS_X10)\r\n\t\t\t{\r\n\t\t\t\tspeed_ticks_period_length = speed_period_counter;\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tspeed_ticks_period_length = 0;\r\n\t\t\t}\r\n\t\t\t\t\r\n\t\t\tspeed_period_counter = 0;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t// Do not allow wraparound or computed speed will wrong after bike has been still.\r\n\t\t\tif (speed_period_counter < 65535)\r\n\t\t\t{\r\n\t\t\t\tspeed_period_counter++;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif (speed_ticks_period_length > 0 && speed_period_counter > SPEED_SENSOR_TIMEOUT_MS_X10)\r\n\t\t\t{\r\n\t\t\t\tspeed_ticks_period_length = 0;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tspeed_prev_state = spd;\r\n\t}\r\n\t\r\n}\r\n#pragma restore\r\n"
  },
  {
    "path": "src/firmware/bbsx/stc15.h",
    "content": "/*\n * bbs-fw\n *\n * Copyright (C) Daniel Nilsson, 2022.\n *\n * Released under the GPL License, Version 3\n */\n\n#ifndef _STC_15_H_\n#define _STC_15_H_\n\n#include \"intellisense.h\"\n\n#if !defined (SDCC) && !defined (__SDCC)\n\n#define __sfr\t\tunsigned char\n#define __sbit\t\tbool\n#define __at(X)\t\t\n\n#define __xdata\n#define __data\t\t\n\n#endif\n\n#include <8051.h>\n#include <stc12.h>\n\n\n// Peripheral function switch\nSFR(P_SW2, 0xBA);\n\nSFR(PCON2, 0x97);\n\nSFR(T2H, 0xD6);\nSFR(T2L, 0xD7);\n\nSBIT(P5_4, 0xC8, 4);\nSBIT(P5_5, 0xC8, 5);\n\n\n#define IS_BIT_SET(REG, BIT_NUM) ((REG >> BIT_NUM) & 1)\n\n#define SET_BIT(REG, BIT_NUM) (REG |= (1 << BIT_NUM))\n#define CLEAR_BIT(REG, BIT_NUM) (REG &= ~(1 << BIT_NUM))\n#define TOGGLE_BIT(REG, BIT_NUM) (REG ^= (1 << BIT_NUM))\n\n#define EXPAND(x) x\n\n#define SET_PIN_INPUT_(PORT, PIN) CLEAR_BIT(P##PORT##M0, PIN); SET_BIT(P##PORT##M1, PIN)\n#define SET_PIN_INPUT(...) EXPAND(SET_PIN_INPUT_(__VA_ARGS__))\n\n#define SET_PIN_QUASI_(PORT, PIN) CLEAR_BIT(P##PORT##M0, PIN); CLEAR_BIT(P##PORT##M1, PIN)\n#define SET_PIN_QUASI(...) EXPAND(SET_PIN_QUASI_(__VA_ARGS__))\n\n#define SET_PIN_OUTPUT_(PORT, PIN) SET_BIT(P##PORT##M0, PIN); CLEAR_BIT(P##PORT##M1, PIN)\n#define SET_PIN_OUTPUT(...) EXPAND(SET_PIN_OUTPUT_(__VA_ARGS__))\n\n\n#define GET_PIN_STATE_(PORT, PIN) P##PORT##_##PIN\n#define GET_PIN_STATE(...) EXPAND(GET_PIN_STATE_(__VA_ARGS__))\n\n#define SET_PIN_HIGH_(PORT, PIN) P##PORT##_##PIN = 1\n#define SET_PIN_HIGH(...) EXPAND(SET_PIN_HIGH_(__VA_ARGS__))\n\n#define SET_PIN_LOW_(PORT, PIN) P##PORT##_##PIN = 0\n#define SET_PIN_LOW(...) EXPAND(SET_PIN_LOW_(__VA_ARGS__))\n\n\n#define GET_PIN_NUM_(PORT, PIN) PIN\n#define GET_PIN_NUM(...) EXPAND(GET_PIN_NUM_(__VA_ARGS__))\n\n#define GET_PORT_NUM_(PORT, PIN) PORT\n#define GET_PORT_NUM(...) EXPAND(GET_PORT_NUM_(__VA_ARGS__))\n\n#endif\n"
  },
  {
    "path": "src/firmware/bbsx/system.c",
    "content": "/*\n * bbs-fw\n *\n * Copyright (C) Daniel Nilsson, 2022.\n *\n * Released under the GPL License, Version 3\n */\n\n#include \"system.h\"\n#include \"watchdog.h\"\n#include \"timers.h\"\n#include \"bbsx/stc15.h\"\n\nstatic volatile uint32_t\t_ms;\nstatic volatile uint8_t\t\t_x100us;\n\nvoid system_init()\n{\n\t_ms = 0;\n\t_x100us = 0;\n\n\t// Wait for stable voltage (above lvd)\n\twhile (IS_BIT_SET(PCON, 5))\n\t{\n\t\tCLEAR_BIT(PCON, 5);\n\t}\n\n\ttimer0_init_system();\n}\n\nuint32_t system_ms()\n{\n\tuint32_t val;\n\tuint8_t et0 = ET0;\n\tET0 = 0; // disable timer0 interrupts\n\tval = _ms;\n\tET0 = et0;\n\treturn val;\n}\n\nvoid system_delay_ms(uint16_t ms)\n{\n\tif (!ms)\n\t{\n\t\treturn;\n\t}\n\n\tuint32_t end = system_ms() + ms;\n\twhile (system_ms() != end)\n\t{\n\t\twatchdog_yeild();\n\t}\n}\n\n#pragma save  \n#pragma nooverlay // See SDCC manual about function calls in ISR\nvoid system_timer0_isr()\n{\n\t_x100us++;\n\tif (_x100us == 10)\n\t{\n\t\t_x100us = 0;\n\t\t_ms++;\n\t}\n}\n#pragma restore\n"
  },
  {
    "path": "src/firmware/bbsx/timers.c",
    "content": "#include \"timers.h\"\n#include \"bbsx/timers.h\"\n#include \"bbsx/interrupt.h\"\n#include \"bbsx/cpu.h\"\n\n#include <stdbool.h>\n\n#define TIMER0_RELOAD\t((65535 - CPU_FREQ / 10000) + 1)\n\n\nextern void system_timer0_isr();\nextern void sensors_timer0_isr();\n\nstatic bool timer0_system_ready;\nstatic bool timer0_sensors_ready;\n\nstatic void timer0_init()\n{\n\tif (timer0_system_ready || timer0_sensors_ready)\n\t{\n\t\t// already initialized\n\t\treturn;\n\t}\n\n\tEA = 0; // disable interrupts\n\n\tTMOD = (TMOD & 0xf0) | 0x00; // Timer 0: 16-bit with autoreload\n\tAUXR |= 0x80; // Run timer 0 at CPU_FREQ\n\n\tTH0 = TIMER0_RELOAD >> 8;\n\tTL0 = TIMER0_RELOAD;\n\n\tEA = 1; // enable interrupts\n\tET0 = 1; // enable timer0 interrupts\n\tTR0 = 1; // start timer 0\n}\n\n\nvoid timers_init()\n{\n\ttimer0_system_ready = false;\n\ttimer0_sensors_ready = false;\n}\n\nvoid timer0_init_system()\n{\n\ttimer0_init();\n\ttimer0_system_ready = true;\n}\n\nvoid timer0_init_sensors()\n{\n\ttimer0_init();\n\ttimer0_sensors_ready = true;\n}\n\nvoid timer1_init_uart1(uint32_t baudrate)\n{\n\tunsigned short reload = 65535 - CPU_FREQ / 4 / baudrate + 1;\n\n\t// Set up timer 1 for baudrate\n\tTMOD = (TMOD & 0x0f) | 0x00; // Run T1 in mode 0 (16-bit reload)\n\tAUXR |= 0x40; // Run T1 at CPU_FREQ\n\tTL1 = reload; // Set the reload value for given baudrate.\n\tTH1 = reload >> 8;\n\tET1 = 0; // No interrupts from timer 1.\n\tTR1 = 1; // Start timer 1\n}\n\nvoid timer2_init_uart2(uint32_t baudrate)\n{\n\tunsigned short reload = 65535 - CPU_FREQ / 4 / baudrate + 1;\n\n\t// Set up timer 2 for baudrate\n\tAUXR &= ~(1 << 3); // as timer\n\tAUXR |= (1 << 2); // Run T2 at CPU_FREQ\n\tT2H = reload >> 8;\n\tT2L = reload;\n\tIE2 &= ~(1 << 2); // No interrupts from timer 2\n\tAUXR |= (1 << 4); // Start timer 2\n}\n\n\n// timer0 is shared between system ms counter and sensors check\nINTERRUPT_USING(isr_timer0, IRQ_TIMER0, 1)\n{\n\tif (timer0_system_ready)\n\t{\n\t\tsystem_timer0_isr();\n\t}\n\t\n\tif (timer0_sensors_ready)\n\t{\n\t\tsensors_timer0_isr();\n\t}\n}\n"
  },
  {
    "path": "src/firmware/bbsx/timers.h",
    "content": "/*\n * bbs-fw\n *\n * Copyright (C) Daniel Nilsson, 2022.\n *\n * Released under the GPL License, Version 3\n */\n\n#ifndef _BBSX_TIMER_H_\n#define _BBSX_TIMER_H_\n\n#include \"bbsx/stc15.h\"\n#include <stdint.h>\n\nvoid timer0_init_system();\nvoid timer0_init_sensors();\n\nvoid timer1_init_uart1(uint32_t baudrate);\nvoid timer2_init_uart2(uint32_t baudrate);\n\n#endif\n"
  },
  {
    "path": "src/firmware/bbsx/uart.c",
    "content": "/*\n * bbs-fw\n *\n * Copyright (C) Daniel Nilsson, 2022.\n *\n * Released under the GPL License, Version 3\n */\n\n#include \"uart.h\"\n#include \"system.h\"\n#include \"watchdog.h\"\n#include \"bbsx/stc15.h\"\n#include \"bbsx/uart_motor.h\"\n#include \"bbsx/timers.h\"\n#include \"bbsx/pins.h\"\n\n#include <stdint.h>\n\n// NOTE:\n// Variables located in __data are there for atomic access.\n\n// UART1 (main)\n#define RX1_BUFFER_SIZE\t\t\t64\n#define RX1_BUFFER_MASK\t\t\t(RX1_BUFFER_SIZE - 1)\n\n#define TX1_BUFFER_SIZE\t\t\t32\n#define TX1_BUFFER_MASK\t\t\t(TX1_BUFFER_SIZE - 1)\n\nstatic volatile __data uint8_t rx1_head;\nstatic volatile __data uint8_t rx1_tail;\nstatic volatile uint8_t rx1_buf[RX1_BUFFER_SIZE];\nstatic volatile __data uint8_t tx1_head;\nstatic volatile __data uint8_t tx1_tail;\nstatic volatile __data uint8_t tx1_sending;\nstatic volatile uint8_t tx1_buf[TX1_BUFFER_SIZE];\n\n// UART2 (motor)\n#define RX2_BUFFER_SIZE\t\t\t16\n#define RX2_BUFFER_MASK\t\t\t(RX2_BUFFER_SIZE - 1)\n\n#define TX2_BUFFER_SIZE\t\t\t16\n#define TX2_BUFFER_MASK\t\t\t(TX2_BUFFER_SIZE - 1)\n\nstatic volatile __data uint8_t rx2_head;\nstatic volatile __data uint8_t rx2_tail;\nstatic volatile uint8_t rx2_buf[RX2_BUFFER_SIZE];\nstatic volatile __data uint8_t tx2_head;\nstatic volatile __data uint8_t tx2_tail;\nstatic volatile __data uint8_t tx2_sending;\nstatic volatile uint8_t tx2_buf[TX2_BUFFER_SIZE];\n\n\nvoid uart_open(uint32_t baudrate)\n{\n\trx1_head = 0;\n\trx1_tail = 0;\n\ttx1_head = 0;\n\ttx1_tail = 0;\n\ttx1_sending = 0;\n\n#if (GET_PORT_NUM(PIN_EXTERNAL_RX) == 3 && GET_PORT_NUM(PIN_EXTERNAL_TX) == 3)\n\tAUXR1 = (AUXR1 & 0x3f) | 0x00; // Keep UART1 on P3.0/P3.1\n#else\n\t#error Unupported UART port configured.\n#endif\n\n\tSET_PIN_QUASI(PIN_EXTERNAL_RX);\n\tSET_PIN_QUASI(PIN_EXTERNAL_TX);\n\n\tAUXR &= ~0x01; // Clock UART1 from T1\n\tPCON &= ~0x40; // Expose SM0 bit\n\tSM1 = 1; // UART 8-N-1\n\tSM0 = 0;\n\tSM2 = 0; // Point-to-point UART\n\tES = 1; // Enable serial interrupt\n\n\ttimer1_init_uart1(baudrate);\n\n\tREN = 1; // Rx enable\n}\n\nvoid uart_motor_open(uint32_t baudrate)\n{\n\trx2_head = 0;\n\trx2_tail = 0;\n\ttx2_head = 0;\n\ttx2_tail = 0;\n\ttx2_sending = 0;\n\n#if (GET_PORT_NUM(PIN_MOTOR_RX) == 1 && GET_PORT_NUM(PIN_MOTOR_TX) == 1)\n\t{\n\t\tP_SW2 = (P_SW2 & 0xfe) | 0x00; // Keep UART2 on P1.0/P1.1\n\t}\n#else\n\t#error Unupported UART port configured.\n#endif\n\n\tSET_PIN_QUASI(PIN_MOTOR_RX);\n\tSET_PIN_QUASI(PIN_MOTOR_TX);\n\n\t// UART 2 can only user timer 2\n\tS2CON &= ~(1 << 7); // UART 8-N-1\n\tS2CON &= ~(1 << 5); // Point-to-point UART\n\tIE2 |= (1 << 0); // Enable serial 2 interrupt\n\n\ttimer2_init_uart2(baudrate);\n\n\tS2CON |= (1 << 4); // Rx enable\n}\n\nvoid uart_close()\n{\n\tREN = 0;\n\tuart_flush();\n\tTR1 = 0;\n}\n\nvoid uart_motor_close()\n{\n\tS2CON &= ~(1 << 4); // Rx disable\n\tuart_motor_flush();\n\tAUXR &= ~(1 << 4); // Stop timer 2\n}\n\n\nuint8_t uart_available()\n{\n\treturn (RX1_BUFFER_SIZE + rx1_head - rx1_tail) & RX1_BUFFER_MASK;\n}\n\nuint8_t uart_motor_available()\n{\n\treturn (RX2_BUFFER_SIZE + rx2_head - rx2_tail) & RX2_BUFFER_MASK;\n}\n\nuint8_t uart_read()\n{\n\tuint8_t byte = rx1_buf[rx1_tail];\n\trx1_tail = (rx1_tail + 1) & RX1_BUFFER_MASK;\n\treturn byte;\n}\n\nuint8_t uart_motor_read()\n{\n\tuint8_t byte = rx2_buf[rx2_tail];\n\trx2_tail = (rx2_tail + 1) & RX2_BUFFER_MASK;\n\treturn byte;\n}\n\nvoid uart_write(uint8_t byte)\n{\n\tif (!tx1_sending)\n\t{\n\t\ttx1_sending = 1;\n\t\tSBUF = byte;\n\n\t\treturn;\n\t}\n\n\tuint8_t i = (tx1_head + 1) & TX1_BUFFER_MASK;\n\n\t// wait for free space in buffer\n\tuint8_t prev_tail = tx1_tail;\n\twhile (i == tx1_tail)\n\t{\n\t\tif (tx1_tail != prev_tail)\n\t\t{\n\t\t\tprev_tail = tx1_tail;\n\t\t\twatchdog_yeild();\n\t\t}\n\t}\n\n\ttx1_buf[tx1_head] = byte;\n\ttx1_head = i;\n\n}\n\nvoid uart_motor_write(uint8_t byte)\n{\n\tif (!tx2_sending)\n\t{\n\t\ttx2_sending = 1;\n\t\tS2BUF = byte;\n\n\t\treturn;\n\t}\n\n\tuint8_t i = (tx2_head + 1) & TX2_BUFFER_MASK;\n\n\t// wait for free space in buffer\n\tuint8_t prev_tail = tx2_tail;\n\twhile (i == tx2_tail)\n\t{\n\t\tif (tx2_tail != prev_tail)\n\t\t{\n\t\t\tprev_tail = tx2_tail;\n\t\t\twatchdog_yeild();\n\t\t}\n\t}\n\n\ttx2_buf[tx2_head] = byte;\n\ttx2_head = i;\n}\n\nvoid uart_flush()\n{\n\twhile (tx1_sending);\n}\n\nvoid uart_motor_flush()\n{\n\twhile (tx2_sending);\n}\n\n\nINTERRUPT_USING(isr_uart1, IRQ_UART1, 3)\n{\n\tif (RI) // rx interrupt\n\t{\n\t\tRI = 0;\n\n\t\tuint8_t c = SBUF;\n\t\tuint8_t i = (rx1_head + 1) & RX1_BUFFER_MASK;\n\n\t\tif (i != rx1_tail)\n\t\t{\n\t\t\trx1_buf[rx1_head] = c;\n\t\t\trx1_head = i;\n\t\t}\n\t}\n\n\tif (TI) // tx interrupt\n\t{\n\t\tTI = 0;\n\n\t\tif (tx1_head != tx1_tail)\n\t\t{\n\t\t\ttx1_sending = 1;\n\n\t\t\tSBUF = tx1_buf[tx1_tail];\n\t\t\ttx1_tail = (tx1_tail + 1) & TX1_BUFFER_MASK;\n\t\t}\n\t\telse\n\t\t{\n\t\t\ttx1_sending = 0;\n\t\t}\n\t}\n}\n\nINTERRUPT_USING(isr_uart2, IRQ_UART2, 3)\n{\n\tif (S2CON & (1 << 0)) // rx interrupt\n\t{\n\t\tS2CON &= ~(1 << 0);\n\n\t\tuint8_t c = S2BUF;\n\t\tuint8_t i = (rx2_head + 1) & RX2_BUFFER_MASK;\n\n\t\tif (i != rx2_tail)\n\t\t{\n\t\t\trx2_buf[rx2_head] = c;\n\t\t\trx2_head = i;\n\t\t}\n\t}\n\n\tif (S2CON & (1 << 1)) // tx interrupt\n\t{\n\t\tS2CON &= ~(1 << 1);\n\n\t\tif (tx2_head != tx2_tail)\n\t\t{\n\t\t\ttx2_sending = 1;\n\n\t\t\tS2BUF = tx2_buf[tx2_tail];\n\t\t\ttx2_tail = (tx2_tail + 1) & TX2_BUFFER_MASK;\n\t\t}\n\t\telse\n\t\t{\n\t\t\ttx2_sending = 0;\n\t\t}\n\t}\n}\n\n"
  },
  {
    "path": "src/firmware/bbsx/uart_motor.h",
    "content": "/*\n * bbs-fw\n *\n * Copyright (C) Daniel Nilsson, 2022.\n *\n * Released under the GPL License, Version 3\n */\n\n#ifndef _BBSX_UART_MOTOR_H_\n#define _BBSX_UART_MOTOR_H_\n\n#include \"bbsx/stc15.h\"\n#include \"bbsx/interrupt.h\"\n\n#include <stdint.h>\n\nvoid uart_motor_open(uint32_t baudrate);\nvoid uart_motor_close();\n\nuint8_t uart_motor_available();\nuint8_t uart_motor_read();\n\nvoid uart_motor_write(uint8_t byte);\nvoid uart_motor_flush();\n\n#endif\n"
  },
  {
    "path": "src/firmware/bbsx/watchdog.c",
    "content": "/*\n * bbs-fw\n *\n * Copyright (C) Daniel Nilsson, 2022.\n *\n * Released under the GPL License, Version 3\n */\n\n#include \"watchdog.h\"\n#include \"bbsx/stc15.h\"\n\nstatic bool triggered;\n\nvoid watchdog_init()\n{\n\ttriggered = IS_BIT_SET(WDT_CONTR, 7);\n\tWDT_CONTR = 0x34; // Enable watchdog timer, pre-scaler 32 (625ms, 20MHz)\n}\n\nvoid watchdog_yeild()\n{\n\tSET_BIT(WDT_CONTR, 4);\n}\n\nbool watchdog_triggered()\n{\n\treturn triggered;\n}\n"
  },
  {
    "path": "src/firmware/cfgstore.c",
    "content": "/*\n * bbs-fw\n *\n * Copyright (C) Daniel Nilsson, 2022.\n *\n * Released under the GPL License, Version 3\n */\n\n#include \"cfgstore.h\"\n#include \"eeprom.h\"\n#include \"eventlog.h\"\n#include \"uart.h\"\n#include \"fwconfig.h\"\n\n#include <string.h>\n\n#define EEPROM_CONFIG_PAGE\t\t0\n#define EEPROM_PSTATE_PAGE\t\t1\n\n#define EEPROM_OK\t\t\t\t\t0\n#define EEPROM_ERROR_SELECT_PAGE\t1\n#define EEPROM_ERROR_READ\t\t\t2\n#define EEPROM_ERROR_VERSION\t\t3\n#define EEPROM_ERROR_LENGHT\t\t\t4\n#define EEPROM_ERROR_CHECKSUM\t\t5\n#define EEPROM_ERROR_ERASE\t\t\t6\n#define EEPROM_ERROR_WRITE\t\t\t7\n\nstatic const uint8_t default_current_limits[] = { 7, 10, 14, 19, 26, 36, 50, 70, 98 };\n\n#if HAS_TORQUE_SENSOR\nstatic const uint8_t default_torque_factors[] = { 10, 15, 23, 44, 57, 74, 88, 105, 126 };\n#endif\n\ntypedef struct\n{\n\tuint8_t version;\n\tuint8_t length;\n\tuint8_t checksum;\n} header_t;\n\nstatic header_t header;\n\nconfig_t g_config;\npstate_t g_pstate;\n\nstatic uint8_t read(uint8_t page, uint8_t version, uint8_t* dst, uint8_t size);\nstatic uint8_t write(uint8_t page, uint8_t version, uint8_t* src, uint8_t size);\n\nstatic bool read_config();\nstatic bool write_config();\nstatic void load_default_config();\n\nstatic bool read_pstate();\nstatic bool write_pstate();\nstatic void load_default_pstate();\n\nvoid cfgstore_init()\n{\n\tif (!read_config())\n\t{\n\t\tcfgstore_reset_config();\n\t}\n\n\tif (!read_pstate())\n\t{\n\t\tcfgstore_reset_pstate();\n\t}\n}\n\nbool cfgstore_reset_config()\n{\n\tload_default_config();\n\tif (write_config())\n\t{\n\t\teventlog_write(EVT_MSG_CONFIG_RESET);\n\t\treturn true;\n\t}\n\n\treturn false;\n}\n\nbool cfgstore_save_config()\n{\n\treturn write_config();\n}\n\nbool cfgstore_reset_pstate()\n{\n\tload_default_pstate();\n\treturn write_pstate();\n}\n\nbool cfgstore_save_pstate()\n{\n\treturn write_pstate();\n}\n\nstatic bool read_config()\n{\n\teventlog_write(EVT_MSG_CONFIG_READ_BEGIN);\n\n\tuint8_t res = read(EEPROM_CONFIG_PAGE, CONFIG_VERSION, (uint8_t*)&g_config, sizeof(config_t));\n\tswitch (res)\n\t{\n\tdefault:\n\t\teventlog_write(EVT_ERROR_EEPROM_READ);\n\t\tbreak;\n\tcase EEPROM_ERROR_VERSION:\n\t\teventlog_write(EVT_ERROR_EEPROM_VERIFY_VERSION);\n\t\tbreak;\n\tcase EEPROM_ERROR_LENGHT:\n\tcase EEPROM_ERROR_CHECKSUM:\n\t\teventlog_write(EVT_ERROR_EEPROM_VERIFY_CHECKSUM);\n\t\tbreak;\n\tcase EEPROM_OK:\n\t\teventlog_write(EVT_MSG_CONFIG_READ_DONE);\n\t\tbreak;\n\t}\n\n\treturn res == EEPROM_OK;\n}\n\nstatic bool write_config()\n{\n\teventlog_write(EVT_MSG_CONFIG_WRITE_BEGIN);\n\n\tuint8_t res = write(EEPROM_CONFIG_PAGE, CONFIG_VERSION, (uint8_t*)&g_config, sizeof(config_t));\n\tswitch (res)\n\t{\n\tdefault:\n\t\teventlog_write(EVT_ERROR_EEPROM_WRITE);\n\t\tbreak;\n\tcase EEPROM_ERROR_ERASE:\n\t\teventlog_write(EVT_ERROR_EEPROM_ERASE);\n\t\tbreak;\n\tcase EEPROM_OK:\n\t\teventlog_write(EVT_MSG_CONFIG_WRITE_DONE);\n\t\tbreak;\n\t}\n\n\treturn res == EEPROM_OK;\n}\n\nstatic void load_default_config()\n{\n\tg_config.use_freedom_units = 0;\n\n#if defined(BBSHD)\n\tg_config.max_current_amps = 30;\n#elif defined(BBS02)\n\tg_config.max_current_amps = 25;\n#else\n\tg_config.max_current_amps = 20;\n#endif\n\n\tg_config.current_ramp_amps_s = 10;\n\tg_config.max_battery_x100v_u16l = (uint8_t)5460;\n\tg_config.max_battery_x100v_u16h = (uint8_t)(5460 >> 8);\n\tg_config.low_cut_off_v = 42;\n\n\tg_config.use_speed_sensor = 1;\n\tg_config.use_shift_sensor = HAS_SHIFT_SENSOR_SUPPORT;\n\tg_config.use_push_walk = 1;\n\tg_config.use_pretension = 0;\n\tg_config.pretension_speed_cutoff_kph = 16;\n\tg_config.use_temperature_sensor = TEMPERATURE_SENSOR_CONTR | TEMPERATURE_SENSOR_MOTOR;\n\n\tg_config.lights_mode = LIGHTS_MODE_DEFAULT;\n\n\tg_config.wheel_size_inch_x10_u16l = (uint8_t)280;\n\tg_config.wheel_size_inch_x10_u16h = (uint8_t)(280 >> 8);\n\n\tg_config.speed_sensor_signals = 1;\n\tg_config.max_speed_kph = 100;\n\n\tg_config.pas_start_delay_pulses = 5;\n\tg_config.pas_stop_delay_x100s = 20;\n\tg_config.pas_keep_current_percent = 60;\n\tg_config.pas_keep_current_cadence_rpm = 40;\n\n\tg_config.throttle_start_voltage_mv_u16l = (uint8_t)1000;\n\tg_config.throttle_start_voltage_mv_u16h = (uint8_t)(1000 >> 8);\n\tg_config.throttle_end_voltage_mv_u16l = (uint8_t)3600;\n\tg_config.throttle_end_voltage_mv_u16h = (uint8_t)(3600 >> 8);\n\tg_config.throttle_start_percent = 1;\n\tg_config.throttle_global_spd_lim_opt = THROTTLE_GLOBAL_SPEED_LIMIT_DISABLED;\n\tg_config.throttle_global_spd_lim_percent = 100;\n\n\tg_config.shift_interrupt_duration_ms_u16l = (uint8_t)600;\n\tg_config.shift_interrupt_duration_ms_u16h = (uint8_t)(600 >> 8);\n\tg_config.shift_interrupt_current_threshold_percent = 10;\n\n\tg_config.walk_mode_data_display = WALK_MODE_DATA_SPEED;\n\n\tg_config.assist_mode_select = ASSIST_MODE_SELECT_OFF;\n\tg_config.assist_startup_level = 3;\n\n\tmemset(&g_config.assist_levels, 0, 20 * sizeof(assist_level_t));\n\n\tfor (uint8_t i = 0; i < 9; ++i)\n\t{\n\t\tg_config.assist_levels[0][i+1].flags = ASSIST_FLAG_PAS | ASSIST_FLAG_THROTTLE;\n\t\tg_config.assist_levels[0][i+1].max_cadence_percent = 100;\n\t\tg_config.assist_levels[0][i+1].max_speed_percent = 100;\n\t\tg_config.assist_levels[0][i+1].max_throttle_current_percent = 100;\n\n#if HAS_TORQUE_SENSOR\n\t\tg_config.assist_levels[0][i+1].flags |= ASSIST_FLAG_PAS_TORQUE;\n\t\tg_config.assist_levels[0][i+1].target_current_percent = 100;\n\t\tg_config.assist_levels[0][i+1].torque_amplification_factor_x10 = default_torque_factors[i];\n#else\n\t\tg_config.assist_levels[0][i+1].target_current_percent = default_current_limits[i];\n\t\tg_config.assist_levels[0][i+1].torque_amplification_factor_x10 = 0;\n#endif\t\n\t}\n}\n\nstatic bool read_pstate()\n{\n\teventlog_write(EVT_MSG_PSTATE_READ_BEGIN);\n\n\tuint8_t res = read(EEPROM_PSTATE_PAGE, PSTATE_VERSION, (uint8_t*)&g_pstate, sizeof(pstate_t));\n\tswitch (res)\n\t{\n\tdefault:\n\t\teventlog_write(EVT_ERROR_EEPROM_READ);\n\t\tbreak;\n\tcase EEPROM_ERROR_VERSION:\n\t\teventlog_write(EVT_ERROR_EEPROM_VERIFY_VERSION);\n\t\tbreak;\n\tcase EEPROM_ERROR_LENGHT:\n\tcase EEPROM_ERROR_CHECKSUM:\n\t\teventlog_write(EVT_ERROR_EEPROM_VERIFY_CHECKSUM);\n\t\tbreak;\n\tcase EEPROM_OK:\n\t\teventlog_write(EVT_MSG_PSTATE_READ_DONE);\n\t\tbreak;\n\t}\n\n\treturn res == EEPROM_OK;\n}\n\nstatic bool write_pstate()\n{\n\teventlog_write(EVT_MSG_PSTATE_WRITE_BEGIN);\n\n\tuint8_t res = write(EEPROM_PSTATE_PAGE, PSTATE_VERSION, (uint8_t*)&g_pstate, sizeof(pstate_t));\n\tswitch (res)\n\t{\n\tdefault:\n\t\teventlog_write(EVT_ERROR_EEPROM_WRITE);\n\t\tbreak;\n\tcase EEPROM_ERROR_ERASE:\n\t\teventlog_write(EVT_ERROR_EEPROM_ERASE);\n\t\tbreak;\n\tcase EEPROM_OK:\n\t\teventlog_write(EVT_MSG_PSTATE_WRITE_DONE);\n\t\tbreak;\n\t}\n\n\treturn res == EEPROM_OK;\n\n}\n\nstatic void load_default_pstate()\n{\n\tg_pstate.adc_voltage_calibration_steps_x100_i16l = 0;\n\tg_pstate.adc_voltage_calibration_steps_x100_i16h = 0;\n}\n\nstatic uint8_t read(uint8_t page, uint8_t version, uint8_t* dst, uint8_t size)\n{\n\tuint8_t read_offset = 0;\n\tuint8_t* ptr = 0;\n\tuint8_t i = 0;\n\tint data;\n\n\tif (!eeprom_select_page(page))\n\t{\n\t\treturn EEPROM_ERROR_SELECT_PAGE;\n\t}\n\n\tptr = (uint8_t*)&header;\n\tfor (i = 0; i < sizeof(header_t); ++i)\n\t{\n\t\tdata = eeprom_read_byte(read_offset);\n\t\tif (data < 0)\n\t\t{\n\t\t\treturn EEPROM_ERROR_READ;\n\t\t}\n\t\t*ptr = (uint8_t)data;\n\t\t++read_offset;\n\t\t++ptr;\n\t}\n\n\t// verify header ok\n\tif (header.version != version)\n\t{\n\t\treturn EEPROM_ERROR_VERSION;\n\t}\n\n\tif (header.length != size)\n\t{\n\t\treturn EEPROM_ERROR_LENGHT;\n\t}\n\n\tuint8_t checksum = 0;\n\n\tptr = dst;\n\tfor (i = 0; i < size; ++i)\n\t{\n\t\tdata = eeprom_read_byte(read_offset);\n\t\tif (data < 0)\n\t\t{\n\t\t\treturn EEPROM_ERROR_READ;\n\t\t}\n\n\t\tchecksum += (uint8_t)data;\n\t\t*ptr = (uint8_t)data;\n\t\t++read_offset;\n\t\t++ptr;\n\t}\n\n\tif (header.checksum != checksum)\n\t{\n\t\treturn EEPROM_ERROR_CHECKSUM;\n\t}\n\n\treturn EEPROM_OK;\n}\n\nstatic uint8_t write(uint8_t page, uint8_t version, uint8_t* src, uint8_t size)\n{\n\tuint8_t write_offset = 0;\n\tuint8_t* ptr = 0;\n\tuint8_t i = 0;\n\n\theader.version = version;\n\theader.length = size;\n\theader.checksum = 0;\n\n\tif (!eeprom_select_page(page))\n\t{\n\t\treturn EEPROM_ERROR_SELECT_PAGE;\n\t}\n\n\tif (!eeprom_erase_page())\n\t{\n\t\treturn EEPROM_ERROR_ERASE;\n\t}\n\n\twrite_offset += sizeof(header_t);\n\n\tptr = src;\n\tfor (i = 0; i < size; ++i)\n\t{\n\t\tif (!eeprom_write_byte(write_offset, *ptr))\n\t\t{\n\t\t\teeprom_end_write();\n\t\t\treturn EEPROM_ERROR_WRITE;\n\t\t}\n\n\t\theader.checksum += *ptr;\n\t\t++write_offset;\n\t\t++ptr;\n\t}\n\n\twrite_offset = 0;\n\tptr = (uint8_t*)&header;\n\tfor (i = 0; i < sizeof(header_t); ++i)\n\t{\n\t\tif (!eeprom_write_byte(write_offset, *ptr))\n\t\t{\n\t\t\teeprom_end_write();\n\t\t\treturn EEPROM_ERROR_WRITE;\n\t\t}\n\n\t\t++write_offset;\n\t\t++ptr;\n\t}\n\n\teeprom_end_write();\n\n\treturn EEPROM_OK;\n}\n"
  },
  {
    "path": "src/firmware/cfgstore.h",
    "content": "/*\n * bbs-fw\n *\n * Copyright (C) Daniel Nilsson, 2022.\n *\n * Released under the GPL License, Version 3\n */\n\n#ifndef _CFGSTORE_H_\n#define _CFGSTORE_H_\n\n#include \"intellisense.h\"\n#include <stdint.h>\n#include <stdbool.h>\n\n#define ASSIST_FLAG_PAS\t\t\t\t\t0x01\n#define ASSIST_FLAG_THROTTLE\t\t\t0x02\n#define ASSIST_FLAG_CRUISE\t\t\t\t0x04\n#define ASSIST_FLAG_PAS_VARIABLE\t\t0x08\t// pas mode using throttle to set power level\n#define ASSIST_FLAG_PAS_TORQUE\t\t\t0x10\t// pas mode using torque sensor reading\n#define ASSIST_FLAG_OVERRIDE_CADENCE\t0x20\t// pas option where max cadence is set to 100% when throttle overrides pas\n#define ASSIST_FLAG_OVERRIDE_SPEED\t\t0x40\t// pas option where max speed is set to 100% when throttle overrides pas\n\n#define ASSIST_MODE_SELECT_OFF\t\t\t0x00\n#define ASSIST_MODE_SELECT_STANDARD\t\t0x01\n#define ASSIST_MODE_SELECT_LIGHTS\t\t0x02\n#define ASSIST_MODE_SELECT_PAS0_LIGHT\t0x03\n#define ASSIST_MODE_SELECT_PAS1_LIGHT\t0x04\n#define ASSIST_MODE_SELECT_PAS2_LIGHT\t0x05\n#define ASSIST_MODE_SELECT_PAS3_LIGHT\t0x06\n#define ASSIST_MODE_SELECT_PAS4_LIGHT\t0x07\n#define ASSIST_MODE_SELECT_PAS5_LIGHT\t0x08\n#define ASSIST_MODE_SELECT_PAS6_LIGHT\t0x09\n#define ASSIST_MODE_SELECT_PAS7_LIGHT\t0x0A\n#define ASSIST_MODE_SELECT_PAS8_LIGHT\t0x0B\n#define ASSIST_MODE_SELECT_PAS9_LIGHT\t0x0C\n#define ASSIST_MODE_SELECT_BRAKE_BOOT\t0x0D\n\n\n#define TEMPERATURE_SENSOR_CONTR\t\t0x01\n#define TEMPERATURE_SENSOR_MOTOR\t\t0x02\n\n#define WALK_MODE_DATA_SPEED\t\t\t0\n#define WALK_MODE_DATA_TEMPERATURE\t\t1\n#define WALK_MODE_DATA_REQUESTED_POWER\t2\n#define WALK_MODE_DATA_BATTERY_PERCENT\t3\n\n#define THROTTLE_GLOBAL_SPEED_LIMIT_DISABLED\t0\n#define THROTTLE_GLOBAL_SPEED_LIMIT_ENABLED\t\t1\n#define THROTTLE_GLOBAL_SPEED_LIMIT_STD_LVLS\t2\n\n#define LIGHTS_MODE_DEFAULT\t\t\t\t0\n#define LIGHTS_MODE_DISABLED\t\t\t1\n#define LIGHTS_MODE_ALWAYS_ON\t\t\t2\n#define LIGHTS_MODE_BRAKE_LIGHT\t\t\t3\n\n#define CONFIG_VERSION\t\t\t\t\t5\n#define PSTATE_VERSION\t\t\t\t\t1\n\n\ntypedef struct\n{\n\tuint8_t flags;\n\tuint8_t target_current_percent;\n\tuint8_t max_throttle_current_percent;\n\tuint8_t max_cadence_percent;\n\tuint8_t max_speed_percent;\n\n\t// 10 => 1.0: 100w human power gives and additional 100w motor power\n\tuint8_t torque_amplification_factor_x10;\n}  assist_level_t;\n\n// SDCC uses little endian for MCS51 and big endian for STM8...\ntypedef struct\n{\n\t// hmi units\n\tuint8_t use_freedom_units;\n\n\t// global\n\tuint8_t max_current_amps;\n\tuint8_t current_ramp_amps_s;\n\tuint8_t max_battery_x100v_u16l;\n\tuint8_t max_battery_x100v_u16h;\n\tuint8_t low_cut_off_v;\n\tuint8_t max_speed_kph;\n\n\t// externals\n\tuint8_t use_speed_sensor;\n\tuint8_t use_shift_sensor;\n\tuint8_t use_push_walk;\n\tuint8_t use_temperature_sensor;\n\tuint8_t lights_mode;\n\tuint8_t use_pretension;\n\tuint8_t pretension_speed_cutoff_kph;\n\n\t// speed sensor\n\tuint8_t wheel_size_inch_x10_u16l;\n\tuint8_t wheel_size_inch_x10_u16h;\n\tuint8_t speed_sensor_signals;\n\n\t// pas options\n\tuint8_t pas_start_delay_pulses;\n\tuint8_t pas_stop_delay_x100s;\n\tuint8_t pas_keep_current_percent;\n\tuint8_t pas_keep_current_cadence_rpm;\n\n\t// throttle options\n\tuint8_t throttle_start_voltage_mv_u16l;\n\tuint8_t throttle_start_voltage_mv_u16h;\n\tuint8_t throttle_end_voltage_mv_u16l;\n\tuint8_t throttle_end_voltage_mv_u16h;\n\tuint8_t throttle_start_percent;\n\tuint8_t throttle_global_spd_lim_opt;\n\tuint8_t throttle_global_spd_lim_percent;\n\n\t// shift interrupt options\n\tuint8_t shift_interrupt_duration_ms_u16l;\n\tuint8_t shift_interrupt_duration_ms_u16h;\n\tuint8_t shift_interrupt_current_threshold_percent;\n\n\t// misc\n\tuint8_t walk_mode_data_display;\n\n\t// assist levels\n\tuint8_t assist_mode_select;\n\tuint8_t assist_startup_level;\n\tassist_level_t assist_levels[2][10];\n} config_t;\n\ntypedef struct\n{\n\tuint8_t adc_voltage_calibration_steps_x100_i16l;\n\tuint8_t adc_voltage_calibration_steps_x100_i16h;\n} pstate_t;\n\n\nextern config_t g_config;\nextern pstate_t g_pstate;\n\nvoid cfgstore_init();\n\nbool cfgstore_reset_config();\nbool cfgstore_save_config();\n\nbool cfgstore_reset_pstate();\nbool cfgstore_save_pstate();\n\n#endif\n"
  },
  {
    "path": "src/firmware/clean.bat",
    "content": "@ECHO OFF\n\ndel /s /q *.hex >NUL 2>NUL\ndel /s /q *.ihx >NUL 2>NUL\n\ndel /s /q *.asm >NUL 2>NUL\ndel /s /q *.rel >NUL 2>NUL\ndel /s /q *.lk >NUL 2>NUL\ndel /s /q *.lst >NUL 2>NUL\ndel /s /q *.rst >NUL 2>NUL\ndel /s /q *.sym >NUL 2>NUL\ndel /s /q *.cdb >NUL 2>NUL\ndel /s /q *.map >NUL 2>NUL\ndel /s /q *.elf >NUL 2>NUL\ndel /s /q *.adb >NUL 2>NUL\ndel /s /q *.mem >NUL 2>NUL\n\n@ECHO ON"
  },
  {
    "path": "src/firmware/eeprom.h",
    "content": "/*\n * bbs-fw\n *\n * Copyright (C) Daniel Nilsson, 2022.\n *\n * Released under the GPL License, Version 3\n */\n\n#ifndef _EEPROM_H_\n#define _EEPROM_H_\n\n#include \"intellisense.h\"\n#include <stdint.h>\n#include <stdbool.h>\n\nvoid eeprom_init();\nbool eeprom_select_page(int page);\n\nint eeprom_read_byte(int offset);\n\nbool eeprom_erase_page();\nbool eeprom_write_byte(int offset, uint8_t value);\nbool eeprom_end_write();\n\n#endif\n"
  },
  {
    "path": "src/firmware/eventlog.c",
    "content": "/*\n * bbs-fw\n *\n * Copyright (C) Daniel Nilsson, 2022.\n *\n * Released under the GPL License, Version 3\n */\n\n#include \"eventlog.h\"\n#include \"uart.h\"\n\nstatic bool is_enabled;\n\nvoid eventlog_init(bool enabled)\n{\n\tis_enabled = enabled;\n}\n\nbool eventlog_is_enabled()\n{\n\treturn is_enabled;\n}\n\nvoid eventlog_set_enabled(bool enabled)\n{\n\tis_enabled = enabled;\n}\n\nvoid eventlog_write(uint8_t evt)\n{\n\tif (!is_enabled)\n\t{\n\t\treturn;\n\t}\n\n\tuart_write(0xee);\n\tuart_write(evt);\n\tuart_write((uint8_t)0xee + evt);\n}\nvoid eventlog_write_data(uint8_t evt, int16_t data)\n{\n\tif (!is_enabled)\n\t{\n\t\treturn;\n\t}\n\n\tuint8_t checksum = 0;\n\n\tuart_write(0xed); checksum += (uint8_t)0xed;\n\tuart_write(evt); checksum += evt;\n\tuart_write((uint8_t)(data >> 8)); checksum += (uint8_t)(data >> 8);\n\tuart_write((uint8_t)data); checksum += (uint8_t)data;\n\tuart_write(checksum);\n}\n"
  },
  {
    "path": "src/firmware/eventlog.h",
    "content": "/*\n * bbs-fw\n *\n * Copyright (C) Daniel Nilsson, 2022.\n *\n * Released under the GPL License, Version 3\n */\n\n#ifndef _EVENTLOG_H_\n#define _EVENTLOG_H_\n\n#include \"intellisense.h\"\n\n#include <stdbool.h>\n#include <stdint.h>\n\n#define EVT_MSG_MOTOR_INIT_OK\t\t\t\t1\n#define EVT_MSG_CONFIG_READ_DONE\t\t\t2\n#define EVT_MSG_CONFIG_RESET\t\t\t\t3\n#define EVT_MSG_CONFIG_WRITE_DONE\t\t\t4\n#define EVT_MSG_CONFIG_READ_BEGIN\t\t\t5\n#define EVT_MSG_CONFIG_WRITE_BEGIN\t\t\t6\n#define EVT_MSG_PSTATE_READ_BEGIN\t\t\t7\n#define EVT_MSG_PSTATE_READ_DONE\t\t\t8\n#define EVT_MSG_PSTATE_WRITE_BEGIN\t\t\t9\n#define EVT_MSG_PSTATE_WRITE_DONE\t\t\t10\n\n\n#define EVT_ERROR_INIT_MOTOR\t\t\t\t64\n#define EVT_ERROR_CHANGE_TARGET_SPEED\t\t65\n#define EVT_ERROR_CHANGE_TARGET_CURRENT\t\t66\n#define EVT_ERROR_READ_MOTOR_STATUS\t\t\t67\n#define EVT_ERROR_READ_MOTOR_CURRENT\t\t68\n#define EVT_ERROR_READ_MOTOR_VOLTAGE\t\t69\n\n#define EVT_ERROR_EEPROM_READ\t\t\t\t70\n#define EVT_ERROR_EEPROM_WRITE\t\t\t\t71\n#define EVT_ERROR_EEPROM_ERASE\t\t\t\t72\n#define EVT_ERROR_EEPROM_VERIFY_VERSION\t\t73\n#define EVT_ERROR_EEPROM_VERIFY_CHECKSUM\t74\n#define EVT_ERROR_THROTTLE_LOW_LIMIT\t\t75\n#define EVT_ERROR_THROTTLE_HIGH_LIMIT\t\t76\n#define EVT_ERROR_WATCHDOG_TRIGGERED\t\t77\n#define EVT_ERROR_EXTCOM_CHEKSUM\t\t\t78\r\n#define EVT_ERROR_EXTCOM_DISCARD\t\t\t79\n\n\n#define EVT_DATA_TARGET_CURRENT\t\t\t\t128\n#define EVT_DATA_TARGET_SPEED\t\t\t\t129\n#define EVT_DATA_MOTOR_STATUS\t\t\t\t130\n#define EVT_DATA_ASSIST_LEVEL\t\t\t\t131\n#define EVT_DATA_OPERATION_MODE\t\t\t\t132\n#define EVT_DATA_WHEEL_SPEED_PPM\t\t\t133\n#define EVT_DATA_LIGHTS\t\t\t\t\t\t134\n#define EVT_DATA_TEMPERATURE\t\t\t\t135\n#define EVT_DATA_THERMAL_LIMITING\t\t\t136\n#define EVT_DATA_SPEED_LIMITING\t\t\t\t137\n#define EVT_DATA_MAX_CURRENT_ADC_REQUEST\t138\n#define EVT_DATA_MAX_CURRENT_ADC_RESPONSE\t139\n#define EVT_DATA_MAIN_LOOP_TIME\t\t\t\t140\n#define EVT_DATA_THROTTLE_ADC\t\t\t\t141\n#define EVT_DATA_LVC_LIMITING\t\t\t\t142\n#define EVT_DATA_SHIFT_SENSOR\t\t\t\t143\n#define EVT_DATA_BBSHD_THERMISTOR\t\t\t144\n#define EVT_DATA_VOLTAGE\t\t\t\t\t145\n#define EVT_DATA_CALIBRATE_VOLTAGE\t\t\t146\n#define EVT_DATA_TORQUE_ADC\t\t\t\t\t147\n#define EVT_DATA_TORQUE_ADC_CALIBRATED\t\t148\n\n\nvoid eventlog_init(bool enabled);\n\nbool eventlog_is_enabled();\nvoid eventlog_set_enabled(bool enabled);\n\nvoid eventlog_write(uint8_t evt);\nvoid eventlog_write_data(uint8_t evt, int16_t data);\n\n\n#endif\n"
  },
  {
    "path": "src/firmware/extcom.c",
    "content": "/*\n * bbs-fw\n *\n * Copyright (C) Daniel Nilsson, 2022.\n *\n * Released under the GPL License, Version 3\n */\n\n#include \"extcom.h\"\n#include \"cfgstore.h\"\n#include \"eventlog.h\"\n#include \"uart.h\"\n#include \"system.h\"\n#include \"sensors.h\"\n#include \"motor.h\"\n#include \"battery.h\"\n#include \"app.h\"\n#include \"util.h\"\n#include \"version.h\"\n#include \"intellisense.h\"\r\n#include \"fwconfig.h\"\n\n#include <stdint.h>\n#include <stdbool.h>\n#include <string.h>\n\n#define KEEP\t\t0\n#define DISCARD\t\t-1\n\n\n#define BUFFER_SIZE\t\t\t192\r\n#define DISCARD_TIMEOUT_MS\t50\n\n#define REQUEST_TYPE_READ\t\t\t\t\t\t0x01\n#define REQUEST_TYPE_WRITE\t\t\t\t\t\t0x02\n\n#define REQUEST_TYPE_BAFANG_READ\t\t\t\t0x11\n#define REQUEST_TYPE_BAFANG_WRITE\t\t\t\t0x16\n\n\n// Firmware config tool communication\n#define OPCODE_READ_FW_VERSION\t\t\t\t\t0x01\n#define OPCODE_READ_EVTLOG_ENABLE\t\t\t\t0x02\n#define OPCODE_READ_CONFIG\t\t\t\t\t\t0x03\n#define OPCODE_READ_STATUS\t\t\t\t\t\t0x04\n\n#define OPCODE_WRITE_EVTLOG_ENABLE\t\t\t\t0xf0\n#define OPCODE_WRITE_CONFIG\t\t\t\t\t\t0xf1\n#define OPCODE_WRITE_RESET_CONFIG\t\t\t\t0xf2\n#define OPCODE_WRITE_ADC_VOLTAGE_CALIBRATION\t0xf3\n\n\n// Bafang display communication\n#define OPCODE_BAFANG_DISPLAY_READ_STATUS\t\t0x08\n#define OPCODE_BAFANG_DISPLAY_READ_CURRENT\t\t0x0a\n#define OPCODE_BAFANG_DISPLAY_READ_BATTERY\t\t0x11\n#define OPCODE_BAFANG_DISPLAY_READ_SPEED\t\t0x20\n#define OPCODE_BAFANG_DISPLAY_READ_UNKNOWN1\t\t0x21\n#define OPCODE_BAFANG_DISPLAY_READ_RANGE\t\t0x22\n#define OPCODE_BAFANG_DISPLAY_READ_CALORIES\t\t0x24\n#define OPCODE_BAFANG_DISPLAY_READ_UNKNOWN3\t\t0x25\n#define OPCODE_BAFANG_DISPLAY_READ_MOVING\t\t0x31\n\n#define OPCODE_BAFANG_DISPLAY_WRITE_PAS\t\t\t0x0b\n#define OPCODE_BAFANG_DISPLAY_WRITE_MODE\t\t0x0c\n#define OPCODE_BAFANG_DISPLAY_WRITE_LIGHTS\t\t0x1a\n#define OPCODE_BAFANG_DISPLAY_WRITE_SPEED_LIM\t0x1f\n\n// Bafang config tool communication (not supported, just discard messages)\n#define OPCODE_BAFANG_TOOL_READ_CONNECT\t\t\t0x51\n#define OPCODE_BAFANG_TOOL_READ_BASIC\t\t\t0x52\n#define OPCODE_BAFANG_TOOL_READ_PAS\t\t\t\t0x53\n#define OPCODE_BAFANG_TOOL_READ_THROTTLE\t\t0x54\n\n#define OPCODE_BAFANG_TOOL_WRITE_BASIC\t\t\t0x52\n#define OPCODE_BAFANG_TOOL_WRITE_PAS\t\t\t0x53\n#define OPCODE_BAFANG_TOOL_WRITE_THROTTLE\t\t0x54\n\n\n\nstatic uint8_t msg_len;\nstatic uint8_t msgbuf[BUFFER_SIZE];\nstatic uint32_t last_recv_ms;\nstatic uint32_t discard_until_ms;\n\nstatic uint8_t compute_checksum(uint8_t* buf, uint8_t length);\nstatic void write_uart_and_increment_checksum(uint8_t data, uint8_t* checksum);\n\nstatic int16_t try_process_request();\nstatic int16_t try_process_read_request();\nstatic int16_t try_process_write_request();\nstatic int16_t try_process_bafang_read_request();\nstatic int16_t try_process_bafang_write_request();\n\n\nstatic int16_t process_read_fw_version();\nstatic int16_t process_read_evtlog_enable();\nstatic int16_t process_read_config();\nstatic int16_t process_read_status();\n\nstatic int16_t process_write_evtlog_enable();\nstatic int16_t process_write_config();\nstatic int16_t process_write_reset_config();\nstatic int16_t process_write_adc_voltage_calibration();\n\n\nstatic int16_t process_bafang_display_read_status();\nstatic int16_t process_bafang_display_read_current();\nstatic int16_t process_bafang_display_read_battery();\nstatic int16_t process_bafang_display_read_speed();\nstatic int16_t process_bafang_display_read_unknown1();\nstatic int16_t process_bafang_display_read_range();\nstatic int16_t process_bafang_display_read_calories();\nstatic int16_t process_bafang_display_read_unknown3();\nstatic int16_t process_bafang_display_read_moving();\n\nstatic int16_t process_bafang_display_write_pas();\nstatic int16_t process_bafang_display_write_mode();\nstatic int16_t process_bafang_display_write_lights();\nstatic int16_t process_bafang_display_write_speed_limit();\n\nvoid extcom_init()\n{\n\tmsg_len = 0;\n\tlast_recv_ms = 0;\r\n\tdiscard_until_ms = 0;\n\n\t// Bafang standard baud rate\n\tuart_open(1200);\n\n\n\t// Wait one second for config tool connection.\n\t// This is here to that the config tool can enable\n\t// the event log before system proceeds with initialization.\n\tuint32_t end = system_ms() + 1000;\n\twhile (system_ms() < end)\n\t{\n\t\textcom_process();\n\t\tsystem_delay_ms(10);\n\t}\n}\n\nvoid extcom_process()\n{\n\tuint32_t now = system_ms();\n\n\twhile (uart_available())\n\t{\n\t\tif (msg_len == BUFFER_SIZE || (discard_until_ms != 0 && now < discard_until_ms))\n\t\t{\n\t\t\t// communication error, reset\n\t\t\tmsg_len = 0;\n\t\t\twhile (uart_available()) uart_read();\n\t\t}\n\t\telse\n\t\t{\n\t\t\tmsgbuf[msg_len++] = uart_read();\n\t\t\tlast_recv_ms = now;\r\n\t\t\tdiscard_until_ms = 0;\n\t\t}\t\n\t}\n\n\tif (msg_len > 0 && now - last_recv_ms > 100)\n\t{\n\t\t// communication error, reset\n\t\tmsg_len = 0;\n\t}\n\n\tint16_t res = try_process_request();\n\tif (res == DISCARD)\n\t{\n\t\tmsg_len = 0;\n\t\tlast_recv_ms = 0;\r\n\t\t// Discard received data for the next DISCARD_TIMEOUT_MS milliseconds\r\n\t\tdiscard_until_ms = now + DISCARD_TIMEOUT_MS;\r\n\r\n\t\teventlog_write(EVT_ERROR_EXTCOM_DISCARD);\n\t}\n\telse if (res > 0)\n\t{\n\t\tif (res < msg_len)\n\t\t{\n\t\t\t// will not occur due to request/response communication\n\t\t\tmemcpy(msgbuf, msgbuf + res, msg_len - res);\n\t\t\tmsg_len -= res;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tmsg_len = 0;\n\t\t\tlast_recv_ms = 0;\n\t\t}\n\t}\n}\n\n\nstatic uint8_t compute_checksum(uint8_t* buf, uint8_t length)\n{\n\tuint8_t result = 0;\n\n\tfor (uint8_t i = 0; i < length; ++i)\n\t{\n\t\tresult += buf[i];\n\t}\n\n\treturn result;\n}\n\nstatic void write_uart_and_increment_checksum(uint8_t data, uint8_t* checksum)\n{\n\t*checksum += data;\n\tuart_write(data);\n}\n\nstatic int16_t try_process_request()\n{\n\tif (msg_len < 1)\n\t{\n\t\treturn KEEP;\n\t}\n\n\tswitch (msgbuf[0])\n\t{\n\tcase REQUEST_TYPE_READ:\n\t\treturn try_process_read_request();\n\tcase REQUEST_TYPE_WRITE:\n\t\treturn try_process_write_request();\n\tcase REQUEST_TYPE_BAFANG_READ:\n\t\treturn try_process_bafang_read_request();\n\tcase REQUEST_TYPE_BAFANG_WRITE:\n\t\treturn try_process_bafang_write_request();\n\t}\n\n\treturn DISCARD; // unknown message\n}\n\nstatic int16_t try_process_read_request()\n{\n\tif (msg_len < 2)\n\t{\n\t\treturn KEEP;\n\t}\n\n\tswitch (msgbuf[1])\n\t{\n\tcase OPCODE_READ_FW_VERSION:\n\t\treturn process_read_fw_version();\n\tcase OPCODE_READ_EVTLOG_ENABLE:\n\t\treturn process_read_evtlog_enable();\n\tcase OPCODE_READ_CONFIG:\n\t\treturn process_read_config();\n\tcase OPCODE_READ_STATUS:\n\t\treturn process_read_status();\n\t}\n\n\treturn DISCARD;\n}\n\nstatic int16_t try_process_write_request()\n{\n\tif (msg_len < 2)\n\t{\n\t\treturn KEEP;\n\t}\n\n\tswitch (msgbuf[1])\n\t{\n\tcase OPCODE_WRITE_EVTLOG_ENABLE:\n\t\treturn process_write_evtlog_enable();\n\tcase OPCODE_WRITE_CONFIG:\n\t\treturn process_write_config();\n\tcase OPCODE_WRITE_RESET_CONFIG:\n\t\treturn process_write_reset_config();\n\tcase OPCODE_WRITE_ADC_VOLTAGE_CALIBRATION:\n\t\treturn process_write_adc_voltage_calibration();\n\t}\n\n\treturn DISCARD;\n}\n\nstatic int16_t try_process_bafang_read_request()\n{\n\tif (msg_len < 2)\n\t{\n\t\treturn KEEP;\n\t}\n\n\tswitch (msgbuf[1])\n\t{\n\tcase OPCODE_BAFANG_DISPLAY_READ_STATUS:\n\t\treturn process_bafang_display_read_status();\n\tcase OPCODE_BAFANG_DISPLAY_READ_CURRENT:\n\t\treturn process_bafang_display_read_current();\n\tcase OPCODE_BAFANG_DISPLAY_READ_BATTERY:\n\t\treturn process_bafang_display_read_battery();\n\tcase OPCODE_BAFANG_DISPLAY_READ_SPEED:\n\t\treturn process_bafang_display_read_speed();\n\tcase OPCODE_BAFANG_DISPLAY_READ_UNKNOWN1:\n\t\treturn process_bafang_display_read_unknown1();\n\tcase OPCODE_BAFANG_DISPLAY_READ_RANGE:\n\t\treturn process_bafang_display_read_range();\n\tcase OPCODE_BAFANG_DISPLAY_READ_CALORIES:\n\t\treturn process_bafang_display_read_calories();\n\tcase OPCODE_BAFANG_DISPLAY_READ_UNKNOWN3:\n\t\treturn process_bafang_display_read_unknown3();\n\tcase OPCODE_BAFANG_DISPLAY_READ_MOVING:\n\t\treturn process_bafang_display_read_moving();\n\t}\n\n\treturn DISCARD;\n}\n\nstatic int16_t try_process_bafang_write_request()\n{\n\tif (msg_len < 2)\n\t{\n\t\treturn KEEP;\n\t}\n\n\tswitch (msgbuf[1])\n\t{\n\tcase OPCODE_BAFANG_DISPLAY_WRITE_PAS:\n\t\treturn process_bafang_display_write_pas();\n\tcase OPCODE_BAFANG_DISPLAY_WRITE_MODE:\n\t\treturn process_bafang_display_write_mode();\n\tcase OPCODE_BAFANG_DISPLAY_WRITE_LIGHTS:\n\t\treturn process_bafang_display_write_lights();\n\tcase OPCODE_BAFANG_DISPLAY_WRITE_SPEED_LIM:\n\t\treturn process_bafang_display_write_speed_limit();\n\t}\n\n\treturn DISCARD;\n}\n\n\n\nstatic int16_t process_read_fw_version()\n{\n\tif (msg_len < 3)\n\t{\n\t\treturn KEEP;\n\t}\n\n\tif (compute_checksum(msgbuf, 2) == msgbuf[2])\n\t{\n\t\tuint8_t checksum = 0;\n\t\twrite_uart_and_increment_checksum(REQUEST_TYPE_READ, &checksum);\n\t\twrite_uart_and_increment_checksum(OPCODE_READ_FW_VERSION, &checksum);\n\t\twrite_uart_and_increment_checksum(VERSION_MAJOR, &checksum);\n\t\twrite_uart_and_increment_checksum(VERSION_MINOR, &checksum);\n\t\twrite_uart_and_increment_checksum(VERSION_PATCH, &checksum);\n\t\twrite_uart_and_increment_checksum(CONFIG_VERSION, &checksum);\n\t\twrite_uart_and_increment_checksum(CTRL_TYPE, &checksum);\n\t\tuart_write(checksum);\n\t}\n\telse\n\t{\n\t\teventlog_write(EVT_ERROR_EXTCOM_CHEKSUM);\r\n\t\treturn DISCARD;\n\t}\n\n\treturn 3;\n}\n\nstatic int16_t process_read_evtlog_enable()\n{\n\tif (msg_len < 3)\n\t{\n\t\treturn KEEP;\n\t}\n\n\tif (compute_checksum(msgbuf, 2) == msgbuf[2])\n\t{\n\t\tuint8_t checksum = 0;\n\t\twrite_uart_and_increment_checksum(REQUEST_TYPE_READ, &checksum);\n\t\twrite_uart_and_increment_checksum(OPCODE_READ_EVTLOG_ENABLE, &checksum);\n\t\twrite_uart_and_increment_checksum((uint8_t)eventlog_is_enabled(), &checksum);\n\t\tuart_write(checksum);\n\t}\n\telse\n\t{\n\t\teventlog_write(EVT_ERROR_EXTCOM_CHEKSUM);\r\n\t\treturn DISCARD;\n\t}\n\n\treturn 3;\n}\n\nstatic int16_t process_read_config()\n{\n\tif (msg_len < 3)\n\t{\n\t\treturn KEEP;\n\t}\n\n\tif (compute_checksum(msgbuf, 2) == msgbuf[2])\n\t{\n\t\tuint8_t checksum = 0;\n\t\twrite_uart_and_increment_checksum(REQUEST_TYPE_READ, &checksum);\n\t\twrite_uart_and_increment_checksum(OPCODE_READ_CONFIG, &checksum);\n\t\twrite_uart_and_increment_checksum(CONFIG_VERSION, &checksum);\n\t\twrite_uart_and_increment_checksum(sizeof(config_t), &checksum);\n\n\t\tuint8_t* cfg = (uint8_t*)&g_config;\n\t\tfor (uint8_t i = 0; i < sizeof(config_t); ++i)\n\t\t{\n\t\t\twrite_uart_and_increment_checksum(*(cfg + i), &checksum);\n\t\t}\n\n\t\tuart_write(checksum);\n\t}\n\telse\n\t{\n\t\teventlog_write(EVT_ERROR_EXTCOM_CHEKSUM);\r\n\t\treturn DISCARD;\n\t}\n\n\treturn 3;\n}\n\nstatic int16_t process_read_status()\n{\n\t// :TODO:\n\treturn 0;\n}\n\nstatic int16_t process_write_evtlog_enable()\n{\n\tif (msg_len < 4)\n\t{\n\t\treturn KEEP;\n\t}\n\n\tif (compute_checksum(msgbuf, 3) == msgbuf[3])\n\t{\n\t\teventlog_set_enabled((bool)msgbuf[2]);\n\n\t\tuint8_t checksum = 0;\n\t\twrite_uart_and_increment_checksum(REQUEST_TYPE_WRITE, &checksum);\n\t\twrite_uart_and_increment_checksum(OPCODE_WRITE_EVTLOG_ENABLE, &checksum);\n\t\twrite_uart_and_increment_checksum(msgbuf[2], &checksum);\n\t\tuart_write(checksum);\n\t}\n\telse\n\t{\n\t\teventlog_write(EVT_ERROR_EXTCOM_CHEKSUM);\r\n\t\treturn DISCARD;\n\t}\n\n\treturn 4;\n}\n\nstatic int16_t process_write_config()\n{\n\tif (msg_len < 4)\n\t{\n\t\treturn KEEP;\n\t}\n\n\tuint8_t version = msgbuf[2];\n\tuint8_t length = msgbuf[3];\n\n\tif (msg_len < 4 + length + 1)\n\t{\n\t\treturn KEEP;\n\t}\n\n\tif (compute_checksum(msgbuf, (uint8_t)(4 + sizeof(config_t))) == msgbuf[4 + sizeof(config_t)])\n\t{\n\t\tbool result = false;\n\t\tif (version == CONFIG_VERSION && length == sizeof(config_t))\n\t\t{\n\t\t\tmemcpy(&g_config, msgbuf + 4, sizeof(config_t));\n\t\t\tresult = cfgstore_save_config();\n\t\t}\n\n\t\tuint8_t checksum = 0;\n\t\twrite_uart_and_increment_checksum(REQUEST_TYPE_WRITE, &checksum);\n\t\twrite_uart_and_increment_checksum(OPCODE_WRITE_CONFIG, &checksum);\n\t\twrite_uart_and_increment_checksum(result, &checksum);\n\t\tuart_write(checksum);\n\t}\n\telse\n\t{\n\t\teventlog_write(EVT_ERROR_EXTCOM_CHEKSUM);\r\n\t\treturn DISCARD;\n\t}\n\n\treturn 4 + length + 1;\n}\n\nstatic int16_t process_write_reset_config()\n{\n\tif (msg_len < 3)\n\t{\n\t\treturn KEEP;\n\t}\n\n\tif (compute_checksum(msgbuf, 2) == msgbuf[2])\n\t{\n\n\t\tbool res = cfgstore_reset_config();\n\n\t\tuint8_t checksum = 0;\n\t\twrite_uart_and_increment_checksum(REQUEST_TYPE_WRITE, &checksum);\n\t\twrite_uart_and_increment_checksum(OPCODE_WRITE_RESET_CONFIG, &checksum);\n\t\twrite_uart_and_increment_checksum((uint8_t)res, &checksum);\n\t\tuart_write(checksum);\n\t}\n\telse\n\t{\n\t\teventlog_write(EVT_ERROR_EXTCOM_CHEKSUM);\r\n\t\treturn DISCARD;\n\t}\n\n\treturn 3;\n}\n\nstatic int16_t process_write_adc_voltage_calibration()\n{\n\tif (msg_len < 5)\n\t{\n\t\treturn KEEP;\n\t}\n\n\tif (compute_checksum(msgbuf, 4) == msgbuf[4])\n\t{\n\t\tuint16_t actual_volt_x100 = ((uint16_t)msgbuf[2] << 8) | msgbuf[3];\n\n\t\tint16_t calibration_offset = motor_calibrate_battery_voltage(actual_volt_x100);\n\t\tg_pstate.adc_voltage_calibration_steps_x100_i16l = (uint8_t)(calibration_offset);\n\t\tg_pstate.adc_voltage_calibration_steps_x100_i16h = (uint8_t)(calibration_offset >> 8);\n\n\t\tcfgstore_save_pstate();\n\n\t\tuint8_t checksum = 0;\n\t\twrite_uart_and_increment_checksum(REQUEST_TYPE_WRITE, &checksum);\n\t\twrite_uart_and_increment_checksum(OPCODE_WRITE_ADC_VOLTAGE_CALIBRATION, &checksum);\n\t\twrite_uart_and_increment_checksum(msgbuf[2], &checksum);\n\t\twrite_uart_and_increment_checksum(msgbuf[3], &checksum);\n\t\tuart_write(checksum);\n\t}\n\telse\n\t{\n\t\teventlog_write(EVT_ERROR_EXTCOM_CHEKSUM);\r\n\t\treturn DISCARD;\n\t}\n\n\treturn 5;\n}\n\n\nstatic int16_t process_bafang_display_read_status()\n{\n\tif (msg_len < 2)\n\t{\n\t\treturn KEEP;\n\t}\n\n\tuart_write(app_get_status_code());\n\n\treturn 2;\n}\n\nstatic int16_t process_bafang_display_read_current()\n{\n\tif (msg_len < 2)\n\t{\n\t\treturn KEEP;\n\t}\n\n\tuint8_t amp_x2 = (uint8_t)((motor_get_battery_current_x10() * 2) / 10);\n\n\tuart_write(amp_x2);\n\tuart_write(amp_x2); // checksum\n\n\treturn 2;\n}\n\nstatic int16_t process_bafang_display_read_battery()\n{\n\tif (msg_len < 2)\n\t{\n\t\treturn KEEP;\n\t}\n\n\tuint8_t value = battery_get_mapped_percent();\n\n\tuart_write(value);\n\tuart_write(value); // checksum\n\n\treturn 2;\n}\n\nstatic int16_t process_bafang_display_read_speed()\n{\n\tif (msg_len < 2)\n\t{\n\t\treturn KEEP;\n\t}\n\n\tuint16_t speed = 0;\n\n\tif (g_config.walk_mode_data_display != WALK_MODE_DATA_SPEED && app_get_assist_level() == ASSIST_PUSH)\n\t{\n\t\tuint16_t data = 0;\n\n\t\tswitch (g_config.walk_mode_data_display)\n\t\t{\n\t\tcase WALK_MODE_DATA_TEMPERATURE:\n\t\t\t// Keep temperature in C, farenheit would be out of range\n\t\t\tdata = app_get_temperature();\n\t\t\tbreak;\n\t\tcase WALK_MODE_DATA_REQUESTED_POWER:\n\t\t\tdata = motor_get_target_current();\n\t\t\tbreak;\n\t\tcase WALK_MODE_DATA_BATTERY_PERCENT:\n\t\t\tdata = battery_get_percent();\n\t\t\tbreak;\n\t\t}\n\n\t\tif (g_config.use_freedom_units)\n\t\t{\n\t\t\t// Compensate for kph -> mph conversion display will do.\n\t\t\tdata = (data * 161) / 100;\n\t\t}\n\n\t\t// T_kph -> rpm\n\t\tspeed = (uint16_t)(25000.f / (3 * 3.14159f * 1.27f * EXPAND_U16(g_config.wheel_size_inch_x10_u16h, g_config.wheel_size_inch_x10_u16l)) * data);\n\t}\n\telse\n\t{\n\t\tspeed = speed_sensor_get_rpm_x10() / 10;\n\t}\n\n\n\tuint8_t checksum = 0;\n\n\twrite_uart_and_increment_checksum(speed >> 8, &checksum);\n\twrite_uart_and_increment_checksum((uint8_t)speed, &checksum);\n\tuart_write(checksum + (uint8_t)0x20); // weird checksum\n\n\treturn 2;\n}\n\nstatic int16_t process_bafang_display_read_unknown1()\n{\n\tif (msg_len < 3)\n\t{\n\t\treturn KEEP;\n\t}\n\n\tuart_write(0x00);\n\tuart_write(0x00);\n\tuart_write(0x00); // checksum\n\n\treturn 3;\n}\n\nstatic int16_t process_bafang_display_read_range()\n{\n\tif (msg_len < 3)\n\t{\n\t\treturn KEEP;\n\t}\n\r\n\tuint16_t value = 0;\r\n\r\n#if DISPLAY_RANGE_FIELD_DATA == DISPLAY_RANGE_FIELD_TEMPERATURE\r\n\tvalue = app_get_temperature();\n\tif (g_config.use_freedom_units)\n\t{\n\t\t// Convert to farenheit and compensate for the km -> miles conversion the diplay will do\n\t\t// F_miles = (C * 9/5 + 32) * 161 / 100\n\t\t// Approximistation:\n\t\t// F_miles = 2.9C + 50.5\n\n\t\tvalue = ((290u * value) + 5050u) / 100u;\n\t}\r\n#elif DISPLAY_RANGE_FIELD_DATA == DISPLAY_RANGE_FIELD_POWER\r\n\tif (app_get_lights())\r\n\t{\r\n\t\tvalue = motor_get_battery_current_x10();\r\n\t}\r\n\telse\r\n\t{\r\n\t\tuint16_t max_current_amp_x10 = g_config.max_current_amps * 10;\r\n\t\tvalue = MAP32(motor_get_target_current(), 0, 100, 0, max_current_amp_x10);\r\n\t}\r\n\r\n\tif (g_config.use_freedom_units)\r\n\t{\r\n\t\t// compensate for km -> miles conversion the display will do\r\n\t\tvalue = (value * 161u) / 100u;\r\n\t}\r\n#endif\r\n\n\tuint8_t checksum = 0;\n\n\twrite_uart_and_increment_checksum((uint8_t)(value >> 8), &checksum);\n\twrite_uart_and_increment_checksum((uint8_t)value, &checksum);\n\tuart_write(checksum); // checksum\n\n\treturn 3;\n}\n\nstatic int16_t process_bafang_display_read_calories()\n{\n\tif (msg_len < 3)\n\t{\n\t\treturn KEEP;\n\t}\n\n\tuint8_t checksum = 0;\n\n\t// send battery voltage x10 to show in calories field\n\tuint16_t volt = motor_get_battery_voltage_x10();\n\n\twrite_uart_and_increment_checksum(volt >> 8, & checksum);\n\twrite_uart_and_increment_checksum(volt & 0xff, & checksum);\n\tuart_write(checksum); // checksum\n\n\treturn 3;\n}\n\nstatic int16_t process_bafang_display_read_unknown3()\n{\n\tif (msg_len < 3)\n\t{\n\t\treturn KEEP;\n\t}\n\n\tuart_write(0x00);\n\tuart_write(0x00);\n\tuart_write(0x00);\n\tuart_write(0x00);\n\tuart_write(0x00); // checksum\n\n\treturn 3;\n}\n\nstatic int16_t process_bafang_display_read_moving()\n{\n\tif (msg_len < 2)\n\t{\n\t\treturn KEEP;\n\t}\n\n\tuint8_t data = speed_sensor_is_moving() ? 0x31 : 0x30;\n\tuart_write(data);\n\tuart_write(data); // checksum\n\n\treturn 2;\n}\n\n\nstatic int16_t process_bafang_display_write_pas()\n{\n\tif (msg_len < 4)\n\t{\n\t\treturn KEEP;\n\t}\r\n\r\n\tif (compute_checksum(msgbuf, 3) == msgbuf[3])\r\n\t{\r\n\t\tswitch (msgbuf[2])\n\t\t{\n\t\tcase 0x00:\r\n\t\t\tapp_set_assist_level(ASSIST_0);\n\t\t\tbreak;\n\t\tcase 0x01:\n\t\t\tapp_set_assist_level(ASSIST_1);\n\t\t\tbreak;\n\t\tcase 0x0b:\n\t\t\tapp_set_assist_level(ASSIST_2);\n\t\t\tbreak;\n\t\tcase 0x0c:\n\t\t\tapp_set_assist_level(ASSIST_3);\n\t\t\tbreak;\n\t\tcase 0x0d:\n\t\t\tapp_set_assist_level(ASSIST_4);\n\t\t\tbreak;\n\t\tcase 0x02:\n\t\t\tapp_set_assist_level(ASSIST_5);\n\t\t\tbreak;\n\t\tcase 0x15:\n\t\t\tapp_set_assist_level(ASSIST_6);\n\t\t\tbreak;\n\t\tcase 0x16:\n\t\t\tapp_set_assist_level(ASSIST_7);\n\t\t\tbreak;\n\t\tcase 0x17:\n\t\t\tapp_set_assist_level(ASSIST_8);\n\t\t\tbreak;\n\t\tcase 0x03:\n\t\t\tapp_set_assist_level(ASSIST_9);\n\t\t\tbreak;\n\t\tcase 0x06:\n\t\t\tapp_set_assist_level(ASSIST_PUSH);\n\t\t\tbreak;\r\n\t\tdefault:\r\n\t\t\t// Unsupported level, ignore\r\n\t\t\tbreak;\n\t\t}\r\n\t}\n\telse\r\n\t{\r\n\t\teventlog_write(EVT_ERROR_EXTCOM_CHEKSUM);\r\n\t\treturn DISCARD;\r\n\t}\n\n\treturn 4;\n}\n\nstatic int16_t process_bafang_display_write_mode()\n{\n\tif (msg_len < 4)\n\t{\n\t\treturn KEEP;\n\t}\n\r\n\tif (compute_checksum(msgbuf, 3) == msgbuf[3])\r\n\t{\r\n\t\tswitch (msgbuf[2])\n\t\t{\n\t\tcase 0x02:\r\n\t\t\tapp_set_operation_mode(OPERATION_MODE_DEFAULT);\n\t\t\tbreak;\n\t\tcase 0x04:\n\t\t\tapp_set_operation_mode(OPERATION_MODE_SPORT);\n\t\t\tbreak;\r\n\t\tdefault:\r\n\t\t\t// Unsupported mode, ignore\r\n\t\t\tbreak;\n\t\t}\r\n\t}\r\n\telse\r\n\t{\r\n\t\teventlog_write(EVT_ERROR_EXTCOM_CHEKSUM);\r\n\t\treturn DISCARD;\r\n\t}\n\n\treturn 4;\n}\n\nstatic int16_t process_bafang_display_write_lights()\n{\n\tif (msg_len < 3)\n\t{\n\t\treturn KEEP;\n\t}\n\r\n\t// No checksum\r\n\n\tswitch (msgbuf[2])\n\t{\n\tcase 0xf0:\n\t\tapp_set_lights(false);\n\t\tbreak;\n\tcase 0xf1:\n\t\tapp_set_lights(true);\n\t\tbreak;\r\n\tdefault:\r\n\t\treturn DISCARD; // unsupported state, assume communication error\n\t}\n\n\treturn 3;\n}\n\nstatic int16_t process_bafang_display_write_speed_limit()\n{\n\tif (msg_len < 5)\n\t{\n\t\treturn KEEP;\n\t}\n\r\n\t/*\n\tif (compute_checksum(msgbuf, 4) == msgbuf[4])\n\t{\n\t\t // Ignoring speed limit requested by display,\n\t\t // Global speed limit is configured in firmware config tool.\n\t\t \n\t\t uint16_t value = ((msgbuf[2] << 8) | msgbuf[3]);\n\t\t app_set_wheel_max_speed_rpm(value);\n\t}\r\n\telse\r\n\t{\r\n\t\teventlog_write(EVT_ERROR_EXTCOM_CHEKSUM);\r\n\t\treturn DISCARD;\r\n\t}\r\n\t*/\n\n\treturn 5;\n}\n"
  },
  {
    "path": "src/firmware/extcom.h",
    "content": "/*\n * bbs-fw\n *\n * Copyright (C) Daniel Nilsson, 2022.\n *\n * Released under the GPL License, Version 3\n */\n\n#ifndef _EXTCOM_H_\n#define _EXTCOM_H_\n\nvoid extcom_init();\nvoid extcom_process();\n\n#endif\n\n"
  },
  {
    "path": "src/firmware/fwconfig.h",
    "content": "/*\r\n * bbs-fw\r\n *\r\n * Copyright (C) Daniel Nilsson, 2022.\r\n *\r\n * Released under the GPL License, Version 3\r\n */\r\n#ifndef _FWCONFIG_H_\r\n#define _FWCONFIG_H_\r\n\r\n#if defined(BBSHD)\r\n\t#define HAS_MOTOR_TEMP_SENSOR\t\t\t\t1\r\n#else\r\n\t#define HAS_MOTOR_TEMP_SENSOR\t\t\t\t0\r\n#endif\r\n\r\n\r\n#if defined(BBSHD) || defined(BBS02)\r\n\t#define HAS_CONTROLLER_TEMP_SENSOR\t\t\t1\r\n#else\r\n\t#define HAS_CONTROLLER_TEMP_SENSOR\t\t\t0\r\n#endif\r\n\r\n\r\n#if defined(TSDZ2)\r\n\t#define HAS_TORQUE_SENSOR\t\t\t\t\t1\r\n#else\r\n\t#define HAS_TORQUE_SENSOR\t\t\t\t\t0\r\n#endif\r\n\r\n#if defined(BBSHD) || defined(BBS02)\r\n\t#define HAS_SHIFT_SENSOR_SUPPORT\t\t\t1\r\n#else\r\n\t#define HAS_SHIFT_SENSOR_SUPPORT\t\t\t0\r\n#endif\r\n\r\n#if defined(BBS02)\r\n\t#define MAX_CADENCE_RPM_X10\t\t\t\t\t1500\r\n#elif defined(BBSHD)\r\n\t// Measured on BBSHD at 48V\r\n\t#define MAX_CADENCE_RPM_X10\t\t\t\t\t1680\r\n#else\r\n\t#define MAX_CADENCE_RPM_X10\t\t\t\t\t1200\r\n#endif\r\n\r\n#if defined(BBS02) || defined(BBSHD)\r\n\t#define PAS_PULSES_REVOLUTION\t\t\t\t24\r\n#elif defined(TSDZ2)\r\n\t#define PAS_PULSES_REVOLUTION\t\t\t\t20\r\n#endif\r\n\r\n // Applied to both motor and controller tmeperature sensor\r\n#define MAX_TEMPERATURE\t\t\t\t\t\t\t85\r\n\r\n// Current ramp down starts at MAX_TEMPERATURE - 5.\r\n#define MAX_TEMPERATURE_RAMP_DOWN_INTERVAL\t\t5\r\n\r\n// Maximum allowed motor current in percent of maximum configured current (A)\r\n// to still apply when maximum temperature has been reached.\r\n// Motor current is ramped down linearly until this value when approaching\r\n// max temperature.\r\n#define MAX_TEMPERATURE_LOW_CURRENT_PERCENT\t\t20\r\n\r\n// No battery percent mapping\r\n#define BATTERY_PERCENT_MAP_NONE\t\t\t\t0\r\n// Map battery percent to provide a linear relationship on the\r\n// 5-bar battery indicator of the SW102 display. \r\n#define BATTERY_PERCENT_MAP_SW102\t\t\t\t1\r\n\r\n// Select battery percent mapping\r\n#define BATTERY_PERCENT_MAP\t\t\t\t\t\tBATTERY_PERCENT_MAP_NONE\r\n\r\n// Time with no motor load until battery voltage is updated to avoid voltage sag.\r\n#define BATTERY_NO_LOAD_DELAY_MS\t\t2000\r\n\r\n// Padding values for voltage range of battery.\r\n#define BATTERY_FULL_OFFSET_PERCENT\t\t8\r\n#define BATTERY_EMPTY_OFFSET_PERCENT\t8\r\n\r\n// Battery SOC percentage when current ramp down starts.\r\n#define LVC_RAMP_DOWN_OFFSET_PERCENT\t\t\t10\r\n\r\n// Maximum allowed motor current in percent of maximum configured current (A)\r\n// to still apply when 0% battery has been reached.\r\n// Motor current is ramped down linearly until this value when approaching \"empty\".\r\n#define LVC_LOW_CURRENT_PERCENT\t\t\t\t\t20\r\n\r\n// Size of speed limit ramp down interval.\r\n// If max speed is 50 and this is set to 3 then the\r\n// target current will start ramping down when passing 47\r\n// and be at 50% of assist target current when reaching 50.\r\n#define SPEED_LIMIT_RAMP_DOWN_INTERVAL_KPH\t\t3\r\n\r\n// Current ramp down (e.g. when releasing throttle, stop pedaling etc.) in percent per 10 millisecond.\r\n// Specifying 1 will make ramp down periond 1 second if releasing from full throttle.\r\n// Set to 100 to disable\r\n#define CURRENT_RAMP_DOWN_PERCENT_10MS\t\t\t5\r\n\r\n// Target speed in km/h when walk mode is engaged\r\n#define WALK_MODE_SPEED_KPH\t\t\t\t\t\t4\r\n\r\n\r\n#define THROTTLE_RESPONSE_LINEAR\t\t\t\t1\r\n#define THROTTLE_RESPONSE_QUADRATIC\t\t\t\t2\r\n#define THROTTLE_RESPONSE_CUSTOM\t\t\t\t3\r\n\r\n#define THROTTLE_RESPONSE_CURVE\t\t\t\t\tTHROTTLE_RESPONSE_CUSTOM\r\n\r\n// Custom throttle map\r\n// y = pow(x / 100.0, 1.5) * 100.0\r\n#define THROTTLE_CUSTOM_MAP\t\t\t\t\t\t\\\r\n\t0,  1,  1,  1,  2,  2,  2,  3,  3,  3,\t\t\\\r\n\t4,  4,  4,  5,  5,  6,  6,  7,  8,  8,\t\t\\\r\n\t9,  10, 10, 11, 12, 12, 13, 14, 15, 16,\t\t\\\r\n\t16, 17, 18, 19, 20, 21, 22, 23, 23, 24,\t\t\\\r\n\t25, 26, 27, 28, 29, 30, 31, 32, 33, 34,\t\t\\\r\n\t35, 36, 37, 39, 40, 41, 42, 43, 44, 45,\t\t\\\r\n\t46, 48, 49, 50, 51, 52, 54, 55, 56, 57,\t\t\\\r\n\t59, 60, 61, 62, 64, 65, 66, 68, 69, 70,\t\t\\\r\n\t72, 73, 74, 76, 77, 78, 80, 81, 83, 84,\t\t\\\r\n\t85, 87, 88, 90, 91, 93, 94, 96, 97, 99,\t\t\\\r\n\t100\r\n\t\r\n\r\n// This value is used when assist level is configured with throttle cadence\r\n// override flag in config tool. Default is 100%.\r\n#define THROTTLE_CADENCE_OVERRIDE_PERCENT\t\t100\r\n\r\n// Lower limit for cadence rpm in power calculation\r\n// for torque pas assist. When cadence is below this\r\n// limit you will get extra power.\r\n//\r\n// power_w = torque_Nm * cadence_rpm * 0.105\r\n//\r\n// The calculated power is then multipled by a factor\r\n// set by the assist level to get the final power which\r\n// the motor will contribute.\r\n//\r\n// The value configured below is the minimum value for\r\n// cadence_rpm to be used in the formula above. If the\r\n// actual cadence is lower it will be overriden by this\r\n// configured value.\r\n#define TORQUE_POWER_LOWER_RPM_X10\t\t\t\t300\r\n\r\n// Number of PAS sensor pulses to engage cruise mode,\r\n// there are 24 pulses per revolution.\r\n#define CRUISE_ENGAGE_PAS_PULSES\t\t\t\tPAS_PULSES_REVOLUTION / 2\r\n\r\n// Number of PAS sensor pulses to disengage curise mode\r\n// by pedaling backwards.\r\n#define CRUISE_DISENGAGE_PAS_PULSES\t\t\t\tPAS_PULSES_REVOLUTION / 2\r\n\r\n\r\n// Option to control what data is displayed in \"Range\" field on display\r\n// since range calculation is not implemented.\r\n#define DISPLAY_RANGE_FIELD_ZERO\t\t\t\t0\r\n#define DISPLAY_RANGE_FIELD_TEMPERATURE\t\t\t1\t// max temperature of controller / motor\r\n#define DISPLAY_RANGE_FIELD_POWER\t\t\t\t2\t// requested current x10 (lights off) / actual current x10 (lights on)\r\n\r\n// uncomment and select option above\r\n// #define DISPLAY_RANGE_FIELD_DATA\t\tDISPLAY_RANGE_FIELD_ZERO\r\n\r\n// default to temperature if temperature sensors available (BBS2/BBSHD), else power (TSDZ2)\r\n#ifndef DISPLAY_RANGE_FIELD_DATA\r\n\t#if HAS_CONTROLLER_TEMP_SENSOR || HAS_MOTOR_TEMP_SENSOR\r\n\t#define DISPLAY_RANGE_FIELD_DATA\t\tDISPLAY_RANGE_FIELD_TEMPERATURE\r\n\t#else\r\n\t#define DISPLAY_RANGE_FIELD_DATA\t\tDISPLAY_RANGE_FIELD_POWER\r\n\t#endif\r\n#endif \r\n\r\n#endif\r\n"
  },
  {
    "path": "src/firmware/intellisense.h",
    "content": "#ifndef _INTELLISENSE_H_\n#define _INTELLISENSE_H_\n\n// NOTE:\n// The defines below are here to keep IntelliSense \n// in Visual Studio happy and not throw incorrect errors.\n\n#if !defined (SDCC) && !defined (__SDCC)\n\n#define INTERRUPT(name, vector)\t\t\t\t\tvoid name()\n#define INTERRUPT_USING(name, vector,regnum)\tvoid name()\n\n#define __interrupt(vector)\t\t\t\t\t\t\n\n#define enableInterrupts()\n#define disableInterrupts()\n\n#define NOP()\n\n#define _Bool uint8_t\n\n#endif\n\n#endif\n"
  },
  {
    "path": "src/firmware/interrupt.h",
    "content": "/*\n * bbs-fw\n *\n * Copyright (C) Daniel Nilsson, 2022.\n *\n * Released under the GPL License, Version 3\n */\n\n#ifndef  _INTERRUPT_H_\n#define _INTERRUPT_H_\n\n// Interrupt rouines declarations required to be included from main.c\n#if defined(BBSHD) || defined(BBS02)\n#include \"bbsx/interrupt.h\"\n#elif defined(TSDZ2)\n#include \"tsdz2/interrupt.h\"\n#endif\n\n#endif\n"
  },
  {
    "path": "src/firmware/lights.h",
    "content": "/*\r\n * bbs-fw\r\n *\r\n * Copyright (C) Daniel Nilsson, 2022.\r\n *\r\n * Released under the GPL License, Version 3\r\n */\r\n\r\n#ifndef _LIGHTS_H_\r\n#define _LIGHTS_H_\r\n\r\n#include \"intellisense.h\"\r\n#include <stdint.h>\r\n#include <stdbool.h>\r\n\r\nvoid lights_init();\r\n\r\nvoid lights_enable();\r\nvoid lights_disable();\r\n\r\nvoid lights_set(bool on);\r\n\r\n#endif\r\n"
  },
  {
    "path": "src/firmware/main.c",
    "content": "/*\n * bbs-fw\n *\n * Copyright (C) Daniel Nilsson, 2022.\n *\n * Released under the GPL License, Version 3\n */\n\n#include \"interrupt.h\" // IMPORTANT: interrupt vector declarations must be included from main.c!\n#include \"timers.h\"\n#include \"system.h\"\n#include \"eeprom.h\"\n#include \"cfgstore.h\"\n#include \"eventlog.h\"\n#include \"app.h\"\n#include \"battery.h\"\n#include \"watchdog.h\"\n#include \"adc.h\"\n#include \"motor.h\"\n#include \"extcom.h\"\n#include \"sensors.h\"\n#include \"throttle.h\"\n#include \"lights.h\"\n#include \"uart.h\"\n#include \"util.h\"\n\n#define APP_PROCESS_INTERVAL_MS\t\t5\n\nvoid main(void)\n{\n\tmotor_pre_init();\n\n\twatchdog_init();\n\ttimers_init();\n\tsystem_init();\n\n\teventlog_init(false);\n\textcom_init();\n\n\tif (watchdog_triggered())\n\t{\n\t\t// force write watchdog reset to eventlog\n\t\tbool prev = eventlog_is_enabled();\n\t\teventlog_set_enabled(true);\n\t\teventlog_write(EVT_ERROR_WATCHDOG_TRIGGERED);\n\t\teventlog_set_enabled(prev);\n\t}\n\n\teeprom_init();\n\tcfgstore_init();\n\n\tadc_init();\n\tsensors_init();\n\n\tspeed_sensor_set_signals_per_rpm(g_config.speed_sensor_signals);\n\tpas_set_stop_delay((uint16_t)g_config.pas_stop_delay_x100s * 10);\n\n\tbattery_init();\n\tthrottle_init(\n\t\tEXPAND_U16(g_config.throttle_start_voltage_mv_u16h, g_config.throttle_start_voltage_mv_u16l),\n\t\tEXPAND_U16(g_config.throttle_end_voltage_mv_u16h, g_config.throttle_end_voltage_mv_u16l)\n\t);\n\n\tmotor_init(g_config.max_current_amps * 1000, g_config.low_cut_off_v,\n\t\tEXPAND_I16(g_pstate.adc_voltage_calibration_steps_x100_i16h, g_pstate.adc_voltage_calibration_steps_x100_i16l));\n\n\tlights_init();\n\n\tapp_init();\n\n\tuint32_t next_app_proccess = system_ms();\n\twhile (1)\n\t{\n\t\tuint32_t now = system_ms();\n\t\n\t\tadc_process();\n\t\tmotor_process();\n\n\t\tif (now >= next_app_proccess)\n\t\t{\n\t\t\tnext_app_proccess = now + APP_PROCESS_INTERVAL_MS;\n\n\t\t\tbattery_process();\n\t\t\tsensors_process();\n\t\t\textcom_process();\n\t\t\tapp_process();\n\t\t}\n\n\t\twatchdog_yeild();\n\t}\n}\n"
  },
  {
    "path": "src/firmware/motor.h",
    "content": "/*\n * bbs-fw\n *\n * Copyright (C) Daniel Nilsson, 2022.\n *\n * Released under the GPL License, Version 3\n */\n\n#ifndef _MOTOR_H_\n#define _MOTOR_H_\n\n#include <stdint.h>\n\n#define MOTOR_ERROR_LVC\t\t\t\t0x0800\n#define MOTOR_ERROR_HALL_SENSOR\t\t0x2000\n#define MOTOR_ERROR_CURRENT_SENSE\t0x0004\n#define MOTOR_ERROR_POWER_RESET\t\t0x0020\n\nvoid motor_pre_init();\nvoid motor_init(uint16_t max_current_mA, uint8_t lvc_V, int16_t adc_calib_volt_step_offset);\n\nvoid motor_process();\n\nvoid motor_enable();\nvoid motor_disable();\n\nuint16_t motor_status();\nuint8_t motor_get_target_speed();\nuint8_t motor_get_target_current();\n\nvoid motor_set_target_speed(uint8_t percent);\nvoid motor_set_target_current(uint8_t percent);\n\nint16_t motor_calibrate_battery_voltage(uint16_t actual_voltage_x100);\n\nuint16_t motor_get_battery_lvc_x10();\nuint16_t motor_get_battery_current_x10();\nuint16_t motor_get_battery_voltage_x10();\n\n#endif\n"
  },
  {
    "path": "src/firmware/sensors.h",
    "content": "/*\n * bbs-fw\n *\n * Copyright (C) Daniel Nilsson, 2022.\n *\n * Released under the GPL License, Version 3\n */\n\n#ifndef _SENSORS_H_\n#define _SENSORS_H_\n\n#include \"intellisense.h\"\n\n#include <stdint.h>\n#include <stdbool.h>\n\nvoid sensors_init();\nvoid sensors_process();\n\nvoid pas_set_stop_delay(uint16_t delay_ms);\nuint16_t pas_get_cadence_rpm_x10();\nuint16_t pas_get_pulse_counter();\nbool pas_is_pedaling_forwards();\nbool pas_is_pedaling_backwards();\n\nvoid speed_sensor_set_signals_per_rpm(uint8_t num_signals);\nbool speed_sensor_is_moving();\nuint16_t speed_sensor_get_rpm_x10();\n\nuint16_t torque_sensor_get_nm_x100();\nbool torque_sensor_ok();\n\nint16_t temperature_contr_x100();\nint16_t temperature_motor_x100();\n\nbool brake_is_activated();\nbool shift_sensor_is_activated();\n\n#endif\n"
  },
  {
    "path": "src/firmware/system.h",
    "content": "/*\n * bbs-fw\n *\n * Copyright (C) Daniel Nilsson, 2022.\n *\n * Released under the GPL License, Version 3\n */\n\n#ifndef _SYSTEM_H_\n#define _SYSTEM_H_\n\n#include \"version.h\"\n\n#include <stdint.h>\n\n#if defined(BBSHD) || defined(BBS02)\n#include \"bbsx/cpu.h\"\n#elif defined(TSDZ2)\n#include \"tsdz2/cpu.h\"\n#endif\n\nvoid system_init();\n\nuint32_t system_ms();\nvoid system_delay_ms(uint16_t ms);\n\n#endif\n\n"
  },
  {
    "path": "src/firmware/throttle.c",
    "content": "/*\r\n * bbs-fw\r\n *\r\n * Copyright (C) Daniel Nilsson, 2022.\r\n *\r\n * Released under the GPL License, Version 3\r\n */\r\n\r\n#include \"throttle.h\"\r\n#include \"intellisense.h\"\r\n#include \"system.h\"\r\n#include \"eventlog.h\"\r\n#include \"util.h\"\r\n#include \"adc.h\"\r\n#include \"fwconfig.h\"\r\n\r\n#include <stdbool.h>\r\n\r\nstatic uint8_t min_voltage_adc;\r\nstatic uint8_t max_voltage_adc;\r\n\r\nstatic bool throttle_detected;\r\nstatic bool throttle_low_ok;\r\nstatic bool throttle_hard_ok;\r\nstatic uint32_t throttle_hard_limit_hit_at;\r\n\r\n\r\n//#define LOG_THROTTLE_ADC\r\n\r\n#define ADC_VOLTAGE_MV\t\t\t\t\t\t5000ul\r\n\r\n#define THROTTLE_HARD_LOW_LIMIT_MV\t\t\t500ul\r\n#define THROTTLE_HARD_HIGH_LIMIT_MV\t\t\t4500ul\r\n\r\n#define THROTTLE_HARD_LOW_LIMIT_ADC\t\t\t((THROTTLE_HARD_LOW_LIMIT_MV * 256) / ADC_VOLTAGE_MV)\r\n#define THROTTLE_HARD_HIGH_LIMIT_ADC\t\t((THROTTLE_HARD_HIGH_LIMIT_MV * 256) / ADC_VOLTAGE_MV)\r\n#define THROTTLE_HARD_LIMIT_TOLERANCE_MS\t100\r\n\r\n#if (THROTTLE_RESPONSE_CURVE == THROTTLE_RESPONSE_CUSTOM)\r\nstatic const uint8_t throttle_custom_map_lut[101] =\r\n{\r\n\tTHROTTLE_CUSTOM_MAP\r\n};\r\n#endif\r\n\r\n\r\n\r\nvoid throttle_init(uint16_t min_mv, uint16_t max_mv)\r\n{\r\n\tmin_voltage_adc = (uint8_t)(((uint32_t)min_mv * 256) / ADC_VOLTAGE_MV);\r\n\tmax_voltage_adc = (uint8_t)(((uint32_t)max_mv * 256) / ADC_VOLTAGE_MV);\r\n\tthrottle_detected = false;\r\n\tthrottle_low_ok = false;\r\n\tthrottle_hard_ok = true;\r\n\tthrottle_hard_limit_hit_at = 0;\r\n}\r\n\r\nbool throttle_ok()\r\n{\r\n\treturn !throttle_detected || (throttle_low_ok && throttle_hard_ok);\r\n}\r\n\r\nuint8_t throttle_read()\r\n{\r\n\tstatic uint8_t throttle_percent = 0;\r\n\r\n\tint16_t value = adc_get_throttle();\r\n\r\n#ifdef LOG_THROTTLE_ADC\r\n\tstatic uint8_t last_logged_throttle_adc = 0;\t\r\n\tif (ABS(value - last_logged_throttle_adc) > 1)\r\n\t{\r\n\t\tlast_logged_throttle_adc = value;\r\n\t\teventlog_write_data(EVT_DATA_THROTTLE_ADC, value);\t\t\r\n\t}\r\n#endif\r\n\t\r\n\tif (value < THROTTLE_HARD_LOW_LIMIT_ADC || value > THROTTLE_HARD_HIGH_LIMIT_ADC)\r\n\t{\r\n\t\t// allow invalid throttle input value for a number of milliseconds before reporting throttle error.\r\n\t\tif (throttle_hard_limit_hit_at != 0)\r\n\t\t{\r\n\t\t\tif (throttle_hard_ok && (system_ms() - throttle_hard_limit_hit_at) > THROTTLE_HARD_LIMIT_TOLERANCE_MS)\r\n\t\t\t{\r\n\t\t\t\tif (throttle_detected && value < THROTTLE_HARD_LOW_LIMIT_ADC)\r\n\t\t\t\t{\r\n\t\t\t\t\teventlog_write(EVT_ERROR_THROTTLE_LOW_LIMIT);\r\n\t\t\t\t}\r\n\t\t\t\telse if (value > THROTTLE_HARD_HIGH_LIMIT_ADC)\r\n\t\t\t\t{\r\n\t\t\t\t\teventlog_write(EVT_ERROR_THROTTLE_HIGH_LIMIT);\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\tthrottle_hard_ok = false;\r\n\t\t\t}\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tthrottle_hard_limit_hit_at = system_ms();\r\n\t\t}\r\n\t}\r\n\telse\r\n\t{\r\n\t\tif (value >= THROTTLE_HARD_LOW_LIMIT_ADC)\r\n\t\t{\r\n\t\t\tthrottle_detected = true;\r\n\t\t}\r\n\r\n\t\tthrottle_hard_limit_hit_at = 0;\r\n\t\tthrottle_hard_ok = true;\r\n\t}\r\n\r\n\tif (value < min_voltage_adc)\r\n\t{\r\n\t\t// throttle is considered not working until it has given a signal below minimum\r\n\t\t// configured value but more than 0.\r\n\t\tthrottle_low_ok = true;\r\n\r\n\t\t// hysteresis\r\n\t\tif (throttle_percent > 0)\r\n\t\t{\r\n\t\t\tvalue += 1;\r\n\t\t}\r\n\r\n\t\tif (value < min_voltage_adc)\r\n\t\t{\r\n\t\t\tthrottle_percent = 0;\r\n\t\t\treturn throttle_percent;\r\n\t\t}\r\n\t}\r\n\r\n\tif (value > max_voltage_adc)\r\n\t{\r\n\t\tvalue = max_voltage_adc;\r\n\t}\r\n\r\n\tthrottle_percent = (uint8_t)MAP16(value, min_voltage_adc, max_voltage_adc, 1, 100);\r\n\r\n\treturn throttle_percent;\r\n}\r\n\r\n\r\nuint8_t throttle_map_response(uint8_t throttle_percent)\r\n{\r\n#if (THROTTLE_RESPONSE_CURVE == THROTTLE_RESPONSE_QUADRATIC)\r\n\treturn (uint8_t)(((uint16_t)throttle_percent * throttle_percent) / 100);\r\n#elif (THROTTLE_RESPONSE_CURVE == THROTTLE_RESPONSE_CUSTOM)\r\n\treturn throttle_custom_map_lut[throttle_percent];\r\n#else\r\n\treturn throttle_percent;\r\n#endif\r\n}\r\n"
  },
  {
    "path": "src/firmware/throttle.h",
    "content": "/*\r\n * bbs-fw\r\n *\r\n * Copyright (C) Daniel Nilsson, 2022.\r\n *\r\n * Released under the GPL License, Version 3\r\n */\r\n\r\n#ifndef _THROTTLE_H_\r\n#define _THROTTLE_H_\r\n\r\n#include \"intellisense.h\"\r\n#include <stdint.h>\r\n#include <stdbool.h>\r\n\r\nvoid throttle_init(uint16_t min_mv, uint16_t max_mv);\r\n\r\nbool throttle_ok();\r\nuint8_t throttle_read();\r\n\r\nuint8_t throttle_map_response(uint8_t throttle_percent);\r\n\r\n#endif\r\n\r\n"
  },
  {
    "path": "src/firmware/timers.h",
    "content": "/*\n * bbs-fw\n *\n * Copyright (C) Daniel Nilsson, 2022.\n *\n * Released under the GPL License, Version 3\n */\n\n#ifndef _TIMER_H_\n#define _TIMER_H_\n\nvoid timers_init();\n\n#endif\n"
  },
  {
    "path": "src/firmware/tohex.bat",
    "content": "@echo off\npackihx bbs-fw.ihx > bbs-fw.hex"
  },
  {
    "path": "src/firmware/tsdz2/adc.c",
    "content": "/*\r\n * bbs-fw\r\n *\r\n * Copyright (C) Daniel Nilsson, 2022.\r\n *\r\n * Released under the GPL License, Version 3\r\n */\r\n#include <stdint.h>\r\n#include \"adc.h\"\r\n#include \"tsdz2/interrupt.h\"\r\n#include \"tsdz2/stm8.h\"\r\n#include \"tsdz2/pins.h\"\r\n#include \"tsdz2/stm8s/stm8s_adc1.h\"\r\n#include \"tsdz2/stm8s/stm8s.h\"\r\n\r\n\r\nstatic volatile uint8_t adc_throttle;\r\nstatic volatile uint16_t adc_battery_voltage;\r\nstatic volatile uint16_t adc_torque;\r\n\r\n// cached variables read from voltatile uint16_t vars while ADC1 interrupt disabled\r\nstatic uint16_t adc_battery_voltage_cache;\r\nstatic uint16_t adc_torque_cache;\r\n\r\n\r\nvoid adc_init()\r\n{\r\n\tSET_PIN_INPUT(PIN_BATTERY_CURRENT);\r\n\tSET_PIN_INPUT(PIN_BATTERY_VOLTAGE);\r\n\tSET_PIN_INPUT(PIN_THROTTLE);\r\n\tSET_PIN_INPUT(PIN_TORQUE_SENSOR);\r\n\r\n\t// NOTE:\r\n\t// adc configuration (except ADC1->CR1) is overwritten in motor.c/isr_timer1_cmp\r\n\t// which triggeres the conversion.\r\n\t//\r\n\t// The motor control interrupt routines performs single mode\r\n\t// adc conversion of battery current, reads the result and\r\n\t// then starts buffered scan mode conversion of all adc channels\r\n\t// with end of conversion interrupt enabled which is handled here.\r\n\r\n\tADC1->CR1 = ADC1_PRESSEL_FCPU_D2;\r\n\tADC1->CR2 = ADC1_ALIGN_LEFT;\r\n\r\n\t// channel (none)\r\n\tADC1->CSR = 0x00;\r\n\r\n\t// schmittrig disable all\r\n\tADC1->TDRL |= (uint8_t)0xFF;\r\n\tADC1->TDRH |= (uint8_t)0xFF;\r\n\r\n\t// Enable the ADC1 peripheral\r\n\tADC1->CR1 |= ADC1_CR1_ADON;\r\n}\r\n\r\nvoid adc_process()\r\n{\r\n\t// Have to disable interrupts globally since ADC1->CSR register\r\n\t// is manipulated from motor control isr. Very short time, should have no effect.\r\n\tdisableInterrupts();\r\n\tadc_battery_voltage_cache = adc_battery_voltage; // adc_battery_voltage;\r\n\tadc_torque_cache = adc_torque;\r\n\tenableInterrupts();\r\n}\r\n\r\n\r\nuint8_t adc_get_throttle()\r\n{\r\n\t// atomic read\r\n\treturn adc_throttle;\r\n}\r\n\r\nuint16_t adc_get_torque()\r\n{\r\n\t// 10 bit resolution\r\n\treturn adc_torque_cache;\r\n}\r\n\r\nuint16_t adc_get_temperature_contr()\r\n{\r\n\treturn 0;\r\n}\r\n\r\nuint16_t adc_get_temperature_motor()\r\n{\r\n\treturn 0;\r\n}\r\n\r\nuint16_t adc_get_battery_voltage()\r\n{\r\n\treturn adc_battery_voltage_cache;\r\n}\r\n\r\nvoid isr_adc1(void) __interrupt(ITC_IRQ_ADC1)\r\n{\r\n\tif (ADC1->CSR & ADC1_CSR_EOC)\r\n\t{\r\n\t\t// all adc channels converted, data available in buffers\r\n\r\n\t\t// clear EOC and disable EOC interrupt\r\n\t\tADC1->CSR = 0x00;\r\n\r\n\t\t// scan mode reads are setup to be left aligned in motor isr\r\n\r\n\t\t// update cached values\r\n\t\tadc_throttle = ADC1->DB7RH; // only 8bit resolution used\r\n\r\n\t\t// must read in high -> low order according to data sheet\r\n\t\tuint8_t high, low;\r\n\r\n\t\t// read torque\r\n\t\thigh = ADC1->DB4RH;\r\n\t\tlow = ADC1->DB4RL;\r\n\t\tadc_torque = (uint16_t)high << 2 | low;\r\n\r\n\t\t// read battery voltage\r\n\t\thigh = ADC1->DB6RH;\r\n\t\tlow = ADC1->DB6RL;\r\n\t\tadc_battery_voltage = (uint16_t)high << 2 | low;\r\n\t}\r\n}\r\n"
  },
  {
    "path": "src/firmware/tsdz2/cpu.h",
    "content": "/*\n * bbs-fw\n *\n * Copyright (C) Daniel Nilsson, 2022.\n *\n * Released under the GPL License, Version 3\n */\n\n#ifndef _TSDZ2_CPU_H_\n#define _TSDZ2_CPU_H_\n\n#define STM8S105\n#define CPU_FREQ\t16000000L\n\n#endif\n"
  },
  {
    "path": "src/firmware/tsdz2/eeprom.c",
    "content": "/*\n * bbs-fw\n *\n * Copyright (C) Daniel Nilsson, 2022.\n *\n * Released under the GPL License, Version 3\n */\n\n#include \"eeprom.h\"\n#include \"watchdog.h\"\n#include \"tsdz2/cpu.h\"\n#include \"stm8s/stm8s.h\"\n#include \"stm8s/stm8s_flash.h\"\n\n#define EEPROM_START_ADDRESS\t0x4000\n\nstatic uint16_t selected_address;\n\nvoid eeprom_init()\n{\n\tselected_address = EEPROM_START_ADDRESS;\n}\n\nbool eeprom_select_page(int page)\n{\n\tif (page >= 0 && page < 2)\n\t{\n\t\tselected_address = EEPROM_START_ADDRESS + (page * 256);\n\t\treturn true;\n\t}\n\n\treturn false;\n}\n\nint eeprom_read_byte(int offset)\n{\n\tuint8_t* address = (uint8_t*)(selected_address + offset);\n\treturn *address;\n}\n\nbool eeprom_erase_page()\n{\n\treturn true; // not needed\n}\n\nbool eeprom_write_byte(int offset, uint8_t value)\n{\n\tuint8_t* address = (uint8_t*)(selected_address + offset);\n\n\t// disable flash write protection if enabled\n\tif (!(FLASH->IAPSR & FLASH_IAPSR_DUL))\n\t{\n\t\tFLASH->DUKR = FLASH_RASS_KEY2;\n\t\tFLASH->DUKR = FLASH_RASS_KEY1;\n\n\t\twhile (!(FLASH->IAPSR & FLASH_IAPSR_DUL));\n\t}\n\n\twatchdog_yeild(); // :TODO: use faster api to write entire page\n\n\t*address = value;\n\twhile (!(FLASH->IAPSR & FLASH_IAPSR_EOP));\n\n\treturn true;\n}\n\nbool eeprom_end_write()\n{\n\t// enable write protection\n\tFLASH->IAPSR &= ~FLASH_IAPSR_DUL;\n\n\treturn true;\n}\n"
  },
  {
    "path": "src/firmware/tsdz2/interrupt.h",
    "content": "/*\r\n * bbs-fw\r\n *\r\n * Copyright (C) Daniel Nilsson, 2022.\r\n *\r\n * Released under the GPL License, Version 3\r\n */\r\n\r\n#ifndef  _TSDZ2_INTERRUPT_H_\r\n#define _TSDZ2_INTERRUPT_H_\r\n#include \"intellisense.h\"\r\n#include \"tsdz2/cpu.h\"\r\n#include \"tsdz2/stm8s/stm8s_itc.h\"\r\n\r\nvoid isr_timer1_cmp(void) __interrupt(ITC_IRQ_TIM1_CAPCOM); // motor.c\r\nvoid isr_timer3_ovf(void) __interrupt(ITC_IRQ_TIM3_OVF);\t// system.c\r\nvoid isr_timer4_ovf(void) __interrupt(ITC_IRQ_TIM4_OVF);\t// sensors.c\r\n\r\nvoid isr_adc1(void) __interrupt(ITC_IRQ_ADC1);\t\t\t\t// adc.c\r\n\r\nvoid isr_uart2_rx(void) __interrupt(ITC_IRQ_UART2_RX);\t\t// uart.c\r\nvoid isr_uart2_tx(void) __interrupt(ITC_IRQ_UART2_TX);\t\t// uart.c\r\n\r\n#endif\r\n"
  },
  {
    "path": "src/firmware/tsdz2/lights.c",
    "content": "/*\n * bbs-fw\n *\n * Copyright (C) Daniel Nilsson, 2022.\n *\n * Released under the GPL License, Version 3\n */\n\n#include \"lights.h\"\n#include \"stm8.h\"\n#include \"pins.h\"\n\nstatic bool lights_enabled;\nstatic bool lights_on;\n\nvoid lights_init()\n{\n\tSET_PIN_OUTPUT(PIN_LIGHTS);\n\n\tlights_enabled = false;\n\tlights_set(false);\n}\n\nvoid lights_enable()\n{\n\tlights_enabled = true;\n\tlights_set(lights_on);\n}\n\nvoid lights_disable()\n{\n\tlights_enabled = false;\n\tlights_set(lights_on);\n}\n\nvoid lights_set(bool on)\n{\n\tlights_on = on;\n\tif (lights_on && lights_enabled)\n\t{\n\t\tSET_PIN_HIGH(PIN_LIGHTS);\n\t}\n\telse\n\t{\n\t\tSET_PIN_LOW(PIN_LIGHTS);\n\t}\n}\n"
  },
  {
    "path": "src/firmware/tsdz2/motor.c",
    "content": "/*\r\n * TongSheng TSDZ2 motor controller firmware/\r\n *\r\n * Copyright (C) Casainho, 2018.\r\n *\r\n * Released under the GPL License, Version 3\r\n * \r\n * - Original motor control code from TongSheng TSDZ2 motor controller firmware.\r\n * - 9bit motor pwm from fork by Frans-Willem.\r\n * - Cleaned up and integrated into bbs-fw by Daniel Nilsson.\r\n */\r\n#include <stdbool.h>\r\n#include \"motor.h\"\r\n#include \"system.h\"\r\n#include \"uart.h\"\r\n#include \"eventlog.h\"\r\n#include \"util.h\"\r\n#include \"adc.h\"\r\n#include \"tsdz2/cpu.h\"\r\n#include \"tsdz2/timers.h\"\r\n#include \"tsdz2/pins.h\"\r\n#include \"tsdz2/stm8.h\"\r\n#include \"tsdz2/stm8s/stm8s.h\"\r\n#include \"tsdz2/stm8s/stm8s_tim1.h\"\r\n#include \"tsdz2/stm8s/stm8s_itc.h\"\r\n#include \"tsdz2/stm8s/stm8s_adc1.h\"\r\n#include \"tsdz2/stm8s/stm8s_flash.h\"\r\n\r\n\r\n// Motor\r\n// ---------------------------------------------------------------------------------\r\n\r\n// hard current limits\r\n#define MAX_BATTERY_CURRENT_AMPS_X10\t\t200\r\n#define MAX_MOTOR_PHASE_CURRENT_AMPS_X10\t300\r\n\r\n\r\n// Maximum current ramp\r\n// ----------------------------------------------\r\n// Every second has 15625 pwm cycles interrupts,\r\n// one ADC battery current step  -> 0.156 amps:\r\n//\r\n// A / 0.156 = X (we need to do X steps ramp up per second)\r\n// Therefore :\r\n// 15625 / (A / 0.156) => (15625 * 0.156) / A\r\n//\r\n// 20A/s: (15625 * 0.156) / 20 = 135\r\n#define CURRENT_RAMP_UP_INVERSE_STEP\t\t\t135\r\n\r\n// Choose PWM ramp up/down step (higher value will make the motor acceleration slower)\r\n//\r\n// For a 24V battery, 25 for ramp up seems ok. For an higher voltage battery, this values should be higher\r\n#define PWM_DUTY_CYCLE_RAMP_UP_INVERSE_STEP\t\t24\r\n#define PWM_DUTY_CYCLE_RAMP_DOWN_INVERSE_STEP\t28\r\n\r\n// This value should be near 0.\r\n// You can try to tune with the whell on the air, full throttle and look at batttery current: adjust for lower battery current\r\n#define MOTOR_ROTOR_OFFSET_ANGLE\t\t\t\t11\r\n\r\n// This value is ERPS speed after which a transition happens from sinewave no interpolation to have\r\n// interpolation 60 degrees and must be found experimentally\r\n#define MOTOR_ROTOR_ERPS_START_INTERPOLATION_60_DEGREES 10\r\n\r\n#define PWM_CYCLES_COUNTER_MAX\t\t\t\t\t3125U\t// 5 erps minimum speed; 1/5 = 200ms; 200ms/64us = 3125\r\n#define PWM_CYCLES_SECOND\t\t\t\t\t\t15625U\t// 1 / 64us (PWM period)\r\n#define PWM_DUTY_CYCLE_MAX\t\t\t\t\t\t254\r\n#define PWM_DUTY_CYCLE_MIN\t\t\t\t\t\t20\r\n\r\n#define MOTOR_ROTOR_ANGLE_90\t\t\t\t\t(63  + MOTOR_ROTOR_OFFSET_ANGLE)\r\n#define MOTOR_ROTOR_ANGLE_150\t\t\t\t\t(106 + MOTOR_ROTOR_OFFSET_ANGLE)\r\n#define MOTOR_ROTOR_ANGLE_210\t\t\t\t\t(148 + MOTOR_ROTOR_OFFSET_ANGLE)\r\n#define MOTOR_ROTOR_ANGLE_270\t\t\t\t\t(191 + MOTOR_ROTOR_OFFSET_ANGLE)\r\n#define MOTOR_ROTOR_ANGLE_330\t\t\t\t\t(233 + MOTOR_ROTOR_OFFSET_ANGLE)\r\n#define MOTOR_ROTOR_ANGLE_30\t\t\t\t\t(20  + MOTOR_ROTOR_OFFSET_ANGLE)\r\n\r\n// motor maximum rotation\r\n// 700 is equal to 124 cadence, as TSDZ2 has a reduction ratio of 41.8\r\n#define MAX_MOTOR_SPEED_ERPS\t\t\t\t\t700 \r\n\r\n// Set how often the motor speed limit controller runs in the isr\r\n#define SPEED_CONTROLLER_CHECK_PERIODS\t\t\t2000\r\n\r\n// Set how oftern the current controller runs in the isr\r\n#define CURRENT_CONTROLLER_CHECK_PERIODS\t\t14\r\n\r\n// adc measurements\r\n// ------------------------------------------\r\n// 10bit:\t0.086V per step\r\n//\t\t\t0.156A per step\r\n#define ADC_10BIT_VOLTAGE_PER_ADC_STEP_X512\t\t44\r\n#define ADC_10BIT_CURRENT_PER_ADC_STEP_X512\t\t80\r\n\r\n#define ADC_10BIT_STEPS_PER_VOLT_X512\t\t\t5953\r\n\r\n\r\n// filter coefficients\r\n#define BATTERY_CURRENT_FILTER_COEFFICIENT\t\t2\r\n#define PHASE_CURRENT_FILTER_COEFFICIENT\t\t2\r\n#define BATTERY_VOLTAGE_FILTER_COEFFICIENT\t\t2\r\n\r\n\r\n#define SVM_TABLE_LEN\t\t\t\t\t\t\t256\r\n#define SVM_TABLE_MIDDLE\t\t\t\t\t\t127\r\n#define SIN_TABLE_LEN\t\t\t\t\t\t\t60\r\n\r\n // motor states\r\n#define BLOCK_COMMUTATION\t\t\t\t\t\t1\r\n#define SINEWAVE_INTERPOLATION_60_DEGREES\t\t2\r\n\r\n\r\n// index 0-256 to degrees 0-360\r\n// table is -90 degree preadjusted\r\nstatic const uint8_t svm_table[SVM_TABLE_LEN] = {\r\n\t  0,  11,  22,  32,  43,  54,  65,  75,  86,  96, 107, 117, 128, 138, 148, 158,\r\n\t168, 178, 188, 198, 207, 217, 222, 225, 228, 230, 233, 235, 238, 240, 242, 244,\r\n\t245, 247, 248, 250, 251, 252, 252, 253, 253, 254, 254, 254, 254, 254, 253, 253,\r\n\t252, 251, 250, 249, 247, 246, 244, 242, 241, 238, 236, 234, 231, 229, 226, 223,\r\n\t220, 223, 226, 229, 231, 234, 236, 238, 241, 242, 244, 246, 247, 249, 250, 251,\r\n\t252, 253, 253, 254, 254, 254, 254, 254, 253, 253, 252, 252, 251, 250, 248, 247,\r\n\t245, 244, 242, 240, 238, 235, 233, 230, 228, 225, 222, 217, 207, 198, 188, 178,\r\n\t168, 158, 148, 138, 128, 117, 107,  96,  86,  75,  65,  54,  43,  32,  22,  11,\r\n\t  0,  11,  22,  32,  43,  54,  65,  75,  86,  96, 107, 117, 128, 138, 148, 158,\r\n\t168, 178, 188, 198, 207, 217, 222, 225, 228, 230, 233, 235, 238, 240, 242, 244,\r\n\t245, 247, 248, 250, 251, 252, 252, 253, 253, 254, 254, 254, 254, 254, 253, 253,\r\n\t252, 251, 250, 249, 247, 246, 244, 242, 241, 238, 236, 234, 231, 229, 226, 223,\r\n\t220, 223, 226, 229, 231, 234, 236, 238, 241, 242, 244, 246, 247, 249, 250, 251,\r\n\t252, 253, 253, 254, 254, 254, 254, 254, 253, 253, 252, 252, 251, 250, 248, 247,\r\n\t245, 244, 242, 240, 238, 235, 233, 230, 228, 225, 222, 217, 207, 198, 188, 178,\r\n\t168, 158, 148, 138, 128, 117, 107, 96,   86,  75,  65,  54,  43,  32,  22,  11\r\n};\r\n\r\n\r\nstatic const uint8_t sin_table[SIN_TABLE_LEN] =\r\n{\r\n\t  0,   3,   6,   9,  12,  16,  19,  22,  25,  28,  31,  34,  37,  40,  43,\r\n\t 46,  49,  52,  54,  57,  60,  63,  66,  68,  71,  73,  76,  78,  81,  83,\r\n\t 86,  88,  90,  92,  95,  97,  99, 101, 102, 104, 106, 108, 109, 111, 113,\r\n\t114, 115, 117, 118, 119, 120, 121, 122, 123, 124, 125, 125, 126, 126, 127\r\n};\r\n\r\n\r\n// motor control state (shared with isr)\r\n// ------------------------------------------------------\r\n#define CONTROL_STATE_DISABLE\t\t\t0\r\n#define CONTROL_STATE_PREPARE\t\t\t1\r\n#define CONTROL_STATE_START\t\t\t\t2\r\n#define CONTROL_STATE_RUNNING\t\t\t3\r\n\r\n\r\nstatic volatile uint8_t control_state = CONTROL_STATE_DISABLE;\r\nstatic volatile bool is_lvc_triggered = false;\r\nstatic volatile bool hall_sensor_error = false;\r\n\r\n// not atomic, protected by disabling interrupt while read in compute_foc_angle\r\nstatic volatile uint16_t speed_erps = 0; \r\n\r\n// current reading saved in 8 bits for atomic access, not expected to exceed 255 (40A)\r\nstatic volatile uint8_t adc_battery_current = 0;\t\r\nstatic volatile uint8_t adc_phase_current = 0;\r\nstatic volatile uint8_t adc_battery_target_current = 0;\r\n\r\nstatic volatile uint8_t foc_angle = 0;\r\n\r\nstatic volatile uint8_t pwm_duty_cycle = 0;\r\nstatic volatile uint8_t pwm_duty_cycle_target = 0;\r\n\r\n// calculated constant limits (from config)\r\nstatic uint16_t adc_low_voltage_limit = 0;\r\nstatic uint8_t adc_battery_max_current = 0;\r\nstatic uint8_t adc_phase_max_current = 0;\r\n\r\n// ------------------------------------------------------\r\n\r\n// foc angle filter\r\nstatic uint16_t foc_angle_accumulated = 0;\r\n\r\n// battery voltage filter\r\nstatic uint16_t adc_battery_voltage_accumulated = 0;\r\nstatic uint16_t adc_battery_voltage_filtered = 0;\r\n\r\n// battery current filter\r\nstatic uint16_t adc_battery_current_accumulated = 0;\r\nstatic uint16_t adc_battery_current_filtered = 0;\r\n\r\n// motor phase current filter\r\nstatic uint16_t adc_phase_current_accumulated = 0;\r\nstatic uint16_t adc_phase_current_filtered = 0;\r\n\r\nstatic uint16_t lvc_x10V = 0;\r\nstatic uint8_t target_speed_percent = 0;\r\nstatic uint8_t target_current_percent = 0;\r\n\r\nstatic uint16_t adc_steps_per_volt_x512 = ADC_10BIT_STEPS_PER_VOLT_X512;\r\n\r\n\r\nstatic void flash_opt2_afr5()\r\n{\r\n\t// verify if PWM N channels are active on option bytes, if not, enable\r\n\tstatic const uint8_t Value = 0x20;\r\n\r\n\tif (OPT->OPT2 != Value)\r\n\t{\r\n\t\t// unlock data memory\r\n\t\tif (!(FLASH->IAPSR & FLASH_IAPSR_DUL))\r\n\t\t{\r\n\t\t\tFLASH->DUKR = FLASH_RASS_KEY2;\r\n\t\t\tFLASH->DUKR = FLASH_RASS_KEY1;\r\n\r\n\t\t\twhile (!(FLASH->IAPSR & FLASH_IAPSR_DUL));\r\n\t\t}\r\n\r\n\t\t// Enable write access to option bytes \r\n\t\tFLASH->CR2 |= FLASH_CR2_OPT;\r\n\t\tFLASH->NCR2 &= (uint8_t)(~FLASH_NCR2_NOPT);\r\n\r\n\t\t// program option byte and complement\r\n\t\tOPT->OPT2 = Value;\r\n\t\tOPT->NOPT2 = (uint8_t)(~Value);\r\n\r\n\t\twhile (!(FLASH->IAPSR & FLASH_IAPSR_EOP));\r\n\r\n\t\t// Disable write access to option bytes\r\n\t\tFLASH->CR2 &= (uint8_t)(~FLASH_CR2_OPT);\r\n\t\tFLASH->NCR2 |= FLASH_NCR2_NOPT;\r\n\r\n\t\t// lock data memory\r\n\t\tFLASH->IAPSR &= ~FLASH_IAPSR_DUL;\r\n\t}\r\n}\r\n\r\nstatic void read_battery_voltage()\r\n{\r\n\t// low pass filter the voltage readed value, to avoid possible fast spikes/noise\r\n\tadc_battery_voltage_accumulated -= adc_battery_voltage_accumulated >> BATTERY_VOLTAGE_FILTER_COEFFICIENT;\r\n\tadc_battery_voltage_accumulated += adc_get_battery_voltage();\r\n\tadc_battery_voltage_filtered = adc_battery_voltage_accumulated >> BATTERY_VOLTAGE_FILTER_COEFFICIENT;\r\n\r\n\tis_lvc_triggered = (adc_battery_voltage_filtered < adc_low_voltage_limit);\r\n}\r\n\r\nstatic void read_battery_current()\r\n{\r\n\t// low pass filter the positive battery readed value (no regen current), to avoid possible fast spikes/noise\r\n\tadc_battery_current_accumulated -= adc_battery_current_accumulated >> BATTERY_CURRENT_FILTER_COEFFICIENT;\r\n\tadc_battery_current_accumulated += adc_battery_current;\r\n\tadc_battery_current_filtered = adc_battery_current_accumulated >> BATTERY_CURRENT_FILTER_COEFFICIENT;\r\n}\r\n\r\nstatic void read_phase_current()\r\n{\r\n\t// low pass filter the positive motor pahse value (no regen current), to avoid possible fast spikes/noise\r\n\tadc_phase_current_accumulated -= adc_phase_current_accumulated >> PHASE_CURRENT_FILTER_COEFFICIENT;\r\n\tadc_phase_current_accumulated += adc_phase_current;\r\n\tadc_phase_current_filtered = adc_phase_current_accumulated >> PHASE_CURRENT_FILTER_COEFFICIENT;\r\n}\r\n\r\nstatic uint8_t asin_table(uint8_t inverted_angle_x128)\r\n{\r\n\t// calc asin also converts the final result to degrees\r\n\tuint8_t index = 0;\r\n\twhile (index < SIN_TABLE_LEN)\r\n\t{\r\n\t\tif (inverted_angle_x128 < sin_table[index])\r\n\t\t{\r\n\t\t\tbreak;\r\n\t\t}\r\n\r\n\t\tindex++;\r\n\t}\r\n\r\n\t// first value of table is 0 so index will always increment to at least 1 and return 0\r\n\treturn index--;\r\n}\r\n\r\nstatic void compute_foc_angle()\r\n{\r\n\tuint16_t ui16_temp;\r\n\tuint32_t ui32_temp;\r\n\tuint16_t e_phase_voltage;\r\n\tuint32_t i_phase_current_x2;\r\n\tuint32_t l_x1048576;\r\n\tuint32_t w_angular_velocity_x16;\r\n\tuint16_t iwl_128;\r\n\r\n\t// FOC implementation by calculating the angle between phase current and rotor magnetic flux (BEMF)\r\n\t// 1. phase voltage is calculate\r\n\t// 2. I*w*L is calculated, where I is the phase current. L was a measured value for 48V motor.\r\n\t// 3. inverse sin is calculated of (I*w*L) / phase voltage, were we obtain the angle\r\n\t// 4. previous calculated angle is applied to phase voltage vector angle and so the\r\n\t// angle between phase current and rotor magnetic flux (BEMF) is kept at 0 (max torque per amp)\r\n\r\n\t// calc E phase voltage\r\n\tui16_temp = adc_battery_voltage_filtered * ADC_10BIT_VOLTAGE_PER_ADC_STEP_X512;\r\n\tui16_temp = (ui16_temp >> 8) * pwm_duty_cycle;\r\n\te_phase_voltage = ui16_temp >> 9;\r\n\r\n\t// calc I phase current\r\n\tif (pwm_duty_cycle > 10)\r\n\t{\r\n\t\tui16_temp = ((uint16_t)adc_battery_current_filtered) * ADC_10BIT_CURRENT_PER_ADC_STEP_X512;\r\n\t\ti_phase_current_x2 = ui16_temp / pwm_duty_cycle;\r\n\t}\r\n\telse\r\n\t{\r\n\t\ti_phase_current_x2 = 0;\r\n\t}\r\n\r\n\t// calc W angular velocity: erps * 6.3\r\n\t// 101 = 6.3 * 16\r\n\tTIM1->IER &= ~(uint8_t)TIM1_IT_CC4;\r\n\tui16_temp = speed_erps;\r\n\tTIM1->IER |= TIM1_IT_CC4;\r\n\tw_angular_velocity_x16 = ui16_temp * 101;\r\n\r\n\t// ---------------------------------------------------------------------------------------------------------------------\r\n\t// 36 V motor: L = 76uH\r\n\t// 48 V motor: L = 135uH\r\n\t// ui32_l_x1048576 = 142; // 1048576 = 2^20 | 48V\r\n\t// ui32_l_x1048576 = 84; // 1048576 = 2^20 | 36V\r\n\t//\r\n\t// ui32_l_x1048576 = 142 <--- THIS VALUE WAS verified experimentaly on 2018.07 to be near the best value for a 48V motor\r\n\t// Test done with a fixed mechanical load, duty_cycle = 200 and 100 and measured battery current was 16 and 6 (10 and 4 amps)\r\n\t// ---------------------------------------------------------------------------------------------------------------------\r\n\r\n#if 0\r\n\tl_x1048576 = 84; // 36 V motor\r\n#else\r\n\tl_x1048576 = 142; // 48 V motor\r\n#endif\r\n\r\n\t// calc IwL\r\n\tui32_temp = i_phase_current_x2 * l_x1048576;\r\n\tui32_temp *= w_angular_velocity_x16;\r\n\tiwl_128 = ui32_temp >> 18;\r\n\r\n\t// calc FOC angle\r\n\tuint8_t foc_angle_unfiltered = asin_table(iwl_128 / e_phase_voltage);\r\n\r\n\t// low pass filter FOC angle\r\n\tfoc_angle_accumulated -= foc_angle_accumulated >> 4;\r\n\tfoc_angle_accumulated += foc_angle_unfiltered;\r\n\tfoc_angle = foc_angle_accumulated >> 4;\r\n}\r\n\r\n\r\nvoid motor_pre_init()\r\n{\r\n\tSET_PIN_INPUT(PIN_HALL_SENSOR_A);\r\n\tSET_PIN_INPUT(PIN_HALL_SENSOR_B);\r\n\tSET_PIN_INPUT(PIN_HALL_SENSOR_C);\r\n\r\n\tSET_PIN_LOW(PIN_PWM_PHASE_A_LOW);\r\n\tSET_PIN_LOW(PIN_PWM_PHASE_A_HIGH);\r\n\tSET_PIN_LOW(PIN_PWM_PHASE_B_LOW);\r\n\tSET_PIN_LOW(PIN_PWM_PHASE_B_HIGH);\r\n\tSET_PIN_LOW(PIN_PWM_PHASE_C_LOW);\r\n\tSET_PIN_LOW(PIN_PWM_PHASE_C_HIGH);\r\n\r\n\tSET_PIN_OUTPUT(PIN_PWM_PHASE_A_LOW);\r\n\tSET_PIN_OUTPUT(PIN_PWM_PHASE_A_HIGH);\r\n\tSET_PIN_OUTPUT(PIN_PWM_PHASE_B_LOW);\r\n\tSET_PIN_OUTPUT(PIN_PWM_PHASE_B_HIGH);\r\n\tSET_PIN_OUTPUT(PIN_PWM_PHASE_C_LOW);\t\r\n\tSET_PIN_OUTPUT(PIN_PWM_PHASE_C_HIGH);\r\n}\r\n\r\nvoid motor_init(uint16_t max_current_mA, uint8_t lvc_V, int16_t adc_calib_volt_step_offset)\r\n{\r\n\tlvc_x10V = lvc_V * 10;\r\n\r\n\tuint32_t max_current_x10A = max_current_mA / 100;\r\n\r\n\tadc_steps_per_volt_x512 = ADC_10BIT_STEPS_PER_VOLT_X512 + adc_calib_volt_step_offset;\r\n\r\n\t// compute hard current limits (not changed after here)\r\n\tadc_battery_max_current = (uint8_t)(\r\n\t\t((((uint32_t)MIN(max_current_x10A, MAX_BATTERY_CURRENT_AMPS_X10)) * 512) / 10) / ADC_10BIT_CURRENT_PER_ADC_STEP_X512\r\n\t);\r\n\r\n\tadc_phase_max_current = (uint8_t)(\r\n\t\t((((uint32_t)MAX_MOTOR_PHASE_CURRENT_AMPS_X10) * 512) / 10) / ADC_10BIT_CURRENT_PER_ADC_STEP_X512\r\n\t);\r\n\r\n\tadc_low_voltage_limit = (uint16_t)((((uint32_t)lvc_V) * adc_steps_per_volt_x512) / 512);\r\n\r\n\tflash_opt2_afr5();\r\n\ttimer1_init_motor_pwm();\r\n\tmotor_disable();\r\n}\r\n\r\nvoid motor_process()\r\n{\r\n\tread_battery_voltage();\r\n\tread_battery_current();\r\n\tread_phase_current();\r\n\tcompute_foc_angle();\r\n}\r\n\r\n\r\nvoid motor_enable()\r\n{\r\n\tif (control_state == CONTROL_STATE_DISABLE)\r\n\t{\r\n\t\tcontrol_state = CONTROL_STATE_PREPARE;\r\n\t}\r\n}\r\n\r\nvoid motor_disable()\r\n{\r\n\tcontrol_state = CONTROL_STATE_DISABLE;\r\n}\r\n\r\nuint16_t motor_status()\r\n{\r\n\tstatic uint16_t last_status = 0;\r\n\r\n\tuint16_t status = 0;\r\n\tif (hall_sensor_error)\r\n\t\tstatus |= MOTOR_ERROR_HALL_SENSOR;\r\n\r\n\tif (is_lvc_triggered)\r\n\t\tstatus |= MOTOR_ERROR_LVC;\r\n\r\n\tif (status != last_status)\r\n\t{\r\n\t\tlast_status = status;\r\n\t\teventlog_write_data(EVT_DATA_MOTOR_STATUS, status);\r\n\t}\r\n\r\n\treturn status;\r\n}\r\n\r\nuint8_t motor_get_target_speed()\r\n{\r\n\treturn target_speed_percent;\r\n}\r\n\r\nuint8_t motor_get_target_current()\r\n{\r\n\treturn target_current_percent;\r\n}\r\n\r\n\r\nvoid motor_set_target_speed(uint8_t percent)\r\n{\r\n\tif (percent > 100)\r\n\t{\r\n\t\tpercent = 100;\r\n\t}\r\n\r\n\tif (percent != target_speed_percent)\r\n\t{\r\n\t\ttarget_speed_percent = percent;\r\n\t\teventlog_write_data(EVT_DATA_TARGET_SPEED, percent);\r\n\r\n\t\tif (percent == 0)\r\n\t\t{\r\n\t\t\tpwm_duty_cycle_target = 0;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tpwm_duty_cycle_target = (uint8_t)MAP16(percent, 1, 100, PWM_DUTY_CYCLE_MIN, PWM_DUTY_CYCLE_MAX);\r\n\t\t}\r\n\t}\r\n}\r\n\r\nvoid motor_set_target_current(uint8_t percent)\r\n{\r\n\tif (percent > 100)\r\n\t{\r\n\t\tpercent = 100;\r\n\t}\r\n\r\n\tif (percent != target_current_percent)\r\n\t{\r\n\t\ttarget_current_percent = percent;\r\n\t\teventlog_write_data(EVT_DATA_TARGET_CURRENT, percent);\r\n\r\n\t\tadc_battery_target_current = ((uint16_t)percent * adc_battery_max_current) / 100;\r\n\t}\r\n}\r\n\r\nint16_t motor_calibrate_battery_voltage(uint16_t actual_voltage_x100)\r\n{\r\n\tint16_t diff = 0;\r\n\tif (actual_voltage_x100 != 0)\r\n\t{\r\n\t\tuint16_t calibrated_adc_steps_volt_x512 = (uint16_t)(((uint32_t)adc_battery_voltage_filtered * 51200u) / actual_voltage_x100);\r\n\r\n\t\tdiff = calibrated_adc_steps_volt_x512 - ADC_10BIT_STEPS_PER_VOLT_X512;\r\n\t\tadc_steps_per_volt_x512 = calibrated_adc_steps_volt_x512;\r\n\t}\r\n\telse\r\n\t{\r\n\t\t// reset calibration if 0 is received\r\n\t\tadc_steps_per_volt_x512 = ADC_10BIT_STEPS_PER_VOLT_X512;\r\n\t\tdiff = 0;\r\n\t}\r\n\r\n\teventlog_write_data(EVT_DATA_CALIBRATE_VOLTAGE, adc_steps_per_volt_x512);\r\n\r\n\treturn diff;\r\n}\r\n\r\n\r\nuint16_t motor_get_battery_lvc_x10()\r\n{\r\n\treturn lvc_x10V;\r\n}\r\n\r\nuint16_t motor_get_battery_current_x10()\r\n{\r\n\treturn (uint16_t)((((uint32_t)adc_battery_current_filtered * 10) * ADC_10BIT_CURRENT_PER_ADC_STEP_X512) >> 9);\r\n}\r\n\r\nuint16_t motor_get_battery_voltage_x10()\r\n{\r\n\treturn (uint16_t)(((uint32_t)adc_battery_voltage_filtered * 5120) / adc_steps_per_volt_x512);\r\n}\r\n\r\n\r\n// state variables only used by isr\r\n// ---------------------------------------------\r\nstatic uint8_t hall_sensors_state_last = 0;\r\nstatic uint8_t rotor_absolute_angle = 0;\r\nstatic uint8_t half_erps_flag = 0;\r\nstatic uint8_t commutation_type = BLOCK_COMMUTATION;\r\n\r\nstatic uint16_t pwm_duty_cycle_ramp_up_counter = 0;\r\nstatic uint16_t pwm_duty_cycle_ramp_down_counter = 0;\r\n\r\nstatic uint16_t pwm_cycles_counter = 1;\r\nstatic uint16_t pwm_cycles_counter_6 = 1;\r\nstatic uint16_t pwm_cycles_counter_total = 0xffff;\r\n\r\nstatic uint16_t adc_current_ramp_up_counter = 0;\r\nstatic uint8_t current_controller_counter = 0;\r\nstatic uint16_t speed_controller_counter = 0;\r\n\r\nstatic uint8_t adc_battery_ramp_max_current = 0;\r\n\r\n// Measures did with a 24V Q85 328 RPM motor, rotating motor backwards by hand:\r\n// Hall sensor A positive to negative transition | BEMF phase B at max value / top of sinewave\r\n// Hall sensor B positive to negative transition | BEMF phase A at max value / top of sinewave\r\n// Hall sensor C positive to negative transition | BEMF phase C at max value / top of sinewave\r\n\r\n// runs every 64us (PWM frequency)\r\n// Measured on 2022-12-04, the interrupt code takes about 45% of the total 64us\r\nvoid isr_timer1_cmp(void) __interrupt(ITC_IRQ_TIM1_CAPCOM)\r\n{\r\n\t// read battery current adc value, should happen at middle of the pwm duty cycle\r\n\t// no scan, align data right since we are only interested in the 8 lsb.\r\n\tADC1->CR2 = (ADC1_ALIGN_RIGHT);\r\n\r\n\t// disable eoc interrupt, clear EOC flag and select channel 5 (current sense)\r\n\tADC1->CSR = 0x05;\r\n\r\n\t// perform single mode ADC1 conversion\r\n\tADC1->CR1 |= ADC1_CR1_ADON;\r\n\twhile (!(ADC1->CSR & ADC1_CSR_EOC));\r\n\r\n\t// adc current reading is truncated to 8bit since that allows a \r\n\t// range of up to 40A which it is not expected to be surpassed.\r\n\t// check of 8bit overflow and save result, flag is used to limit\r\n\t// current in isr if overflow for some reason would occur.\r\n\tuint8_t adc_battery_current_ovf = ADC1->DRH;\r\n\r\n\t// atomic write (uint8), current is not expected to exceed adc 255 (40A)\r\n\tadc_battery_current = ADC1->DRL;\r\n\r\n\tswitch (control_state)\r\n\t{\r\n\tcase CONTROL_STATE_DISABLE:\r\n\t\t// disable outputs\r\n\t\tTIM1->CCER1 &= ~(uint8_t)(TIM1_CCER1_CC1E | TIM1_CCER1_CC1NE);\t// OC1\r\n\t\tTIM1->CCER1 &= ~(uint8_t)(TIM1_CCER1_CC2E | TIM1_CCER1_CC2NE);\t// OC2\r\n\t\tTIM1->CCER2 &= ~(uint8_t)(TIM1_CCER2_CC3E | TIM1_CCER2_CC3NE);\t// OC3\r\n\t\tbreak;\r\n\tcase CONTROL_STATE_PREPARE:\r\n\t\tif (speed_erps > 0)\r\n\t\t{\r\n\t\t\t// Restart from duty cycle mapped from erps.\r\n\t\t\t// This is probably not the correct way to do this, but\r\n\t\t\t// it seems to work reasonably well. VESC tracks back-emf\r\n\t\t\t// to calculate duty cyle to restart from...\r\n\t\t\tpwm_duty_cycle = (uint8_t)MAP32(speed_erps, 0, MAX_MOTOR_SPEED_ERPS, PWM_DUTY_CYCLE_MIN, PWM_DUTY_CYCLE_MAX);\r\n\t\t}\t\r\n\t\tcontrol_state = CONTROL_STATE_START;\r\n\t\tbreak;\r\n\tcase CONTROL_STATE_START:\r\n\t\t// enable outputs\r\n\t\tTIM1->CCER1 |= (uint8_t)(TIM1_CCER1_CC1E | TIM1_CCER1_CC1NE); \t// OC1\r\n\t\tTIM1->CCER1 |= (uint8_t)(TIM1_CCER1_CC2E | TIM1_CCER1_CC2NE);\t// OC2\r\n\t\tTIM1->CCER2 |= (uint8_t)(TIM1_CCER2_CC3E | TIM1_CCER2_CC3NE);\t// OC3\r\n\t\tcontrol_state = CONTROL_STATE_RUNNING;\r\n\t\tbreak;\r\n\tdefault:\r\n\t\tbreak;\r\n\t}\r\n\r\n\t// calculate motor current adc value\r\n\tif (pwm_duty_cycle > 0)\r\n\t{\r\n\t\t// atomic write (uint8), current is not expected to exceed adc 255 (40A)\r\n\t\tadc_phase_current = (uint8_t)((adc_battery_current * 256u) / pwm_duty_cycle);\r\n\t}\r\n\telse\r\n\t{\r\n\t\tadc_phase_current = 0;\r\n\t}\r\n\r\n\t// trigger adc conversion of all channels (scan conversion, buffered)\r\n\t// adc scan mode conversion will finish before\r\n\t// this motor control interrupt will be run next time\r\n\t// \r\n\t// enable scan, align left\r\n\tADC1->CR2 = (ADC1_ALIGN_LEFT | ADC1_CR2_SCAN);\r\n\r\n\t// clear EOC flag, enable eoc interrupt, scan read all channel 0-7\r\n\tADC1->CSR = (ADC1_CSR_EOCIE | 0x07);\r\n\r\n\t// start adc scan mode conversion\r\n\tADC1->CR1 |= ADC1_CR1_ADON;\r\n\r\n\r\n\t// read hall sensor signals\r\n\t// find the motor rotor absolute angle\r\n\t// calc motor speed in erps (speed_erps)\r\n\r\n\t// read hall sensors signal pins and mask other pins\r\n\t// hall sensors sequence with motor forward rotation: 4, 6, 2, 3, 1, 5\r\n\tuint8_t hall_sensors_state = \r\n\t\t((GET_PORT(PIN_HALL_SENSOR_A)->IDR & GET_PIN(PIN_HALL_SENSOR_A)) >> 5) |\r\n\t\t((GET_PORT(PIN_HALL_SENSOR_B)->IDR & GET_PIN(PIN_HALL_SENSOR_B)) >> 1) |\r\n\t\t((GET_PORT(PIN_HALL_SENSOR_C)->IDR & GET_PIN(PIN_HALL_SENSOR_C)) >> 3);\r\n\r\n\t// make sure we run next code only when there is a change on the hall sensors signal\r\n\tif (hall_sensors_state != hall_sensors_state_last)\r\n\t{\r\n\t\thall_sensors_state_last = hall_sensors_state;\r\n\r\n\t\tswitch (hall_sensors_state)\r\n\t\t{\r\n\t\tcase 3:\r\n\t\t\trotor_absolute_angle = (uint8_t)MOTOR_ROTOR_ANGLE_150;\r\n\t\t\tbreak;\r\n\r\n\t\tcase 1:\r\n\t\t\tif (half_erps_flag == 1)\r\n\t\t\t{\r\n\t\t\t\thalf_erps_flag = 0;\r\n\t\t\t\tpwm_cycles_counter_total = pwm_cycles_counter;\r\n\t\t\t\tpwm_cycles_counter = 1;\r\n\r\n\t\t\t\tif (pwm_cycles_counter_total > 0)\r\n\t\t\t\t{\r\n\t\t\t\t\t// This division takes 4.4us\r\n\t\t\t\t\tspeed_erps = PWM_CYCLES_SECOND / pwm_cycles_counter_total;\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tspeed_erps = PWM_CYCLES_SECOND;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// update motor commutation state based on motor speed\r\n\t\t\t\tif (speed_erps > MOTOR_ROTOR_ERPS_START_INTERPOLATION_60_DEGREES)\r\n\t\t\t\t{\r\n\t\t\t\t\tif (commutation_type == BLOCK_COMMUTATION)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tcommutation_type = SINEWAVE_INTERPOLATION_60_DEGREES;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tif (commutation_type == SINEWAVE_INTERPOLATION_60_DEGREES)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tcommutation_type = BLOCK_COMMUTATION;\r\n\t\t\t\t\t\tfoc_angle = 0;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\trotor_absolute_angle = (uint8_t)MOTOR_ROTOR_ANGLE_210;\r\n\t\t\tbreak;\r\n\r\n\t\tcase 5:\r\n\t\t\trotor_absolute_angle = (uint8_t)MOTOR_ROTOR_ANGLE_270;\r\n\t\t\tbreak;\r\n\r\n\t\tcase 4:\r\n\t\t\trotor_absolute_angle = (uint8_t)MOTOR_ROTOR_ANGLE_330;\r\n\t\t\tbreak;\r\n\r\n\t\tcase 6:\r\n\t\t\thalf_erps_flag = 1;\r\n\r\n\t\t\trotor_absolute_angle = (uint8_t)MOTOR_ROTOR_ANGLE_30;\r\n\t\t\tbreak;\r\n\r\n\t\t\t// BEMF is always 90 degrees advanced over motor rotor position degree zero\r\n\t\t\t// and here (hall sensor C blue wire, signal transition from positive to negative),\r\n\t\t\t// phase B BEMF is at max value (measured on osciloscope by rotating the motor)\r\n\t\tcase 2:\r\n\t\t\trotor_absolute_angle = (uint8_t)MOTOR_ROTOR_ANGLE_90;\r\n\t\t\tbreak;\r\n\r\n\t\tdefault:\r\n\t\t\t// invalid hall sensor signal\r\n\t\t\thall_sensor_error = true;\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\thall_sensor_error = false;\r\n\t\tpwm_cycles_counter_6 = 1;\r\n\t}\r\n\r\n\t// count number of fast loops / pwm cycles and reset some states when motor is near zero speed\r\n\tif (pwm_cycles_counter < PWM_CYCLES_COUNTER_MAX)\r\n\t{\r\n\t\tpwm_cycles_counter++;\r\n\t\tpwm_cycles_counter_6++;\r\n\t}\r\n\telse // happens when motor is stopped or near zero speed\r\n\t{\r\n\t\tpwm_cycles_counter = 1; // don't put to 0 to avoid 0 divisions\r\n\t\tpwm_cycles_counter_6 = 1;\r\n\t\thalf_erps_flag = 0;\r\n\t\tspeed_erps = 0;\r\n\t\tpwm_cycles_counter_total = 0xffff;\r\n\t\tfoc_angle = 0;\r\n\t\tcommutation_type = BLOCK_COMMUTATION;\r\n\t\thall_sensors_state_last = 0; // this way we force execution of hall sensors code next time\r\n\t}\r\n\r\n\t// calc interpolation angle and sinewave table index\r\n\tuint8_t svm_table_index = rotor_absolute_angle + foc_angle;\r\n\r\n#if 1 // may be useful to disable interpolation when debugging\r\n\r\n\t// calculate the interpolation angle (and it doesn't work when motor starts and at very low speeds)\r\n\tif (commutation_type == SINEWAVE_INTERPOLATION_60_DEGREES)\r\n\t{\r\n\t\t// division by 0: motor_pwm_cycles_counter_total should never be 0\r\n\t\t// TODO: verifiy if (motor_pwm_cycles_counter_6 << 8) do not overflow\r\n\t\tuint8_t interpolation_angle = (pwm_cycles_counter_6 << 8) / pwm_cycles_counter_total; // this operations take 4.4us\r\n\t\tsvm_table_index += interpolation_angle;\r\n\t}\r\n#endif\r\n\r\n\r\n\t// pwm duty cycle controller\r\n\t// ----------------------------------------------------------------------\r\n\t// brakes are active\r\n\t// limit battery undervoltage\r\n\t// limit battery max current\r\n\t// limit motor max erps\r\n\t// ramp up/down pwm duty cycle towards target\r\n\r\n\t++current_controller_counter;\r\n\t++speed_controller_counter;\r\n\r\n\tif\t(\r\n\t\t\tcontrol_state == CONTROL_STATE_DISABLE ||\r\n\t\t\tis_lvc_triggered ||\r\n\t\t\t(pwm_duty_cycle_target == 0) ||\r\n\t\t\t(GET_PIN_INPUT_STATE(PIN_BRAKE) == 0) //active low\r\n\t\t)\r\n\t{\r\n\t\tif (pwm_duty_cycle)\r\n\t\t{\r\n\t\t\t--pwm_duty_cycle;\r\n\t\t}\r\n\t}\r\n\t// do not control current at every PWM cycle, that will measure and control too fast. Use counter to limit\r\n\telse if\r\n\t\t(\r\n\t\t\tcurrent_controller_counter > CURRENT_CONTROLLER_CHECK_PERIODS &&\r\n\t\t\t(\r\n\t\t\t\t// check if truncated 8bit current reading did overflow\r\n\t\t\t\tadc_battery_current_ovf ||\r\n\t\t\t\t// compare against ramp controller current limit\r\n\t\t\t\tadc_battery_current > adc_battery_ramp_max_current ||\r\n\t\t\t\t// or hard motor phase current limit\r\n\t\t\t\tadc_phase_current > adc_phase_max_current\r\n\t\t\t)\r\n\t\t)\r\n\t{\r\n\t\tif (pwm_duty_cycle)\r\n\t\t{\r\n\t\t\t--pwm_duty_cycle;\r\n\t\t}\r\n\t}\r\n\telse if (\r\n\t\tspeed_controller_counter > SPEED_CONTROLLER_CHECK_PERIODS && // test about every 100ms\r\n\t\tspeed_erps > MAX_MOTOR_SPEED_ERPS\r\n\t)\r\n\t{\r\n\t\tif (pwm_duty_cycle)\r\n\t\t{\r\n\t\t\t--pwm_duty_cycle;\r\n\t\t}\r\n\t}\r\n\telse // nothing to limit, so adjust duty_cycle to duty_cycle_target\r\n\t{\r\n\t\tif (pwm_duty_cycle_target > pwm_duty_cycle)\r\n\t\t{\r\n\t\t\tif (pwm_duty_cycle_ramp_up_counter++ >= PWM_DUTY_CYCLE_RAMP_UP_INVERSE_STEP)\r\n\t\t\t{\r\n\t\t\t\tpwm_duty_cycle_ramp_up_counter = 0;\r\n\t\t\t\t++pwm_duty_cycle;\r\n\t\t\t}\r\n\t\t}\r\n\t\telse if (pwm_duty_cycle_target < pwm_duty_cycle)\r\n\t\t{\r\n\t\t\tif (pwm_duty_cycle_ramp_down_counter++ >= PWM_DUTY_CYCLE_RAMP_DOWN_INVERSE_STEP)\r\n\t\t\t{\r\n\t\t\t\tpwm_duty_cycle_ramp_down_counter = 0;\r\n\t\t\t\t--pwm_duty_cycle;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t// reset periodic check counters\r\n\tif (speed_controller_counter > SPEED_CONTROLLER_CHECK_PERIODS)\r\n\t{\r\n\t\tspeed_controller_counter = 0;\r\n\t}\r\n\r\n\tif (current_controller_counter > CURRENT_CONTROLLER_CHECK_PERIODS)\r\n\t{\r\n\t\tcurrent_controller_counter = 0;\r\n\t}\r\n\r\n\r\n\t// calculate final pwm duty cycle values to be applied to TIMER1\r\n\r\n\t// The first half of the table is the positive offset from the middle (0x100),\r\n\t// in that case just set MSB to 0x1, and the value from the table*duty cycle to LSB.\r\n\t// The second half of the table is a negative offset from that same middle,\r\n\t// and should be substracted from 0x100.\r\n\t// To cheat, we leave it as 0x100 when this value * duty cycle is 0,\r\n\t// otherwise we assume MSB is 0, and just invert the value from the table from LSB.\r\n\t// Checking to see if svm_table_index >= 128 (180 degrees) by & 0x80,\r\n\t// as SDCC is not yet smart enough to do that automatically.\r\n\t#define CALC_PHASE(PHASE_OUTPUT) do {\t\t\t\t\t\t\t\t\t\t\t\t\\\r\n\t\tuint8_t tmp = ((uint16_t)(pwm_duty_cycle * svm_table[svm_table_index]) / 256);\t\\\r\n\t\tif (tmp > 0 && (svm_table_index & 0x80))\t\t\t\t\t\t\t\t\t\t\\\r\n\t\t{\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\\\r\n\t\t\tPHASE_OUTPUT##_lsb = 0 - tmp;\t\t\t\t\t\t\t\t\t\t\t\t\\\r\n\t\t\tPHASE_OUTPUT##_msb = 0;\t\t\t\t\t\t\t\t\t\t\t\t\t\t\\\r\n\t\t}\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\\\r\n\t\telse\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\\\r\n\t\t{\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\\\r\n\t\t\tPHASE_OUTPUT##_lsb = tmp;\t\t\t\t\t\t\t\t\t\t\t\t\t\\\r\n\t\t\tPHASE_OUTPUT##_msb = 1;\t\t\t\t\t\t\t\t\t\t\t\t\t\t\\\r\n\t\t}\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\\\r\n\t} while (0)\r\n\r\n\r\n\t// phase B as reference phase\r\n\tuint8_t phase_b_voltage_msb;\r\n\tuint8_t phase_b_voltage_lsb;\r\n\tCALC_PHASE(phase_b_voltage);\r\n\r\n\t// phase C is advanced 120 degrees over phase B\r\n\tsvm_table_index += 85; // 120º / 360 * 256 = 85\r\n\tuint8_t phase_c_voltage_msb;\r\n\tuint8_t phase_c_voltage_lsb;\r\n\tCALC_PHASE(phase_c_voltage);\r\n\r\n\t// phase A is advanced 240 degrees over phase B\r\n\tsvm_table_index += 86; // 240º / 360 * 256 = 171 - 85 already added = 86\r\n\tuint8_t phase_a_voltage_msb;\r\n\tuint8_t phase_a_voltage_lsb;\r\n\tCALC_PHASE(phase_a_voltage);\r\n\r\n\r\n\t// set final duty cycle value to pwm timers\r\n\t// phase B\r\n\tTIM1->CCR3H = phase_b_voltage_msb;\r\n\tTIM1->CCR3L = phase_b_voltage_lsb;\r\n\t// phase C\r\n\tTIM1->CCR2H = phase_c_voltage_msb;\r\n\tTIM1->CCR2L = phase_c_voltage_lsb;\r\n\t// phase A\r\n\tTIM1->CCR1H = phase_a_voltage_msb;\r\n\tTIM1->CCR1L = phase_a_voltage_lsb;\r\n\t\r\n\r\n\t// ramp up motor current\r\n\tif (adc_battery_target_current > adc_battery_ramp_max_current)\r\n\t{\r\n\t\tif (adc_current_ramp_up_counter++ >= CURRENT_RAMP_UP_INVERSE_STEP)\r\n\t\t{\r\n\t\t\tadc_current_ramp_up_counter = 0;\r\n\t\t\tadc_battery_ramp_max_current++;\r\n\t\t}\r\n\t}\r\n\telse if (adc_battery_target_current < adc_battery_ramp_max_current)\r\n\t{\r\n\t\t// we are not doing a ramp down here, just directly setting to the target value\r\n\t\tadc_battery_ramp_max_current = adc_battery_target_current;\r\n\t}\r\n\r\n\t// clears the timer1 interrupt CC4 pending bit\r\n\tTIM1->SR1 = (uint8_t)(~(uint8_t)TIM1_IT_CC4);\r\n}\r\n"
  },
  {
    "path": "src/firmware/tsdz2/pins.h",
    "content": "/*\n * bbs-fw\n *\n * Copyright (C) Daniel Nilsson, 2022.\n *\n * Released under the GPL License, Version 3\n */\n#ifndef _TSDZ2_PINS_H_\n#define _TSDZ2_PINS_H_\n\n#include \"tsdz2/cpu.h\"\n#include \"tsdz2/stm8s/stm8s.h\"\n#include \"tsdz2/stm8s/stm8s_gpio.h\"\n\n#define PIN_HALL_SENSOR_A\t\t\tGPIOE, GPIO_PIN_5\n#define PIN_HALL_SENSOR_B\t\t\tGPIOD, GPIO_PIN_2\n#define PIN_HALL_SENSOR_C\t\t\tGPIOC, GPIO_PIN_5\n\n#define PIN_PWM_PHASE_A_LOW\t\t\tGPIOB, GPIO_PIN_2\n#define PIN_PWM_PHASE_A_HIGH\t\tGPIOC, GPIO_PIN_3\n\n#define PIN_PWM_PHASE_B_LOW\t\t\tGPIOB, GPIO_PIN_1\n#define PIN_PWM_PHASE_B_HIGH\t\tGPIOC, GPIO_PIN_2\n\n#define PIN_PWM_PHASE_C_LOW\t\t\tGPIOB, GPIO_PIN_0\n#define PIN_PWM_PHASE_C_HIGH\t\tGPIOC, GPIO_PIN_1\n\n#define PIN_BATTERY_CURRENT\t\t\tGPIOB, GPIO_PIN_5\n#define PIN_BATTERY_VOLTAGE\t\t\tGPIOB, GPIO_PIN_6\n\n#define PIN_PAS1\t\t\t\t\tGPIOD, GPIO_PIN_7\n#define PIN_PAS2\t\t\t\t\tGPIOE, GPIO_PIN_0\n#define PIN_SPEED_SENSOR\t\t\tGPIOA, GPIO_PIN_1\n#define PIN_BRAKE\t\t\t\t\tGPIOC, GPIO_PIN_6\n#define PIN_THROTTLE\t\t\t\tGPIOB, GPIO_PIN_7\n#define PIN_LIGHTS\t\t\t\t\tGPIOD, GPIO_PIN_4\n\n#define PIN_TORQUE_SENSOR\t\t\tGPIOB, GPIO_PIN_3\n#define PIN_TORQUE_SENSOR_EXC\t\tGPIOD, GPIO_PIN_3\n\n#define PIN_EXTERNAL_RX\t\t\t\tGPIOD, GPIO_PIN_6\n#define PIN_EXTERNAL_TX\t\t\t\tGPIOD, GPIO_PIN_5\n\n#endif\n"
  },
  {
    "path": "src/firmware/tsdz2/sensors.c",
    "content": "/*\r\n * bbs-fw\r\n *\r\n * Copyright (C) Daniel Nilsson, 2022.\r\n *\r\n * Released under the GPL License, Version 3\r\n */\r\n\r\n#include \"sensors.h\"\r\n#include \"intellisense.h\"\r\n#include \"fwconfig.h\"\r\n#include \"tsdz2/interrupt.h\"\r\n#include \"tsdz2/timers.h\"\r\n#include \"tsdz2/stm8.h\"\r\n#include \"tsdz2/pins.h\"\r\n#include \"tsdz2/stm8s/stm8s_tim4.h\"\r\n\r\n// interrupt runs at 100us interval, see timer4 setup in timers.c\r\n\r\n// :TODO: this file contains a lot of duplicated code from bbsx version, try to share code\r\n\r\n#define PAS_SENSOR_NUM_SIGNALS\t\t\tPAS_PULSES_REVOLUTION\r\n#define PAS_SENSOR_MIN_PULSE_MS_X10\t\t50\t// 500rpm limit\r\n\r\n#define SPEED_SENSOR_MIN_PULSE_MS_X10\t500\r\n#define SPEED_SENSOR_TIMEOUT_MS_X10\t\t25000\r\n\r\n\r\nstatic volatile uint16_t pas_pulse_counter;\r\nstatic volatile bool pas_direction_backward;\r\nstatic volatile uint16_t pas_period_length;\t// pulse length counted in interrupt frequency (100us)\r\nstatic uint16_t pas_period_counter;\r\nstatic bool pas_prev1;\r\nstatic bool pas_prev2;\r\nstatic uint16_t pas_stop_delay_periods;\r\n\r\nstatic volatile uint16_t speed_ticks_period_length; // pulse length counted in interrupt frequency (100us)\r\nstatic uint16_t speed_period_counter;\r\nstatic bool speed_prev_state;\r\nstatic uint8_t speed_ticks_per_rpm;\r\n\r\nextern void torque_sensor_init();\r\nextern void torque_sensor_process();\r\n\r\nvoid sensors_init()\r\n{\r\n\tpas_period_counter = 0;\r\n\tpas_pulse_counter = 0;\r\n\tpas_direction_backward = false;\r\n\tpas_period_length = 0;\r\n\tpas_stop_delay_periods = 1500;\r\n\tspeed_period_counter = 0;\r\n\tspeed_ticks_period_length = 0;\r\n\tspeed_prev_state = false;\r\n\tspeed_ticks_per_rpm = 1;\r\n\r\n\t// pins do not have external interrupt, use timer0 to evaluate state frequently\r\n\tSET_PIN_INPUT(PIN_PAS1);\r\n\tSET_PIN_INPUT(PIN_PAS2);\r\n\tSET_PIN_INPUT(PIN_SPEED_SENSOR);\r\n\tSET_PIN_INPUT_PULLUP(PIN_BRAKE);\r\n\r\n\tpas_prev1 = GET_PIN_INPUT_STATE(PIN_PAS1);\r\n\tpas_prev2 = GET_PIN_INPUT_STATE(PIN_PAS2);\r\n\r\n\ttorque_sensor_init();\r\n\ttorque_sensor_process();\r\n\r\n\ttimer4_init_sensors();\r\n}\r\n\r\nvoid sensors_process()\r\n{\r\n\ttorque_sensor_process();\r\n}\r\n\r\n\r\nvoid pas_set_stop_delay(uint16_t delay_ms)\r\n{\r\n\tpas_stop_delay_periods = delay_ms * 10;\r\n}\r\n\r\nuint16_t pas_get_cadence_rpm_x10()\r\n{\r\n\tuint16_t tmp;\r\n\tTIM4->IER &= ~TIM4_IT_UPDATE; // disable timer4 interrupt\r\n\ttmp = pas_period_length;\r\n\tTIM4->IER |= TIM4_IT_UPDATE;\r\n\r\n\tif (tmp > 0)\r\n\t{\r\n\t\treturn (uint16_t)((6000000ul / PAS_SENSOR_NUM_SIGNALS) / tmp);\r\n\t}\r\n\telse\r\n\t{\r\n\t\treturn 0;\r\n\t}\r\n}\r\n\r\nuint16_t pas_get_pulse_counter()\r\n{\r\n\tuint16_t tmp;\r\n\tTIM4->IER &= ~TIM4_IT_UPDATE; // disable timer4 interrupts\r\n\ttmp = pas_pulse_counter;\r\n\tTIM4->IER |= TIM4_IT_UPDATE;\r\n\r\n\treturn tmp;\r\n}\r\n\r\nbool pas_is_pedaling_forwards()\r\n{\r\n\tuint16_t period_length;\r\n\tuint8_t direction_backward;\r\n\tTIM4->IER &= ~TIM4_IT_UPDATE; // disable timer4 interrupts\r\n\tperiod_length = pas_period_length;\r\n\tdirection_backward = pas_direction_backward;\r\n\tTIM4->IER |= TIM4_IT_UPDATE;\r\n\r\n\t// atomic read operation, no need to disable timer interrupt\r\n\treturn period_length > 0 && !direction_backward;\r\n}\r\n\r\nbool pas_is_pedaling_backwards()\r\n{\r\n\tuint16_t period_length;\r\n\tuint8_t direction_backward;\r\n\tTIM4->IER &= ~TIM4_IT_UPDATE; // disable timer4 interrupts\r\n\tperiod_length = pas_period_length;\r\n\tdirection_backward = pas_direction_backward;\r\n\tTIM4->IER |= TIM4_IT_UPDATE;\r\n\r\n\treturn (period_length > 0) && direction_backward;\r\n}\r\n\r\nvoid speed_sensor_set_signals_per_rpm(uint8_t num_signals)\r\n{\r\n\tspeed_ticks_per_rpm = num_signals;\r\n}\r\n\r\nbool speed_sensor_is_moving()\r\n{\r\n\tuint16_t tmp;\r\n\tTIM4->IER &= ~TIM4_IT_UPDATE; // disable timer4 interrupts\r\n\ttmp = speed_ticks_period_length;\r\n\tTIM4->IER |= TIM4_IT_UPDATE;\r\n\r\n\treturn tmp > 0;\r\n}\r\n\r\nuint16_t speed_sensor_get_rpm_x10()\r\n{\r\n\tuint16_t tmp;\r\n\tTIM4->IER &= ~TIM4_IT_UPDATE; // disable timer4 interrupts\r\n\ttmp = speed_ticks_period_length;\r\n\tTIM4->IER |= TIM4_IT_UPDATE;\r\n\r\n\tif (tmp > 0)\r\n\t{\r\n\t\treturn 6000000ul / tmp / speed_ticks_per_rpm;\r\n\t}\r\n\r\n\treturn 0;\r\n}\r\n\r\n\r\nint16_t temperature_contr_x100()\r\n{\r\n\treturn 0; // n/a\r\n}\r\n\r\nint16_t temperature_motor_x100()\r\n{\r\n\treturn 0; // n/a\r\n}\r\n\r\n\r\nbool brake_is_activated()\r\n{\r\n\treturn !GET_PIN_INPUT_STATE(PIN_BRAKE);\r\n}\r\n\r\nbool shift_sensor_is_activated()\r\n{\r\n\treturn false; // n/a\r\n}\r\n\r\n\r\nvoid isr_timer4_ovf(void) __interrupt(ITC_IRQ_TIM4_OVF)\r\n{\r\n\t// clear interrupt bit\r\n\tTIM4->SR1 &= (uint8_t)(~TIM4_IT_UPDATE);\r\n\r\n\t// Pas\r\n\t{\r\n\t\tbool pas1 = GET_PIN_INPUT_STATE(PIN_PAS1);\r\n\t\tbool pas2 = GET_PIN_INPUT_STATE(PIN_PAS2);\r\n\r\n\t\tif (pas1 && !pas_prev1 /* && pas_period_counter > PAS_SENSOR_MIN_PULSE_MS_X10 */)\r\n\t\t{\r\n\t\t\tpas_pulse_counter++;\r\n\r\n\t\t\tif (pas_direction_backward != pas2)\r\n\t\t\t{\r\n\t\t\t\tpas_direction_backward = pas2;\r\n\r\n\t\t\t\t// Reset pas pulse counter if pedal direction is changed,\r\n\t\t\t\t// this variable counts the number of pulses since start of pedaling session.\r\n\t\t\t\tpas_pulse_counter = 0;\r\n\t\t\t}\r\n\r\n\t\t\tif (pas_period_counter > 0)\r\n\t\t\t{\r\n\t\t\t\tif (pas_period_counter <= pas_stop_delay_periods)\r\n\t\t\t\t{\r\n\t\t\t\t\tpas_period_length = pas_period_counter; // save in order to be able to calculate rpm when needed\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tpas_period_length = 0;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tpas_period_counter = 0;\r\n\t\t\t}\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t// Do not allow wraparound or computed pedaling cadence will wrong after pedals has been still.\r\n\t\t\tif (pas_period_counter < 65535)\r\n\t\t\t{\r\n\t\t\t\tpas_period_counter++;\r\n\t\t\t}\r\n\r\n\t\t\tif (pas_period_length > 0 && pas_period_counter > pas_stop_delay_periods)\r\n\t\t\t{\r\n\t\t\t\tpas_period_length = 0;\r\n\t\t\t\tpas_pulse_counter = 0;\r\n\t\t\t\tpas_direction_backward = false;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tpas_prev1 = pas1;\r\n\t\tpas_prev2 = pas2;\r\n\t}\r\n\r\n\r\n\t// Speed sensor\r\n\t{\r\n\t\tbool spd = GET_PIN_INPUT_STATE(PIN_SPEED_SENSOR);\r\n\r\n\t\tif (spd && !speed_prev_state && speed_period_counter > SPEED_SENSOR_MIN_PULSE_MS_X10)\r\n\t\t{\r\n\t\t\tif (speed_period_counter <= SPEED_SENSOR_TIMEOUT_MS_X10)\r\n\t\t\t{\r\n\t\t\t\tspeed_ticks_period_length = speed_period_counter;\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tspeed_ticks_period_length = 0;\r\n\t\t\t}\r\n\r\n\t\t\tspeed_period_counter = 0;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t// Do not allow wraparound or computed speed will wrong after bike has been still.\r\n\t\t\tif (speed_period_counter < 65535)\r\n\t\t\t{\r\n\t\t\t\tspeed_period_counter++;\r\n\t\t\t}\r\n\r\n\t\t\tif (speed_ticks_period_length > 0 && speed_period_counter > SPEED_SENSOR_TIMEOUT_MS_X10)\r\n\t\t\t{\r\n\t\t\t\tspeed_ticks_period_length = 0;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tspeed_prev_state = spd;\r\n\t}\r\n}\r\n"
  },
  {
    "path": "src/firmware/tsdz2/stm8.h",
    "content": "#pragma once\n\n#ifndef _TSDZ2_STM_8_H_\n#define _TSDZ2_STM_8_H_\n\n#include <stdint.h>\n\n#define EXPAND(x) x\n\n#define SET_PIN_INPUT_(PORT, PIN) PORT->DDR &= (uint8_t)(~(PIN)); PORT->CR1 &= (uint8_t)(~(PIN))\n#define SET_PIN_INPUT(...) EXPAND(SET_PIN_INPUT_(__VA_ARGS__))\n\n#define SET_PIN_INPUT_PULLUP_(PORT, PIN) PORT->DDR &= (uint8_t)(~(PIN)); PORT->CR1 |= (uint8_t)PIN\n#define SET_PIN_INPUT_PULLUP(...) EXPAND(SET_PIN_INPUT_PULLUP_(__VA_ARGS__))\n\n#define SET_PIN_OUTPUT_(PORT, PIN)  PORT->DDR |= (uint8_t)PIN; PORT->CR1 |= (uint8_t)PIN; PORT->CR2 |= (uint8_t)(PIN)\n#define SET_PIN_OUTPUT(...) EXPAND(SET_PIN_OUTPUT_(__VA_ARGS__))\n\n#define SET_PIN_OUTPUT_OPEN_DRAIN_(PORT, PIN)  PORT->DDR |= (uint8_t)PIN; PORT->CR1 &= (uint8_t)(~(PIN)); PORT->CR2 |= (uint8_t)(PIN)\n#define SET_PIN_OUTPUT_OPEN_DRAIN(...) EXPAND(SET_PIN_OUTPUT_OPEN_DRAIN_(__VA_ARGS__))\n\n\n#define GET_PIN_INPUT_STATE_(PORT, PIN) ((PORT->IDR & (uint8_t)PIN) != 0)\n#define GET_PIN_INPUT_STATE(...) EXPAND(GET_PIN_INPUT_STATE_(__VA_ARGS__))\n\n#define SET_PIN_HIGH_(PORT, PIN) PORT->ODR |= (uint8_t)PIN\n#define SET_PIN_HIGH(...) EXPAND(SET_PIN_HIGH_(__VA_ARGS__))\n\n#define SET_PIN_LOW_(PORT, PIN) PORT->ODR &= (uint8_t)(~PIN)\n#define SET_PIN_LOW(...) EXPAND(SET_PIN_LOW_(__VA_ARGS__))\n\n#define TOGGLE_PIN_(PORT, PIN) PORT->ODR ^= (PIN)\n#define TOGGLE_PIN(...) EXPAND(TOGGLE_PIN_(__VA_ARGS__))\n\n\n#define GET_PIN_(PORT, PIN) PIN\n#define GET_PIN(...) EXPAND(GET_PIN_(__VA_ARGS__))\n\n#define GET_PORT_(PORT, PIN) PORT\n#define GET_PORT(...) EXPAND(GET_PORT_(__VA_ARGS__))\n\n\n#endif\n"
  },
  {
    "path": "src/firmware/tsdz2/stm8s/stm8s.h",
    "content": "/**\n  ******************************************************************************\n  * @file    stm8s.h\n  * @author  MCD Application Team\n  * @version V2.3.0\n  * @date    16-June-2017\n  * @brief   This file contains all HW registers definitions and memory mapping.\n   ******************************************************************************\n  * @attention\n  *\n  * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>\n  *\n  * Licensed under MCD-ST Liberty SW License Agreement V2, (the \"License\");\n  * You may not use this file except in compliance with the License.\n  * You may obtain a copy of the License at:\n  *\n  *        http://www.st.com/software_license_agreement_liberty_v2\n  *\n  * Unless required by applicable law or agreed to in writing, software \n  * distributed under the License is distributed on an \"AS IS\" BASIS, \n  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  * See the License for the specific language governing permissions and\n  * limitations under the License.\n  *\n  ******************************************************************************\n  */\n\n/* Define to prevent recursive inclusion -------------------------------------*/\n#ifndef __STM8S_H\n#define __STM8S_H\n\n/** @addtogroup STM8S_StdPeriph_Driver\n  * @{\n  */\n  \n/* Uncomment the line below according to the target STM8S or STM8A device used in your\n   application. */\n\n /* #define STM8S208 */      /*!< STM8S High density devices with CAN */\n /* #define STM8S207 */      /*!< STM8S High density devices without CAN */\n /* #define STM8S007 */      /*!< STM8S Value Line High density devices */\n /* #define STM8AF52Ax */    /*!< STM8A High density devices with CAN */\n /* #define STM8AF62Ax */    /*!< STM8A High density devices without CAN */\n /* #define STM8S105 */      /*!< STM8S Medium density devices */\n /* #define STM8S005 */      /*!< STM8S Value Line Medium density devices */\n /* #define STM8AF626x */    /*!< STM8A Medium density devices */\n /* #define STM8AF622x */    /*!< STM8A Low density devices */\n /* #define STM8S103 */      /*!< STM8S Low density devices */\n /* #define STM8S003 */      /*!< STM8S Value Line Low density devices */\n /* #define STM8S903 */      /*!< STM8S Low density devices */\n /* #define STM8S001 */      /*!< STM8S Value Line Low denisty devices */\n\n/*   Tip: To avoid modifying this file each time you need to switch between these\n        devices, you can define the device in your toolchain compiler preprocessor. \n\n  - High-Density STM8A devices are the STM8AF52xx STM8AF6269/8x/Ax,\n    STM8AF51xx, and STM8AF6169/7x/8x/9x/Ax microcontrollers where the Flash memory\n    density ranges between 32 to 128 Kbytes\n  - Medium-Density STM8A devices are the STM8AF622x/4x, STM8AF6266/68,\n    STM8AF612x/4x, and STM8AF6166/68 microcontrollers where the Flash memory \n    density ranges between 8 to 32 Kbytes\n  - High-Density STM8S devices are the STM8S207xx, STM8S007 and STM8S208xx microcontrollers\n    where the Flash memory density ranges between 32 to 128 Kbytes.\n  - Medium-Density STM8S devices are the STM8S105x and STM8S005 microcontrollers\n    where the Flash memory density ranges between 16 to 32-Kbytes.\n  - Low-Density STM8A devices are the STM8AF622x microcontrollers where the Flash\n    density is 8 Kbytes. \n  - Low-Density STM8S devices are the STM8S103xx, STM8S003, STM8S903xx and STM8S001 microcontrollers\n    where the Flash density is 8 Kbytes. */\n\n#if !defined (STM8S208) && !defined (STM8S207) && !defined (STM8S105) && \\\n    !defined (STM8S103) && !defined (STM8S903) && !defined (STM8AF52Ax) && \\\n    !defined (STM8AF62Ax) && !defined (STM8AF626x) && !defined (STM8S007) && \\\n    !defined (STM8S003)&& !defined (STM8S005) && !defined(STM8S001) && !defined (STM8AF622x) \n #error \"Please select first the target STM8S/A device used in your application (in stm8s.h file)\"\n#endif\n\n/******************************************************************************/\n/*                   Library configuration section                            */\n/******************************************************************************/\n/* Check the used compiler */\n#if defined(__CSMC__)\n #define _COSMIC_\n#elif defined(__RCST7__)\n #define _RAISONANCE_\n#elif defined(__ICCSTM8__)\n #define _IAR_\n#elif defined(__SDCC)\n #define _SDCC_\n#else\n #error \"Unsupported Compiler!\"          /* Compiler defines not found */\n#endif\n\n#if !defined  USE_STDPERIPH_DRIVER\n/* Comment the line below if you will not use the peripherals drivers.\n   In this case, these drivers will not be included and the application code will be\n   based on direct access to peripherals registers */\n // #define USE_STDPERIPH_DRIVER\n#endif\n\n/**\n  * @brief  In the following line adjust the value of External High Speed oscillator (HSE)\n   used in your application\n\n   Tip: To avoid modifying this file each time you need to use different HSE, you\n        can define the HSE value in your toolchain compiler preprocessor.\n  */\n#if !defined  HSE_Value\n #if defined (STM8S208) || defined (STM8S207) || defined (STM8S007) || defined (STM8AF52Ax) || \\\n     defined (STM8AF62Ax) || defined (STM8AF622x)\n  #define HSE_VALUE ((uint32_t)24000000) /* Value of the External oscillator in Hz*/\n #else\n  #define HSE_VALUE ((uint32_t)16000000) /* Value of the External oscillator in Hz*/\n #endif /* STM8S208 || STM8S207 || STM8S007 || STM8AF62Ax || STM8AF52Ax || STM8AF622x */\n#endif /* HSE_Value */\n\n/**\n  * @brief  Definition of Device on-chip RC oscillator frequencies\n  */\n#define HSI_VALUE   ((uint32_t)16000000) /*!< Typical Value of the HSI in Hz */\n#define LSI_VALUE   ((uint32_t)128000)   /*!< Typical Value of the LSI in Hz */\n\n#ifdef _COSMIC_\n #define FAR  @far\n #define NEAR @near\n #define TINY @tiny\n #define EEPROM @eeprom\n #define CONST  const\n#elif defined (_RAISONANCE_) /* __RCST7__ */\n #define FAR  far\n #define NEAR data\n #define TINY page0\n #define EEPROM eeprom\n #define CONST  code\n #if defined (STM8S208) || defined (STM8S207) || defined (STM8S007) || defined (STM8AF52Ax) || \\\n     defined (STM8AF62Ax)\n   /*!< Used with memory Models for code higher than 64K */\n  #define MEMCPY fmemcpy\n #else /* STM8S903, STM8S103, STM8S001, STM8S003, STM8S105, STM8AF626x, STM8AF622x */\n  /*!< Used with memory Models for code less than 64K */\n  #define MEMCPY memcpy\n #endif /* STM8S208 or STM8S207 or STM8S007 or STM8AF62Ax or STM8AF52Ax */\n#elif defined (_SDCC_)\n #define FAR  __far\n #define NEAR __near\n #define CONST  const\n#elif defined (_IAR_)\n #define FAR  __far\n #define NEAR __near\n #define TINY __tiny\n #define EEPROM __eeprom\n #define CONST  const\n#endif /* __CSMC__ */\n\n/* For FLASH routines, select whether pointer will be declared as near (2 bytes,\n   to handle code smaller than 64KB) or far (3 bytes, to handle code larger \n   than 64K) */\n\n#if defined (STM8S105) || defined (STM8S005) || defined (STM8S103) || defined (STM8S003) || \\\n    defined (STM8S001) || defined (STM8S903) || defined (STM8AF626x) || defined (STM8AF622x)\n/*!< Used with memory Models for code smaller than 64K */\n #define PointerAttr NEAR\n #define MemoryAddressCast uint16_t\n#else /* STM8S208 or STM8S207 or STM8AF62Ax or STM8AF52Ax */\n/*!< Used with memory Models for code higher than 64K */\n #define PointerAttr FAR\n #define MemoryAddressCast uint32_t\n#endif /* STM8S105 or STM8S103 or STM8S003 or STM8S001 or STM8S903 or STM8AF626x or STM8AF622x */\n\n/* Uncomment the line below to enable the FLASH functions execution from RAM */\n#if !defined (RAM_EXECUTION)\n/* #define RAM_EXECUTION  (1) */\n#endif /* RAM_EXECUTION */\n\n#ifdef RAM_EXECUTION\n #ifdef _COSMIC_\n   #define IN_RAM(a) a\n #elif defined (_RAISONANCE_) /* __RCST7__ */\n   #define IN_RAM(a) a inram\n #else /*_IAR_*/\n  #define IN_RAM(a) __ramfunc a\n #endif /* _COSMIC_ */\n#else \n  #define IN_RAM(a) a\n#endif /* RAM_EXECUTION */\n\n/*!< [31:16] STM8S Standard Peripheral Library main version V2.3.0*/\n#define __STM8S_STDPERIPH_VERSION_MAIN   ((uint8_t)0x02) /*!< [31:24] main version */                                  \n#define __STM8S_STDPERIPH_VERSION_SUB1   ((uint8_t)0x03) /*!< [23:16] sub1 version */\n#define __STM8S_STDPERIPH_VERSION_SUB2   ((uint8_t)0x00) /*!< [15:8]  sub2 version */\n#define __STM8S_STDPERIPH_VERSION_RC     ((uint8_t)0x00) /*!< [7:0]  release candidate */ \n#define __STM8S_STDPERIPH_VERSION       ( (__STM8S_STDPERIPH_VERSION_MAIN << 24)\\\n                                          |(__STM8S_STDPERIPH_VERSION_SUB1 << 16)\\\n                                          |(__STM8S_STDPERIPH_VERSION_SUB2 << 8)\\\n                                          |(__STM8S_STDPERIPH_VERSION_RC))\n\n/******************************************************************************/\n\n/* Includes ------------------------------------------------------------------*/\n\n/* Exported types and constants ----------------------------------------------*/\n\n/** @addtogroup Exported_types\n  * @{\n  */\n\n/**\n * IO definitions\n *\n * define access restrictions to peripheral registers\n */\n#define     __I     volatile const   /*!< defines 'read only' permissions     */\n#define     __O     volatile         /*!< defines 'write only' permissions    */\n#define     __IO    volatile         /*!< defines 'read / write' permissions  */\n\n/*!< Integer types  */\n#include <stdint.h>\n\ntypedef enum {RESET = 0, SET = !RESET} FlagStatus, ITStatus, BitStatus, BitAction;\n\ntypedef enum {DISABLE = 0, ENABLE = !DISABLE} FunctionalState;\n#define IS_FUNCTIONALSTATE_OK(STATE) (((STATE) == DISABLE) || ((STATE) == ENABLE))\n\ntypedef enum {ERROR = 0, SUCCESS = !ERROR} ErrorStatus;\n\n#define U8_MAX     (255)\n#define S8_MAX     (127)\n#define S8_MIN     (-128)\n#define U16_MAX    (65535u)\n#define S16_MAX    (32767)\n#define S16_MIN    (-32768)\n#define U32_MAX    (4294967295uL)\n#define S32_MAX    (2147483647)\n#define S32_MIN    (-2147483648uL)\n\n/**\n  * @}\n  */\n  \n/** @addtogroup MAP_FILE_Exported_Types_and_Constants\n  * @{\n  */\n\n/******************************************************************************/\n/*                          IP registers structures                           */\n/******************************************************************************/\n\n/**\n  * @brief  General Purpose I/Os (GPIO)\n  */\ntypedef struct GPIO_struct\n{\n  __IO uint8_t ODR; /*!< Output Data Register */\n  __IO uint8_t IDR; /*!< Input Data Register */\n  __IO uint8_t DDR; /*!< Data Direction Register */\n  __IO uint8_t CR1; /*!< Configuration Register 1 */\n  __IO uint8_t CR2; /*!< Configuration Register 2 */\n}\nGPIO_TypeDef;\n\n/**\n  * @}\n  */\n\n/** @addtogroup GPIO_Registers_Reset_Value\n  * @{\n  */\n\n#define GPIO_ODR_RESET_VALUE ((uint8_t)0x00)\n#define GPIO_DDR_RESET_VALUE ((uint8_t)0x00)\n#define GPIO_CR1_RESET_VALUE ((uint8_t)0x00)\n#define GPIO_CR2_RESET_VALUE ((uint8_t)0x00)\n\n/**\n  * @}\n  */\n\n/*----------------------------------------------------------------------------*/\n#if defined(STM8S105) || defined(STM8S005) || defined(STM8S103) || defined(STM8S003) || \\\n    defined(STM8S001) || defined(STM8S903) || defined(STM8AF626x) || defined(STM8AF622x)\n/**\n  * @brief  Analog to Digital Converter (ADC1)\n  */\n typedef struct ADC1_struct\n {\n  __IO uint8_t DB0RH;         /*!< ADC1 Data Buffer Register (MSB)  */\n  __IO uint8_t DB0RL;         /*!< ADC1 Data Buffer Register (LSB)  */\n  __IO uint8_t DB1RH;         /*!< ADC1 Data Buffer Register (MSB)  */\n  __IO uint8_t DB1RL;         /*!< ADC1 Data Buffer Register (LSB)  */\n  __IO uint8_t DB2RH;         /*!< ADC1 Data Buffer Register (MSB)  */\n  __IO uint8_t DB2RL;         /*!< ADC1 Data Buffer Register (LSB)  */\n  __IO uint8_t DB3RH;         /*!< ADC1 Data Buffer Register (MSB)  */\n  __IO uint8_t DB3RL;         /*!< ADC1 Data Buffer Register (LSB)  */\n  __IO uint8_t DB4RH;         /*!< ADC1 Data Buffer Register (MSB)  */\n  __IO uint8_t DB4RL;         /*!< ADC1 Data Buffer Register (LSB)  */\n  __IO uint8_t DB5RH;         /*!< ADC1 Data Buffer Register (MSB)  */\n  __IO uint8_t DB5RL;         /*!< ADC1 Data Buffer Register (LSB)  */\n  __IO uint8_t DB6RH;         /*!< ADC1 Data Buffer Register (MSB)  */\n  __IO uint8_t DB6RL;         /*!< ADC1 Data Buffer Register (LSB)  */\n  __IO uint8_t DB7RH;         /*!< ADC1 Data Buffer Register (MSB)  */\n  __IO uint8_t DB7RL;         /*!< ADC1 Data Buffer Register (LSB)  */\n  __IO uint8_t DB8RH;         /*!< ADC1 Data Buffer Register (MSB)  */\n  __IO uint8_t DB8RL;         /*!< ADC1 Data Buffer Register (LSB)  */\n  __IO uint8_t DB9RH;         /*!< ADC1 Data Buffer Register (MSB)  */\n  __IO uint8_t DB9RL;         /*!< ADC1 Data Buffer Register (LSB)  */\n  uint8_t RESERVED[12];       /*!< Reserved byte */\n  __IO uint8_t CSR;           /*!< ADC1 control status register */\n  __IO uint8_t CR1;           /*!< ADC1 configuration register 1 */\n  __IO uint8_t CR2;           /*!< ADC1 configuration register 2 */\n  __IO uint8_t CR3;           /*!< ADC1 configuration register 3  */\n  __IO uint8_t DRH;           /*!< ADC1 Data high */\n  __IO uint8_t DRL;           /*!< ADC1 Data low */\n  __IO uint8_t TDRH;          /*!< ADC1 Schmitt trigger disable register high */\n  __IO uint8_t TDRL;          /*!< ADC1 Schmitt trigger disable register low */\n  __IO uint8_t HTRH;          /*!< ADC1 high threshold register High*/\n  __IO uint8_t HTRL;          /*!< ADC1 high threshold register Low*/\n  __IO uint8_t LTRH;          /*!< ADC1 low threshold register high */\n  __IO uint8_t LTRL;          /*!< ADC1 low threshold register low */\n  __IO uint8_t AWSRH;         /*!< ADC1 watchdog status register high */\n  __IO uint8_t AWSRL;         /*!< ADC1 watchdog status register low */\n  __IO uint8_t AWCRH;         /*!< ADC1 watchdog control register high */\n  __IO uint8_t AWCRL;         /*!< ADC1 watchdog control register low */\n }\n ADC1_TypeDef;\n\n/** @addtogroup ADC1_Registers_Reset_Value\n  * @{\n  */\n #define  ADC1_CSR_RESET_VALUE    ((uint8_t)0x00)\n #define  ADC1_CR1_RESET_VALUE    ((uint8_t)0x00)\n #define  ADC1_CR2_RESET_VALUE    ((uint8_t)0x00)\n #define  ADC1_CR3_RESET_VALUE    ((uint8_t)0x00)\n #define  ADC1_TDRL_RESET_VALUE   ((uint8_t)0x00)\n #define  ADC1_TDRH_RESET_VALUE   ((uint8_t)0x00)\n #define  ADC1_HTRL_RESET_VALUE   ((uint8_t)0x03)\n #define  ADC1_HTRH_RESET_VALUE   ((uint8_t)0xFF)\n #define  ADC1_LTRH_RESET_VALUE   ((uint8_t)0x00)\n #define  ADC1_LTRL_RESET_VALUE   ((uint8_t)0x00)\n #define  ADC1_AWCRH_RESET_VALUE  ((uint8_t)0x00)\n #define  ADC1_AWCRL_RESET_VALUE  ((uint8_t)0x00)\n/**\n  * @}\n  */\n\n/** @addtogroup ADC1_Registers_Bits_Definition\n  * @{\n  */\n #define ADC1_CSR_EOC     ((uint8_t)0x80) /*!< End of Conversion mask */\n #define ADC1_CSR_AWD     ((uint8_t)0x40) /*!< Analog Watch Dog Status mask */\n #define ADC1_CSR_EOCIE   ((uint8_t)0x20) /*!< Interrupt Enable for EOC mask */\n #define ADC1_CSR_AWDIE   ((uint8_t)0x10) /*!< Analog Watchdog interrupt enable mask */\n #define ADC1_CSR_CH      ((uint8_t)0x0F) /*!< Channel selection bits mask */\n\n #define ADC1_CR1_SPSEL   ((uint8_t)0x70) /*!< Prescaler selection mask */\n #define ADC1_CR1_CONT    ((uint8_t)0x02) /*!< Continuous conversion mask */\n #define ADC1_CR1_ADON    ((uint8_t)0x01) /*!< A/D Converter on/off mask */\n\n #define ADC1_CR2_EXTTRIG ((uint8_t)0x40) /*!< External trigger enable mask */\n #define ADC1_CR2_EXTSEL  ((uint8_t)0x30) /*!< External event selection mask */\n #define ADC1_CR2_ALIGN   ((uint8_t)0x08) /*!< Data Alignment mask */\n #define ADC1_CR2_SCAN    ((uint8_t)0x02) /*!< Scan mode mask */\n\n #define ADC1_CR3_DBUF    ((uint8_t)0x80) /*!< Data Buffer Enable mask */\n #define ADC1_CR3_OVR     ((uint8_t)0x40) /*!< Overrun Status Flag mask */\n\n#endif /* (STM8S105) ||(STM8S103) || (STM8S005) ||(STM8S003) || (STM8S001) || (STM8S903) || (STM8AF626x) || (STM8AF622x) */\n/**\n  * @}\n  */\n\n/*----------------------------------------------------------------------------*/\n/**\n  * @brief  Analog to Digital Converter (ADC2)\n  */\n#if defined(STM8S208) || defined(STM8S207) || defined (STM8S007) || defined (STM8AF52Ax) || defined (STM8AF62Ax)\n typedef struct ADC2_struct\n {\n  __IO uint8_t CSR;        /*!< ADC2 control status register */\n  __IO uint8_t CR1;        /*!< ADC2 configuration register 1 */\n  __IO uint8_t CR2;        /*!< ADC2 configuration register 2 */\n  uint8_t RESERVED;        /*!< Reserved byte */\n  __IO uint8_t DRH;        /*!< ADC2 Data high */\n  __IO uint8_t DRL;        /*!< ADC2 Data low */\n  __IO uint8_t TDRH;       /*!< ADC2 Schmitt trigger disable register high  */\n  __IO uint8_t TDRL;       /*!< ADC2 Schmitt trigger disable register low */\n }\n ADC2_TypeDef;\n\n/** @addtogroup ADC2_Registers_Reset_Value\n  * @{\n  */\n #define  ADC2_CSR_RESET_VALUE  ((uint8_t)0x00)\n #define  ADC2_CR1_RESET_VALUE  ((uint8_t)0x00)\n #define  ADC2_CR2_RESET_VALUE  ((uint8_t)0x00)\n #define  ADC2_TDRL_RESET_VALUE ((uint8_t)0x00)\n #define  ADC2_TDRH_RESET_VALUE ((uint8_t)0x00)\n/**\n  * @}\n  */\n\n/** @addtogroup ADC2_Registers_Bits_Definition\n  * @{\n  */\n #define ADC2_CSR_EOC     ((uint8_t)0x80) /*!< End of Conversion mask */\n #define ADC2_CSR_EOCIE   ((uint8_t)0x20) /*!< Interrupt Enable for EOC mask */\n #define ADC2_CSR_CH      ((uint8_t)0x0F) /*!< Channel selection bits mask */\n\n #define ADC2_CR1_SPSEL   ((uint8_t)0x70) /*!< Prescaler selection mask */\n #define ADC2_CR1_CONT    ((uint8_t)0x02) /*!< Continuous conversion mask */\n #define ADC2_CR1_ADON    ((uint8_t)0x01) /*!< A/D Converter on/off mask */\n\n #define ADC2_CR2_EXTTRIG ((uint8_t)0x40) /*!< External trigger enable mask */\n #define ADC2_CR2_EXTSEL  ((uint8_t)0x30) /*!< External event selection mask */\n #define ADC2_CR2_ALIGN   ((uint8_t)0x08) /*!< Data Alignment mask */\n\n#endif /* (STM8S208) ||(STM8S207) || defined (STM8S007) || (STM8AF62Ax) || (STM8AF52Ax) */\n/**\n  * @}\n  */\n\n/*----------------------------------------------------------------------------*/\n\n/**\n  * @brief  Auto Wake Up (AWU) peripheral registers.\n  */\ntypedef struct AWU_struct\n{\n  __IO uint8_t CSR; /*!< AWU Control status register */\n  __IO uint8_t APR; /*!< AWU Asynchronous prescaler buffer */\n  __IO uint8_t TBR; /*!< AWU Time base selection register */\n}\nAWU_TypeDef;\n\n/** @addtogroup AWU_Registers_Reset_Value\n  * @{\n  */\n#define AWU_CSR_RESET_VALUE ((uint8_t)0x00)\n#define AWU_APR_RESET_VALUE ((uint8_t)0x3F)\n#define AWU_TBR_RESET_VALUE ((uint8_t)0x00)\n\n/**\n  * @}\n  */\n\n/** @addtogroup AWU_Registers_Bits_Definition\n  * @{\n  */\n\n#define AWU_CSR_AWUF    ((uint8_t)0x20) /*!< Interrupt flag mask */\n#define AWU_CSR_AWUEN   ((uint8_t)0x10) /*!< Auto Wake-up enable mask */\n#define AWU_CSR_MSR     ((uint8_t)0x01) /*!< LSI Measurement enable mask */\n\n#define AWU_APR_APR     ((uint8_t)0x3F) /*!< Asynchronous Prescaler divider mask */\n\n#define AWU_TBR_AWUTB   ((uint8_t)0x0F) /*!< Timebase selection mask */\n\n/**\n  * @}\n  */\n\n/*----------------------------------------------------------------------------*/\n/**\n  * @brief  Beeper (BEEP) peripheral registers.\n  */\n\ntypedef struct BEEP_struct\n{\n  __IO uint8_t CSR; /*!< BEEP Control status register */\n}\nBEEP_TypeDef;\n\n/** @addtogroup BEEP_Registers_Reset_Value\n  * @{\n  */\n#define BEEP_CSR_RESET_VALUE ((uint8_t)0x1F)\n/**\n  * @}\n  */\n\n/** @addtogroup BEEP_Registers_Bits_Definition\n  * @{\n  */\n#define BEEP_CSR_BEEPSEL ((uint8_t)0xC0) /*!< Beeper frequency selection mask */\n#define BEEP_CSR_BEEPEN  ((uint8_t)0x20) /*!< Beeper enable mask */\n#define BEEP_CSR_BEEPDIV ((uint8_t)0x1F) /*!< Beeper Divider prescalar mask */\n/**\n  * @}\n  */\n\n/*----------------------------------------------------------------------------*/\n/**\n  * @brief  Clock Controller (CLK)\n  */\ntypedef struct CLK_struct\n{\n  __IO uint8_t ICKR;     /*!< Internal Clocks Control Register */\n  __IO uint8_t ECKR;     /*!< External Clocks Control Register */\n  uint8_t RESERVED;      /*!< Reserved byte */\n  __IO uint8_t CMSR;     /*!< Clock Master Status Register */\n  __IO uint8_t SWR;      /*!< Clock Master Switch Register */\n  __IO uint8_t SWCR;     /*!< Switch Control Register */\n  __IO uint8_t CKDIVR;   /*!< Clock Divider Register */\n  __IO uint8_t PCKENR1;  /*!< Peripheral Clock Gating Register 1 */\n  __IO uint8_t CSSR;     /*!< Clock Security System Register */\n  __IO uint8_t CCOR;     /*!< Configurable Clock Output Register */\n  __IO uint8_t PCKENR2;  /*!< Peripheral Clock Gating Register 2 */\n  uint8_t RESERVED1;     /*!< Reserved byte */\n  __IO uint8_t HSITRIMR; /*!< HSI Calibration Trimmer Register */\n  __IO uint8_t SWIMCCR;  /*!< SWIM clock control register */\n}\nCLK_TypeDef;\n\n/** @addtogroup CLK_Registers_Reset_Value\n  * @{\n  */\n\n#define CLK_ICKR_RESET_VALUE     ((uint8_t)0x01)\n#define CLK_ECKR_RESET_VALUE     ((uint8_t)0x00)\n#define CLK_CMSR_RESET_VALUE     ((uint8_t)0xE1)\n#define CLK_SWR_RESET_VALUE      ((uint8_t)0xE1)\n#define CLK_SWCR_RESET_VALUE     ((uint8_t)0x00)\n#define CLK_CKDIVR_RESET_VALUE   ((uint8_t)0x18)\n#define CLK_PCKENR1_RESET_VALUE  ((uint8_t)0xFF)\n#define CLK_PCKENR2_RESET_VALUE  ((uint8_t)0xFF)\n#define CLK_CSSR_RESET_VALUE     ((uint8_t)0x00)\n#define CLK_CCOR_RESET_VALUE     ((uint8_t)0x00)\n#define CLK_HSITRIMR_RESET_VALUE ((uint8_t)0x00)\n#define CLK_SWIMCCR_RESET_VALUE  ((uint8_t)0x00)\n\n/**\n  * @}\n  */\n\n/** @addtogroup CLK_Registers_Bits_Definition\n  * @{\n  */\n#define CLK_ICKR_SWUAH       ((uint8_t)0x20) /*!< Slow Wake-up from Active Halt/Halt modes */\n#define CLK_ICKR_LSIRDY      ((uint8_t)0x10) /*!< Low speed internal oscillator ready */\n#define CLK_ICKR_LSIEN       ((uint8_t)0x08) /*!< Low speed internal RC oscillator enable */\n#define CLK_ICKR_FHWU        ((uint8_t)0x04) /*!< Fast Wake-up from Active Halt/Halt mode */\n#define CLK_ICKR_HSIRDY      ((uint8_t)0x02) /*!< High speed internal RC oscillator ready */\n#define CLK_ICKR_HSIEN       ((uint8_t)0x01) /*!< High speed internal RC oscillator enable */\n\n#define CLK_ECKR_HSERDY      ((uint8_t)0x02) /*!< High speed external crystal oscillator ready */\n#define CLK_ECKR_HSEEN       ((uint8_t)0x01) /*!< High speed external crystal oscillator enable */\n\n#define CLK_CMSR_CKM         ((uint8_t)0xFF) /*!< Clock master status bits */\n\n#define CLK_SWR_SWI          ((uint8_t)0xFF) /*!< Clock master selection bits */\n\n#define CLK_SWCR_SWIF        ((uint8_t)0x08) /*!< Clock switch interrupt flag */\n#define CLK_SWCR_SWIEN       ((uint8_t)0x04) /*!< Clock switch interrupt enable */\n#define CLK_SWCR_SWEN        ((uint8_t)0x02) /*!< Switch start/stop */\n#define CLK_SWCR_SWBSY       ((uint8_t)0x01) /*!< Switch busy flag*/\n\n#define CLK_CKDIVR_HSIDIV    ((uint8_t)0x18) /*!< High speed internal clock prescaler */\n#define CLK_CKDIVR_CPUDIV    ((uint8_t)0x07) /*!< CPU clock prescaler */\n\n#define CLK_PCKENR1_TIM1     ((uint8_t)0x80) /*!< Timer 1 clock enable */ \n#define CLK_PCKENR1_TIM3     ((uint8_t)0x40) /*!< Timer 3 clock enable */\n#define CLK_PCKENR1_TIM2     ((uint8_t)0x20) /*!< Timer 2 clock enable */\n#define CLK_PCKENR1_TIM5     ((uint8_t)0x20) /*!< Timer 5 clock enable */\n#define CLK_PCKENR1_TIM4     ((uint8_t)0x10) /*!< Timer 4 clock enable */\n#define CLK_PCKENR1_TIM6     ((uint8_t)0x10) /*!< Timer 6 clock enable */\n#define CLK_PCKENR1_UART3    ((uint8_t)0x08) /*!< UART3 clock enable */\n#define CLK_PCKENR1_UART2    ((uint8_t)0x08) /*!< UART2 clock enable */\n#define CLK_PCKENR1_UART1    ((uint8_t)0x04) /*!< UART1 clock enable */\n#define CLK_PCKENR1_SPI      ((uint8_t)0x02) /*!< SPI clock enable */\n#define CLK_PCKENR1_I2C      ((uint8_t)0x01) /*!< I2C clock enable */\n\n#define CLK_PCKENR2_CAN      ((uint8_t)0x80) /*!< CAN clock enable */\n#define CLK_PCKENR2_ADC      ((uint8_t)0x08) /*!< ADC clock enable */\n#define CLK_PCKENR2_AWU      ((uint8_t)0x04) /*!< AWU clock enable */\n\n#define CLK_CSSR_CSSD        ((uint8_t)0x08) /*!< Clock security system detection */\n#define CLK_CSSR_CSSDIE      ((uint8_t)0x04) /*!< Clock security system detection interrupt enable */\n#define CLK_CSSR_AUX         ((uint8_t)0x02) /*!< Auxiliary oscillator connected to master clock */\n#define CLK_CSSR_CSSEN       ((uint8_t)0x01) /*!< Clock security system enable */\n\n#define CLK_CCOR_CCOBSY      ((uint8_t)0x40) /*!< Configurable clock output busy */\n#define CLK_CCOR_CCORDY      ((uint8_t)0x20) /*!< Configurable clock output ready */\n#define CLK_CCOR_CCOSEL      ((uint8_t)0x1E) /*!< Configurable clock output selection */\n#define CLK_CCOR_CCOEN       ((uint8_t)0x01) /*!< Configurable clock output enable */\n\n#define CLK_HSITRIMR_HSITRIM ((uint8_t)0x07) /*!< High speed internal oscillator trimmer */\n\n#define CLK_SWIMCCR_SWIMDIV  ((uint8_t)0x01) /*!< SWIM Clock Dividing Factor */\n\n/**\n  * @}\n  */\n\n/*----------------------------------------------------------------------------*/\n/**\n  * @brief  16-bit timer with complementary PWM outputs (TIM1)\n  */\n\ntypedef struct TIM1_struct\n{\n  __IO uint8_t CR1;   /*!< control register 1 */\n  __IO uint8_t CR2;   /*!< control register 2 */\n  __IO uint8_t SMCR;  /*!< Synchro mode control register */\n  __IO uint8_t ETR;   /*!< external trigger register */\n  __IO uint8_t IER;   /*!< interrupt enable register*/\n  __IO uint8_t SR1;   /*!< status register 1 */\n  __IO uint8_t SR2;   /*!< status register 2 */\n  __IO uint8_t EGR;   /*!< event generation register */\n  __IO uint8_t CCMR1; /*!< CC mode register 1 */\n  __IO uint8_t CCMR2; /*!< CC mode register 2 */\n  __IO uint8_t CCMR3; /*!< CC mode register 3 */\n  __IO uint8_t CCMR4; /*!< CC mode register 4 */\n  __IO uint8_t CCER1; /*!< CC enable register 1 */\n  __IO uint8_t CCER2; /*!< CC enable register 2 */\n  __IO uint8_t CNTRH; /*!< counter high */\n  __IO uint8_t CNTRL; /*!< counter low */\n  __IO uint8_t PSCRH; /*!< prescaler high */\n  __IO uint8_t PSCRL; /*!< prescaler low */\n  __IO uint8_t ARRH;  /*!< auto-reload register high */\n  __IO uint8_t ARRL;  /*!< auto-reload register low */\n  __IO uint8_t RCR;   /*!< Repetition Counter register */\n  __IO uint8_t CCR1H; /*!< capture/compare register 1 high */\n  __IO uint8_t CCR1L; /*!< capture/compare register 1 low */\n  __IO uint8_t CCR2H; /*!< capture/compare register 2 high */\n  __IO uint8_t CCR2L; /*!< capture/compare register 2 low */\n  __IO uint8_t CCR3H; /*!< capture/compare register 3 high */\n  __IO uint8_t CCR3L; /*!< capture/compare register 3 low */\n  __IO uint8_t CCR4H; /*!< capture/compare register 3 high */\n  __IO uint8_t CCR4L; /*!< capture/compare register 3 low */\n  __IO uint8_t BKR;   /*!< Break Register */\n  __IO uint8_t DTR;   /*!< dead-time register */\n  __IO uint8_t OISR;  /*!< Output idle register */\n}\nTIM1_TypeDef;\n\n/** @addtogroup TIM1_Registers_Reset_Value\n  * @{\n  */\n\n#define TIM1_CR1_RESET_VALUE   ((uint8_t)0x00)\n#define TIM1_CR2_RESET_VALUE   ((uint8_t)0x00)\n#define TIM1_SMCR_RESET_VALUE  ((uint8_t)0x00)\n#define TIM1_ETR_RESET_VALUE   ((uint8_t)0x00)\n#define TIM1_IER_RESET_VALUE   ((uint8_t)0x00)\n#define TIM1_SR1_RESET_VALUE   ((uint8_t)0x00)\n#define TIM1_SR2_RESET_VALUE   ((uint8_t)0x00)\n#define TIM1_EGR_RESET_VALUE   ((uint8_t)0x00)\n#define TIM1_CCMR1_RESET_VALUE ((uint8_t)0x00)\n#define TIM1_CCMR2_RESET_VALUE ((uint8_t)0x00)\n#define TIM1_CCMR3_RESET_VALUE ((uint8_t)0x00)\n#define TIM1_CCMR4_RESET_VALUE ((uint8_t)0x00)\n#define TIM1_CCER1_RESET_VALUE ((uint8_t)0x00)\n#define TIM1_CCER2_RESET_VALUE ((uint8_t)0x00)\n#define TIM1_CNTRH_RESET_VALUE ((uint8_t)0x00)\n#define TIM1_CNTRL_RESET_VALUE ((uint8_t)0x00)\n#define TIM1_PSCRH_RESET_VALUE ((uint8_t)0x00)\n#define TIM1_PSCRL_RESET_VALUE ((uint8_t)0x00)\n#define TIM1_ARRH_RESET_VALUE  ((uint8_t)0xFF)\n#define TIM1_ARRL_RESET_VALUE  ((uint8_t)0xFF)\n#define TIM1_RCR_RESET_VALUE   ((uint8_t)0x00)\n#define TIM1_CCR1H_RESET_VALUE ((uint8_t)0x00)\n#define TIM1_CCR1L_RESET_VALUE ((uint8_t)0x00)\n#define TIM1_CCR2H_RESET_VALUE ((uint8_t)0x00)\n#define TIM1_CCR2L_RESET_VALUE ((uint8_t)0x00)\n#define TIM1_CCR3H_RESET_VALUE ((uint8_t)0x00)\n#define TIM1_CCR3L_RESET_VALUE ((uint8_t)0x00)\n#define TIM1_CCR4H_RESET_VALUE ((uint8_t)0x00)\n#define TIM1_CCR4L_RESET_VALUE ((uint8_t)0x00)\n#define TIM1_BKR_RESET_VALUE   ((uint8_t)0x00)\n#define TIM1_DTR_RESET_VALUE   ((uint8_t)0x00)\n#define TIM1_OISR_RESET_VALUE  ((uint8_t)0x00)\n\n/**\n  * @}\n  */\n\n/** @addtogroup TIM1_Registers_Bits_Definition\n  * @{\n  */\n/* CR1*/\n#define TIM1_CR1_ARPE    ((uint8_t)0x80) /*!< Auto-Reload Preload Enable mask. */\n#define TIM1_CR1_CMS     ((uint8_t)0x60) /*!< Center-aligned Mode Selection mask. */\n#define TIM1_CR1_DIR     ((uint8_t)0x10) /*!< Direction mask. */\n#define TIM1_CR1_OPM     ((uint8_t)0x08) /*!< One Pulse Mode mask. */\n#define TIM1_CR1_URS     ((uint8_t)0x04) /*!< Update Request Source mask. */\n#define TIM1_CR1_UDIS    ((uint8_t)0x02) /*!< Update DIsable mask. */\n#define TIM1_CR1_CEN     ((uint8_t)0x01) /*!< Counter Enable mask. */\n/* CR2*/\n#define TIM1_CR2_TI1S    ((uint8_t)0x80) /*!< TI1S Selection mask. */\n#define TIM1_CR2_MMS     ((uint8_t)0x70) /*!< MMS Selection mask. */\n#define TIM1_CR2_COMS    ((uint8_t)0x04) /*!< Capture/Compare Control Update Selection mask. */\n#define TIM1_CR2_CCPC    ((uint8_t)0x01) /*!< Capture/Compare Preloaded Control mask. */\n/* SMCR*/\n#define TIM1_SMCR_MSM    ((uint8_t)0x80) /*!< Master/Slave Mode mask. */\n#define TIM1_SMCR_TS     ((uint8_t)0x70) /*!< Trigger Selection mask. */\n#define TIM1_SMCR_SMS    ((uint8_t)0x07) /*!< Slave Mode Selection mask. */\n/*ETR*/\n#define TIM1_ETR_ETP     ((uint8_t)0x80) /*!< External Trigger Polarity mask. */\n#define TIM1_ETR_ECE     ((uint8_t)0x40)/*!< External Clock mask. */\n#define TIM1_ETR_ETPS    ((uint8_t)0x30) /*!< External Trigger Prescaler mask. */\n#define TIM1_ETR_ETF     ((uint8_t)0x0F) /*!< External Trigger Filter mask. */\n/*IER*/\n#define TIM1_IER_BIE     ((uint8_t)0x80) /*!< Break Interrupt Enable mask. */\n#define TIM1_IER_TIE     ((uint8_t)0x40) /*!< Trigger Interrupt Enable mask. */\n#define TIM1_IER_COMIE   ((uint8_t)0x20) /*!<  Commutation Interrupt Enable mask.*/\n#define TIM1_IER_CC4IE   ((uint8_t)0x10) /*!< Capture/Compare 4 Interrupt Enable mask. */\n#define TIM1_IER_CC3IE   ((uint8_t)0x08) /*!< Capture/Compare 3 Interrupt Enable mask. */\n#define TIM1_IER_CC2IE   ((uint8_t)0x04) /*!< Capture/Compare 2 Interrupt Enable mask. */\n#define TIM1_IER_CC1IE   ((uint8_t)0x02) /*!< Capture/Compare 1 Interrupt Enable mask. */\n#define TIM1_IER_UIE     ((uint8_t)0x01) /*!< Update Interrupt Enable mask. */\n/*SR1*/\n#define TIM1_SR1_BIF     ((uint8_t)0x80) /*!< Break Interrupt Flag mask. */\n#define TIM1_SR1_TIF     ((uint8_t)0x40) /*!< Trigger Interrupt Flag mask. */\n#define TIM1_SR1_COMIF   ((uint8_t)0x20) /*!< Commutation Interrupt Flag mask. */\n#define TIM1_SR1_CC4IF   ((uint8_t)0x10) /*!< Capture/Compare 4 Interrupt Flag mask. */\n#define TIM1_SR1_CC3IF   ((uint8_t)0x08) /*!< Capture/Compare 3 Interrupt Flag mask. */\n#define TIM1_SR1_CC2IF   ((uint8_t)0x04) /*!< Capture/Compare 2 Interrupt Flag mask. */\n#define TIM1_SR1_CC1IF   ((uint8_t)0x02) /*!< Capture/Compare 1 Interrupt Flag mask. */\n#define TIM1_SR1_UIF     ((uint8_t)0x01) /*!< Update Interrupt Flag mask. */\n/*SR2*/\n#define TIM1_SR2_CC4OF   ((uint8_t)0x10) /*!< Capture/Compare 4 Overcapture Flag mask. */\n#define TIM1_SR2_CC3OF   ((uint8_t)0x08) /*!< Capture/Compare 3 Overcapture Flag mask. */\n#define TIM1_SR2_CC2OF   ((uint8_t)0x04) /*!< Capture/Compare 2 Overcapture Flag mask. */\n#define TIM1_SR2_CC1OF   ((uint8_t)0x02) /*!< Capture/Compare 1 Overcapture Flag mask. */\n/*EGR*/\n#define TIM1_EGR_BG      ((uint8_t)0x80) /*!< Break Generation mask. */\n#define TIM1_EGR_TG      ((uint8_t)0x40) /*!< Trigger Generation mask. */\n#define TIM1_EGR_COMG    ((uint8_t)0x20) /*!< Capture/Compare Control Update Generation mask. */\n#define TIM1_EGR_CC4G    ((uint8_t)0x10) /*!< Capture/Compare 4 Generation mask. */\n#define TIM1_EGR_CC3G    ((uint8_t)0x08) /*!< Capture/Compare 3 Generation mask. */\n#define TIM1_EGR_CC2G    ((uint8_t)0x04) /*!< Capture/Compare 2 Generation mask. */\n#define TIM1_EGR_CC1G    ((uint8_t)0x02) /*!< Capture/Compare 1 Generation mask. */\n#define TIM1_EGR_UG      ((uint8_t)0x01) /*!< Update Generation mask. */\n/*CCMR*/\n#define TIM1_CCMR_ICxPSC ((uint8_t)0x0C) /*!< Input Capture x Prescaler mask. */\n#define TIM1_CCMR_ICxF   ((uint8_t)0xF0) /*!< Input Capture x Filter mask. */\n#define TIM1_CCMR_OCM    ((uint8_t)0x70) /*!< Output Compare x Mode mask. */\n#define TIM1_CCMR_OCxPE  ((uint8_t)0x08) /*!< Output Compare x Preload Enable mask. */\n#define TIM1_CCMR_OCxFE  ((uint8_t)0x04) /*!< Output Compare x Fast Enable mask. */\n#define TIM1_CCMR_CCxS   ((uint8_t)0x03) /*!< Capture/Compare x Selection mask. */\n\n#define CCMR_TIxDirect_Set ((uint8_t)0x01)\n/*CCER1*/\n#define TIM1_CCER1_CC2NP ((uint8_t)0x80) /*!< Capture/Compare 2 Complementary output Polarity mask. */\n#define TIM1_CCER1_CC2NE ((uint8_t)0x40) /*!< Capture/Compare 2 Complementary output enable mask. */\n#define TIM1_CCER1_CC2P  ((uint8_t)0x20) /*!< Capture/Compare 2 output Polarity mask. */\n#define TIM1_CCER1_CC2E  ((uint8_t)0x10) /*!< Capture/Compare 2 output enable mask. */\n#define TIM1_CCER1_CC1NP ((uint8_t)0x08) /*!< Capture/Compare 1 Complementary output Polarity mask. */\n#define TIM1_CCER1_CC1NE ((uint8_t)0x04) /*!< Capture/Compare 1 Complementary output enable mask. */\n#define TIM1_CCER1_CC1P  ((uint8_t)0x02) /*!< Capture/Compare 1 output Polarity mask. */\n#define TIM1_CCER1_CC1E  ((uint8_t)0x01) /*!< Capture/Compare 1 output enable mask. */\n/*CCER2*/\n#define TIM1_CCER2_CC4P  ((uint8_t)0x20) /*!< Capture/Compare 4 output Polarity mask. */\n#define TIM1_CCER2_CC4E  ((uint8_t)0x10) /*!< Capture/Compare 4 output enable mask. */\n#define TIM1_CCER2_CC3NP ((uint8_t)0x08) /*!< Capture/Compare 3 Complementary output Polarity mask. */\n#define TIM1_CCER2_CC3NE ((uint8_t)0x04) /*!< Capture/Compare 3 Complementary output enable mask. */\n#define TIM1_CCER2_CC3P  ((uint8_t)0x02) /*!< Capture/Compare 3 output Polarity mask. */\n#define TIM1_CCER2_CC3E  ((uint8_t)0x01) /*!< Capture/Compare 3 output enable mask. */\n/*CNTRH*/\n#define TIM1_CNTRH_CNT   ((uint8_t)0xFF) /*!< Counter Value (MSB) mask. */\n/*CNTRL*/\n#define TIM1_CNTRL_CNT   ((uint8_t)0xFF) /*!< Counter Value (LSB) mask. */\n/*PSCH*/\n#define TIM1_PSCH_PSC    ((uint8_t)0xFF) /*!< Prescaler Value (MSB) mask. */\n/*PSCL*/\n#define TIM1_PSCL_PSC    ((uint8_t)0xFF) /*!< Prescaler Value (LSB) mask. */\n/*ARR*/\n#define TIM1_ARRH_ARR    ((uint8_t)0xFF) /*!< Autoreload Value (MSB) mask. */\n#define TIM1_ARRL_ARR    ((uint8_t)0xFF) /*!< Autoreload Value (LSB) mask. */\n/*RCR*/\n#define TIM1_RCR_REP     ((uint8_t)0xFF) /*!< Repetition Counter Value mask. */\n/*CCR1*/\n#define TIM1_CCR1H_CCR1  ((uint8_t)0xFF) /*!< Capture/Compare 1 Value (MSB) mask. */\n#define TIM1_CCR1L_CCR1  ((uint8_t)0xFF) /*!< Capture/Compare 1 Value (LSB) mask. */\n/*CCR2*/\n#define TIM1_CCR2H_CCR2  ((uint8_t)0xFF) /*!< Capture/Compare 2 Value (MSB) mask. */\n#define TIM1_CCR2L_CCR2  ((uint8_t)0xFF) /*!< Capture/Compare 2 Value (LSB) mask. */\n/*CCR3*/\n#define TIM1_CCR3H_CCR3  ((uint8_t)0xFF) /*!< Capture/Compare 3 Value (MSB) mask. */\n#define TIM1_CCR3L_CCR3  ((uint8_t)0xFF) /*!< Capture/Compare 3 Value (LSB) mask. */\n/*CCR4*/\n#define TIM1_CCR4H_CCR4  ((uint8_t)0xFF) /*!< Capture/Compare 4 Value (MSB) mask. */\n#define TIM1_CCR4L_CCR4  ((uint8_t)0xFF) /*!< Capture/Compare 4 Value (LSB) mask. */\n/*BKR*/\n#define TIM1_BKR_MOE     ((uint8_t)0x80) /*!< Main Output Enable mask. */\n#define TIM1_BKR_AOE     ((uint8_t)0x40) /*!< Automatic Output Enable mask. */\n#define TIM1_BKR_BKP     ((uint8_t)0x20) /*!< Break Polarity mask. */\n#define TIM1_BKR_BKE     ((uint8_t)0x10) /*!< Break Enable mask. */\n#define TIM1_BKR_OSSR    ((uint8_t)0x08) /*!< Off-State Selection for Run mode mask. */\n#define TIM1_BKR_OSSI    ((uint8_t)0x04) /*!< Off-State Selection for Idle mode mask. */\n#define TIM1_BKR_LOCK    ((uint8_t)0x03) /*!< Lock Configuration mask. */\n/*DTR*/\n#define TIM1_DTR_DTG     ((uint8_t)0xFF) /*!< Dead-Time Generator set-up mask. */\n/*OISR*/\n#define TIM1_OISR_OIS4   ((uint8_t)0x40) /*!< Output Idle state 4 (OC4 output) mask. */\n#define TIM1_OISR_OIS3N  ((uint8_t)0x20) /*!< Output Idle state 3 (OC3N output) mask. */\n#define TIM1_OISR_OIS3   ((uint8_t)0x10) /*!< Output Idle state 3 (OC3 output) mask. */\n#define TIM1_OISR_OIS2N  ((uint8_t)0x08) /*!< Output Idle state 2 (OC2N output) mask. */\n#define TIM1_OISR_OIS2   ((uint8_t)0x04) /*!< Output Idle state 2 (OC2 output) mask. */\n#define TIM1_OISR_OIS1N  ((uint8_t)0x02) /*!< Output Idle state 1 (OC1N output) mask. */\n#define TIM1_OISR_OIS1   ((uint8_t)0x01) /*!< Output Idle state 1 (OC1 output) mask. */\n/**\n  * @}\n  */\n\n/*----------------------------------------------------------------------------*/\n/**\n  * @brief  16-bit timer (TIM2)\n  */\n\ntypedef struct TIM2_struct\n{\n  __IO uint8_t CR1;   /*!< control register 1 */\n#if defined(STM8S103) || defined(STM8S003) || defined(STM8S001)\n\tuint8_t RESERVED1; /*!< Reserved register */\n\tuint8_t RESERVED2; /*!< Reserved register */\n#endif\n  __IO uint8_t IER;   /*!< interrupt enable register */\n  __IO uint8_t SR1;   /*!< status register 1 */\n  __IO uint8_t SR2;   /*!< status register 2 */\n  __IO uint8_t EGR;   /*!< event generation register */\n  __IO uint8_t CCMR1; /*!< CC mode register 1 */\n  __IO uint8_t CCMR2; /*!< CC mode register 2 */\n  __IO uint8_t CCMR3; /*!< CC mode register 3 */\n  __IO uint8_t CCER1; /*!< CC enable register 1 */\n  __IO uint8_t CCER2; /*!< CC enable register 2 */\n  __IO uint8_t CNTRH; /*!< counter high */\n  __IO uint8_t CNTRL; /*!< counter low */\n  __IO uint8_t PSCR;  /*!< prescaler register */\n  __IO uint8_t ARRH;  /*!< auto-reload register high */\n  __IO uint8_t ARRL;  /*!< auto-reload register low */\n  __IO uint8_t CCR1H; /*!< capture/compare register 1 high */\n  __IO uint8_t CCR1L; /*!< capture/compare register 1 low */\n  __IO uint8_t CCR2H; /*!< capture/compare register 2 high */\n  __IO uint8_t CCR2L; /*!< capture/compare register 2 low */\n  __IO uint8_t CCR3H; /*!< capture/compare register 3 high */\n  __IO uint8_t CCR3L; /*!< capture/compare register 3 low */\n}\nTIM2_TypeDef;\n\n/** @addtogroup TIM2_Registers_Reset_Value\n  * @{\n  */\n\n#define TIM2_CR1_RESET_VALUE   ((uint8_t)0x00)\n#define TIM2_IER_RESET_VALUE   ((uint8_t)0x00)\n#define TIM2_SR1_RESET_VALUE   ((uint8_t)0x00)\n#define TIM2_SR2_RESET_VALUE   ((uint8_t)0x00)\n#define TIM2_EGR_RESET_VALUE   ((uint8_t)0x00)\n#define TIM2_CCMR1_RESET_VALUE ((uint8_t)0x00)\n#define TIM2_CCMR2_RESET_VALUE ((uint8_t)0x00)\n#define TIM2_CCMR3_RESET_VALUE ((uint8_t)0x00)\n#define TIM2_CCER1_RESET_VALUE ((uint8_t)0x00)\n#define TIM2_CCER2_RESET_VALUE ((uint8_t)0x00)\n#define TIM2_CNTRH_RESET_VALUE ((uint8_t)0x00)\n#define TIM2_CNTRL_RESET_VALUE ((uint8_t)0x00)\n#define TIM2_PSCR_RESET_VALUE  ((uint8_t)0x00)\n#define TIM2_ARRH_RESET_VALUE  ((uint8_t)0xFF)\n#define TIM2_ARRL_RESET_VALUE  ((uint8_t)0xFF)\n#define TIM2_CCR1H_RESET_VALUE ((uint8_t)0x00)\n#define TIM2_CCR1L_RESET_VALUE ((uint8_t)0x00)\n#define TIM2_CCR2H_RESET_VALUE ((uint8_t)0x00)\n#define TIM2_CCR2L_RESET_VALUE ((uint8_t)0x00)\n#define TIM2_CCR3H_RESET_VALUE ((uint8_t)0x00)\n#define TIM2_CCR3L_RESET_VALUE ((uint8_t)0x00)\n\n/**\n  * @}\n  */\n\n/** @addtogroup TIM2_Registers_Bits_Definition\n  * @{\n  */\n/*CR1*/\n#define TIM2_CR1_ARPE    ((uint8_t)0x80) /*!< Auto-Reload Preload Enable mask. */\n#define TIM2_CR1_OPM     ((uint8_t)0x08) /*!< One Pulse Mode mask. */\n#define TIM2_CR1_URS     ((uint8_t)0x04) /*!< Update Request Source mask. */\n#define TIM2_CR1_UDIS    ((uint8_t)0x02) /*!< Update DIsable mask. */\n#define TIM2_CR1_CEN     ((uint8_t)0x01) /*!< Counter Enable mask. */\n/*IER*/\n#define TIM2_IER_CC3IE   ((uint8_t)0x08) /*!< Capture/Compare 3 Interrupt Enable mask. */\n#define TIM2_IER_CC2IE   ((uint8_t)0x04) /*!< Capture/Compare 2 Interrupt Enable mask. */\n#define TIM2_IER_CC1IE   ((uint8_t)0x02) /*!< Capture/Compare 1 Interrupt Enable mask. */\n#define TIM2_IER_UIE     ((uint8_t)0x01) /*!< Update Interrupt Enable mask. */\n/*SR1*/\n#define TIM2_SR1_CC3IF   ((uint8_t)0x08) /*!< Capture/Compare 3 Interrupt Flag mask. */\n#define TIM2_SR1_CC2IF   ((uint8_t)0x04) /*!< Capture/Compare 2 Interrupt Flag mask. */\n#define TIM2_SR1_CC1IF   ((uint8_t)0x02) /*!< Capture/Compare 1 Interrupt Flag mask. */\n#define TIM2_SR1_UIF     ((uint8_t)0x01) /*!< Update Interrupt Flag mask. */\n/*SR2*/\n#define TIM2_SR2_CC3OF   ((uint8_t)0x08) /*!< Capture/Compare 3 Overcapture Flag mask. */\n#define TIM2_SR2_CC2OF   ((uint8_t)0x04) /*!< Capture/Compare 2 Overcapture Flag mask. */\n#define TIM2_SR2_CC1OF   ((uint8_t)0x02) /*!< Capture/Compare 1 Overcapture Flag mask. */\n/*EGR*/\n#define TIM2_EGR_CC3G    ((uint8_t)0x08) /*!< Capture/Compare 3 Generation mask. */\n#define TIM2_EGR_CC2G    ((uint8_t)0x04) /*!< Capture/Compare 2 Generation mask. */\n#define TIM2_EGR_CC1G    ((uint8_t)0x02) /*!< Capture/Compare 1 Generation mask. */\n#define TIM2_EGR_UG      ((uint8_t)0x01) /*!< Update Generation mask. */\n/*CCMR*/\n#define TIM2_CCMR_ICxPSC ((uint8_t)0x0C) /*!< Input Capture x Prescaler mask. */\n#define TIM2_CCMR_ICxF   ((uint8_t)0xF0) /*!< Input Capture x Filter mask. */\n#define TIM2_CCMR_OCM    ((uint8_t)0x70) /*!< Output Compare x Mode mask. */\n#define TIM2_CCMR_OCxPE  ((uint8_t)0x08) /*!< Output Compare x Preload Enable mask. */\n#define TIM2_CCMR_CCxS   ((uint8_t)0x03) /*!< Capture/Compare x Selection mask. */\n/*CCER1*/\n#define TIM2_CCER1_CC2P  ((uint8_t)0x20) /*!< Capture/Compare 2 output Polarity mask. */\n#define TIM2_CCER1_CC2E  ((uint8_t)0x10) /*!< Capture/Compare 2 output enable mask. */\n#define TIM2_CCER1_CC1P  ((uint8_t)0x02) /*!< Capture/Compare 1 output Polarity mask. */\n#define TIM2_CCER1_CC1E  ((uint8_t)0x01) /*!< Capture/Compare 1 output enable mask. */\n/*CCER2*/\n#define TIM2_CCER2_CC3P  ((uint8_t)0x02) /*!< Capture/Compare 3 output Polarity mask. */\n#define TIM2_CCER2_CC3E  ((uint8_t)0x01) /*!< Capture/Compare 3 output enable mask. */\n/*CNTR*/\n#define TIM2_CNTRH_CNT   ((uint8_t)0xFF) /*!< Counter Value (MSB) mask. */\n#define TIM2_CNTRL_CNT   ((uint8_t)0xFF) /*!< Counter Value (LSB) mask. */\n/*PSCR*/\n#define TIM2_PSCR_PSC    ((uint8_t)0xFF) /*!< Prescaler Value (MSB) mask. */\n/*ARR*/\n#define TIM2_ARRH_ARR    ((uint8_t)0xFF) /*!< Autoreload Value (MSB) mask. */\n#define TIM2_ARRL_ARR    ((uint8_t)0xFF) /*!< Autoreload Value (LSB) mask. */\n/*CCR1*/\n#define TIM2_CCR1H_CCR1  ((uint8_t)0xFF) /*!< Capture/Compare 1 Value (MSB) mask. */\n#define TIM2_CCR1L_CCR1  ((uint8_t)0xFF) /*!< Capture/Compare 1 Value (LSB) mask. */\n/*CCR2*/\n#define TIM2_CCR2H_CCR2  ((uint8_t)0xFF) /*!< Capture/Compare 2 Value (MSB) mask. */\n#define TIM2_CCR2L_CCR2  ((uint8_t)0xFF) /*!< Capture/Compare 2 Value (LSB) mask. */\n/*CCR3*/\n#define TIM2_CCR3H_CCR3  ((uint8_t)0xFF) /*!< Capture/Compare 3 Value (MSB) mask. */\n#define TIM2_CCR3L_CCR3  ((uint8_t)0xFF) /*!< Capture/Compare 3 Value (LSB) mask. */\n\n/**\n  * @}\n  */\n\n/*----------------------------------------------------------------------------*/\n/**\n  * @brief  16-bit timer (TIM3)\n  */\ntypedef struct TIM3_struct\n{\n  __IO uint8_t CR1;   /*!< control register 1 */\n  __IO uint8_t IER;   /*!< interrupt enable register */\n  __IO uint8_t SR1;   /*!< status register 1 */\n  __IO uint8_t SR2;   /*!< status register 2 */\n  __IO uint8_t EGR;   /*!< event generation register */\n  __IO uint8_t CCMR1; /*!< CC mode register 1 */\n  __IO uint8_t CCMR2; /*!< CC mode register 2 */\n  __IO uint8_t CCER1; /*!< CC enable register 1 */\n  __IO uint8_t CNTRH; /*!< counter high */\n  __IO uint8_t CNTRL; /*!< counter low */\n  __IO uint8_t PSCR;  /*!< prescaler register */\n  __IO uint8_t ARRH;  /*!< auto-reload register high */\n  __IO uint8_t ARRL;  /*!< auto-reload register low */\n  __IO uint8_t CCR1H; /*!< capture/compare register 1 high */\n  __IO uint8_t CCR1L; /*!< capture/compare register 1 low */\n  __IO uint8_t CCR2H; /*!< capture/compare register 2 high */\n  __IO uint8_t CCR2L; /*!< capture/compare register 2 low */\n}\nTIM3_TypeDef;\n\n/** @addtogroup TIM3_Registers_Reset_Value\n  * @{\n  */\n\n#define TIM3_CR1_RESET_VALUE   ((uint8_t)0x00)\n#define TIM3_IER_RESET_VALUE   ((uint8_t)0x00)\n#define TIM3_SR1_RESET_VALUE   ((uint8_t)0x00)\n#define TIM3_SR2_RESET_VALUE   ((uint8_t)0x00)\n#define TIM3_EGR_RESET_VALUE   ((uint8_t)0x00)\n#define TIM3_CCMR1_RESET_VALUE ((uint8_t)0x00)\n#define TIM3_CCMR2_RESET_VALUE ((uint8_t)0x00)\n#define TIM3_CCER1_RESET_VALUE ((uint8_t)0x00)\n#define TIM3_CNTRH_RESET_VALUE ((uint8_t)0x00)\n#define TIM3_CNTRL_RESET_VALUE ((uint8_t)0x00)\n#define TIM3_PSCR_RESET_VALUE  ((uint8_t)0x00)\n#define TIM3_ARRH_RESET_VALUE  ((uint8_t)0xFF)\n#define TIM3_ARRL_RESET_VALUE  ((uint8_t)0xFF)\n#define TIM3_CCR1H_RESET_VALUE ((uint8_t)0x00)\n#define TIM3_CCR1L_RESET_VALUE ((uint8_t)0x00)\n#define TIM3_CCR2H_RESET_VALUE ((uint8_t)0x00)\n#define TIM3_CCR2L_RESET_VALUE ((uint8_t)0x00)\n\n/**\n  * @}\n  */\n\n/** @addtogroup TIM3_Registers_Bits_Definition\n  * @{\n  */\n/*CR1*/\n#define TIM3_CR1_ARPE    ((uint8_t)0x80) /*!< Auto-Reload Preload Enable mask. */\n#define TIM3_CR1_OPM     ((uint8_t)0x08) /*!< One Pulse Mode mask. */\n#define TIM3_CR1_URS     ((uint8_t)0x04) /*!< Update Request Source mask. */\n#define TIM3_CR1_UDIS    ((uint8_t)0x02) /*!< Update DIsable mask. */\n#define TIM3_CR1_CEN     ((uint8_t)0x01) /*!< Counter Enable mask. */\n/*IER*/\n#define TIM3_IER_CC2IE   ((uint8_t)0x04) /*!< Capture/Compare 2 Interrupt Enable mask. */\n#define TIM3_IER_CC1IE   ((uint8_t)0x02) /*!< Capture/Compare 1 Interrupt Enable mask. */\n#define TIM3_IER_UIE     ((uint8_t)0x01) /*!< Update Interrupt Enable mask. */\n/*SR1*/\n#define TIM3_SR1_CC2IF   ((uint8_t)0x04) /*!< Capture/Compare 2 Interrupt Flag mask. */\n#define TIM3_SR1_CC1IF   ((uint8_t)0x02) /*!< Capture/Compare 1 Interrupt Flag mask. */\n#define TIM3_SR1_UIF     ((uint8_t)0x01) /*!< Update Interrupt Flag mask. */\n/*SR2*/\n#define TIM3_SR2_CC2OF   ((uint8_t)0x04) /*!< Capture/Compare 2 Overcapture Flag mask. */\n#define TIM3_SR2_CC1OF   ((uint8_t)0x02) /*!< Capture/Compare 1 Overcapture Flag mask. */\n/*EGR*/\n#define TIM3_EGR_CC2G    ((uint8_t)0x04) /*!< Capture/Compare 2 Generation mask. */\n#define TIM3_EGR_CC1G    ((uint8_t)0x02) /*!< Capture/Compare 1 Generation mask. */\n#define TIM3_EGR_UG      ((uint8_t)0x01) /*!< Update Generation mask. */\n/*CCMR*/\n#define TIM3_CCMR_ICxPSC ((uint8_t)0x0C) /*!< Input Capture x Prescaler mask. */\n#define TIM3_CCMR_ICxF   ((uint8_t)0xF0) /*!< Input Capture x Filter mask. */\n#define TIM3_CCMR_OCM    ((uint8_t)0x70) /*!< Output Compare x Mode mask. */\n#define TIM3_CCMR_OCxPE  ((uint8_t)0x08) /*!< Output Compare x Preload Enable mask. */\n#define TIM3_CCMR_CCxS   ((uint8_t)0x03) /*!< Capture/Compare x Selection mask. */\n/*CCER1*/\n#define TIM3_CCER1_CC2P  ((uint8_t)0x20) /*!< Capture/Compare 2 output Polarity mask. */\n#define TIM3_CCER1_CC2E  ((uint8_t)0x10) /*!< Capture/Compare 2 output enable mask. */\n#define TIM3_CCER1_CC1P  ((uint8_t)0x02) /*!< Capture/Compare 1 output Polarity mask. */\n#define TIM3_CCER1_CC1E  ((uint8_t)0x01) /*!< Capture/Compare 1 output enable mask. */\n/*CNTR*/\n#define TIM3_CNTRH_CNT   ((uint8_t)0xFF) /*!< Counter Value (MSB) mask. */\n#define TIM3_CNTRL_CNT   ((uint8_t)0xFF) /*!< Counter Value (LSB) mask. */\n/*PSCR*/\n#define TIM3_PSCR_PSC    ((uint8_t)0xFF) /*!< Prescaler Value (MSB) mask. */\n/*ARR*/\n#define TIM3_ARRH_ARR    ((uint8_t)0xFF) /*!< Autoreload Value (MSB) mask. */\n#define TIM3_ARRL_ARR    ((uint8_t)0xFF) /*!< Autoreload Value (LSB) mask. */\n/*CCR1*/\n#define TIM3_CCR1H_CCR1  ((uint8_t)0xFF) /*!< Capture/Compare 1 Value (MSB) mask. */\n#define TIM3_CCR1L_CCR1  ((uint8_t)0xFF) /*!< Capture/Compare 1 Value (LSB) mask. */\n/*CCR2*/\n#define TIM3_CCR2H_CCR2  ((uint8_t)0xFF) /*!< Capture/Compare 2 Value (MSB) mask. */\n#define TIM3_CCR2L_CCR2  ((uint8_t)0xFF) /*!< Capture/Compare 2 Value (LSB) mask. */\n/**\n  * @}\n  */\n\n/*----------------------------------------------------------------------------*/\n/**\n  * @brief  8-bit system timer (TIM4)\n  */\n\ntypedef struct TIM4_struct\n{\n  __IO uint8_t CR1;  /*!< control register 1 */\n#if defined(STM8S103) || defined(STM8S003) || defined(STM8S001)\n\tuint8_t RESERVED1; /*!< Reserved register */\n\tuint8_t RESERVED2; /*!< Reserved register */\n#endif\n  __IO uint8_t IER;  /*!< interrupt enable register */\n  __IO uint8_t SR1;  /*!< status register 1 */\n  __IO uint8_t EGR;  /*!< event generation register */\n  __IO uint8_t CNTR; /*!< counter register */\n  __IO uint8_t PSCR; /*!< prescaler register */\n  __IO uint8_t ARR;  /*!< auto-reload register */\n}\nTIM4_TypeDef;\n\n/** @addtogroup TIM4_Registers_Reset_Value\n  * @{\n  */\n\n#define TIM4_CR1_RESET_VALUE  ((uint8_t)0x00)\n#define TIM4_IER_RESET_VALUE  ((uint8_t)0x00)\n#define TIM4_SR1_RESET_VALUE  ((uint8_t)0x00)\n#define TIM4_EGR_RESET_VALUE  ((uint8_t)0x00)\n#define TIM4_CNTR_RESET_VALUE ((uint8_t)0x00)\n#define TIM4_PSCR_RESET_VALUE ((uint8_t)0x00)\n#define TIM4_ARR_RESET_VALUE  ((uint8_t)0xFF)\n\n/**\n  * @}\n  */\n\n/** @addtogroup TIM4_Registers_Bits_Definition\n  * @{\n  */\n/*CR1*/\n#define TIM4_CR1_ARPE ((uint8_t)0x80) /*!< Auto-Reload Preload Enable mask. */\n#define TIM4_CR1_OPM  ((uint8_t)0x08) /*!< One Pulse Mode mask. */\n#define TIM4_CR1_URS  ((uint8_t)0x04) /*!< Update Request Source mask. */\n#define TIM4_CR1_UDIS ((uint8_t)0x02) /*!< Update DIsable mask. */\n#define TIM4_CR1_CEN  ((uint8_t)0x01) /*!< Counter Enable mask. */\n/*IER*/\n#define TIM4_IER_UIE  ((uint8_t)0x01) /*!< Update Interrupt Enable mask. */\n/*SR1*/\n#define TIM4_SR1_UIF  ((uint8_t)0x01) /*!< Update Interrupt Flag mask. */\n/*EGR*/\n#define TIM4_EGR_UG   ((uint8_t)0x01) /*!< Update Generation mask. */\n/*CNTR*/\n#define TIM4_CNTR_CNT ((uint8_t)0xFF) /*!< Counter Value (LSB) mask. */\n/*PSCR*/\n#define TIM4_PSCR_PSC ((uint8_t)0x07) /*!< Prescaler Value  mask. */\n/*ARR*/\n#define TIM4_ARR_ARR  ((uint8_t)0xFF) /*!< Autoreload Value mask. */\n\n/**\n  * @}\n  */\n\n/*----------------------------------------------------------------------------*/\n/**\n  * @brief  16-bit timer with synchro module (TIM5)\n  */\n\ntypedef struct TIM5_struct\n{\n  __IO uint8_t CR1;       /*!<TIM5 Control Register 1                */\n  __IO uint8_t CR2;       /*!<TIM5 Control Register 2                */\n  __IO uint8_t SMCR;      /*!<TIM5 Slave Mode Control Register       */\n  __IO uint8_t IER;       /*!<TIM5 Interrupt Enable Register         */\n  __IO uint8_t SR1;       /*!<TIM5 Status Register 1                 */\n  __IO uint8_t SR2;       /*!<TIM5 Status Register 2                 */\n  __IO uint8_t EGR;       /*!<TIM5 Event Generation Register         */\n  __IO uint8_t CCMR1;     /*!<TIM5 Capture/Compare Mode Register 1   */\n  __IO uint8_t CCMR2;     /*!<TIM5 Capture/Compare Mode Register 2   */\n  __IO uint8_t CCMR3;     /*!<TIM5 Capture/Compare Mode Register 3   */\n  __IO uint8_t CCER1;     /*!<TIM5 Capture/Compare Enable Register 1 */\n  __IO uint8_t CCER2;     /*!<TIM5 Capture/Compare Enable Register 2 */\n  __IO uint8_t CNTRH;     /*!<TIM5 Counter High                      */\n  __IO uint8_t CNTRL;     /*!<TIM5 Counter Low                       */\n  __IO uint8_t PSCR;      /*!<TIM5 Prescaler Register                */\n  __IO uint8_t ARRH;      /*!<TIM5 Auto-Reload Register High         */\n  __IO uint8_t ARRL;      /*!<TIM5 Auto-Reload Register Low          */\n  __IO uint8_t CCR1H;     /*!<TIM5 Capture/Compare Register 1 High   */\n  __IO uint8_t CCR1L;     /*!<TIM5 Capture/Compare Register 1 Low    */\n  __IO uint8_t CCR2H;     /*!<TIM5 Capture/Compare Register 2 High   */\n  __IO uint8_t CCR2L;     /*!<TIM5 Capture/Compare Register 2 Low    */\n  __IO uint8_t CCR3H;     /*!<TIM5 Capture/Compare Register 3 High   */\n  __IO uint8_t CCR3L;     /*!<TIM5 Capture/Compare Register 3 Low    */\n}TIM5_TypeDef;\n\n/** @addtogroup TIM5_Registers_Reset_Value\n  * @{\n  */\n\n#define TIM5_CR1_RESET_VALUE   ((uint8_t)0x00)\n#define TIM5_CR2_RESET_VALUE \t ((uint8_t)0x00)\n#define TIM5_SMCR_RESET_VALUE\t ((uint8_t)0x00)\n#define TIM5_IER_RESET_VALUE   ((uint8_t)0x00)\n#define TIM5_SR1_RESET_VALUE   ((uint8_t)0x00)\n#define TIM5_SR2_RESET_VALUE   ((uint8_t)0x00)\n#define TIM5_EGR_RESET_VALUE   ((uint8_t)0x00)\n#define TIM5_CCMR1_RESET_VALUE ((uint8_t)0x00)\n#define TIM5_CCMR2_RESET_VALUE ((uint8_t)0x00)\n#define TIM5_CCMR3_RESET_VALUE ((uint8_t)0x00)\n#define TIM5_CCER1_RESET_VALUE ((uint8_t)0x00)\n#define TIM5_CCER2_RESET_VALUE ((uint8_t)0x00)\n#define TIM5_CNTRH_RESET_VALUE ((uint8_t)0x00)\n#define TIM5_CNTRL_RESET_VALUE ((uint8_t)0x00)\n#define TIM5_PSCR_RESET_VALUE  ((uint8_t)0x00)\n#define TIM5_ARRH_RESET_VALUE  ((uint8_t)0xFF)\n#define TIM5_ARRL_RESET_VALUE  ((uint8_t)0xFF)\n#define TIM5_CCR1H_RESET_VALUE ((uint8_t)0x00)\n#define TIM5_CCR1L_RESET_VALUE ((uint8_t)0x00)\n#define TIM5_CCR2H_RESET_VALUE ((uint8_t)0x00)\n#define TIM5_CCR2L_RESET_VALUE ((uint8_t)0x00)\n#define TIM5_CCR3H_RESET_VALUE ((uint8_t)0x00)\n#define TIM5_CCR3L_RESET_VALUE ((uint8_t)0x00)\n\n/**\n  * @}\n  */\n\n/** @addtogroup TIM5_Registers_Bits_Definition\n  * @{\n  */\n/* CR1*/\n#define TIM5_CR1_ARPE           ((uint8_t)0x80) /*!< Auto-Reload Preload Enable mask. */\n#define TIM5_CR1_OPM            ((uint8_t)0x08) /*!< One Pulse Mode mask. */\n#define TIM5_CR1_URS            ((uint8_t)0x04) /*!< Update Request Source mask. */\n#define TIM5_CR1_UDIS           ((uint8_t)0x02) /*!< Update DIsable mask. */\n#define TIM5_CR1_CEN            ((uint8_t)0x01) /*!< Counter Enable mask. */\n/* CR2*/\n#define TIM5_CR2_TI1S \t        ((uint8_t)0x80) /*!< TI1S Selection Mask. */\n#define\tTIM5_CR2_MMS\t          ((uint8_t)0x70) /*!< MMS Selection Mask. */\n/* SMCR*/\n#define TIM5_SMCR_MSM           ((uint8_t)0x80) /*!< Master/Slave Mode Mask. */\n#define TIM5_SMCR_TS            ((uint8_t)0x70) /*!< Trigger Selection Mask. */\n#define TIM5_SMCR_SMS           ((uint8_t)0x07) /*!< Slave Mode Selection Mask. */\n/*IER*/\n#define TIM5_IER_TIE            ((uint8_t)0x40) /*!< Trigger Interrupt Enable mask. */\n#define TIM5_IER_CC3IE          ((uint8_t)0x08) /*!< Capture/Compare 3 Interrupt Enable mask. */\n#define TIM5_IER_CC2IE          ((uint8_t)0x04) /*!< Capture/Compare 2 Interrupt Enable mask. */\n#define TIM5_IER_CC1IE          ((uint8_t)0x02) /*!< Capture/Compare 1 Interrupt Enable mask. */\n#define TIM5_IER_UIE            ((uint8_t)0x01) /*!< Update Interrupt Enable mask. */\n/*SR1*/\n#define TIM5_SR1_TIF            ((uint8_t)0x40) /*!< Trigger Interrupt Flag mask. */\n#define TIM5_SR1_CC3IF          ((uint8_t)0x08) /*!< Capture/Compare 3 Interrupt Flag mask. */\n#define TIM5_SR1_CC2IF          ((uint8_t)0x04) /*!< Capture/Compare 2 Interrupt Flag mask. */\n#define TIM5_SR1_CC1IF          ((uint8_t)0x02) /*!< Capture/Compare 1 Interrupt Flag mask. */\n#define TIM5_SR1_UIF            ((uint8_t)0x01) /*!< Update Interrupt Flag mask. */\n/*SR2*/\n#define TIM5_SR2_CC3OF          ((uint8_t)0x08) /*!< Capture/Compare 3 Overcapture Flag mask. */\n#define TIM5_SR2_CC2OF          ((uint8_t)0x04) /*!< Capture/Compare 2 Overcapture Flag mask. */\n#define TIM5_SR2_CC1OF          ((uint8_t)0x02) /*!< Capture/Compare 1 Overcapture Flag mask. */\n/*EGR*/\n#define TIM5_EGR_TG             ((uint8_t)0x40) /*!< Trigger Generation mask. */\n#define TIM5_EGR_CC3G           ((uint8_t)0x08) /*!< Capture/Compare 3 Generation mask. */\n#define TIM5_EGR_CC2G           ((uint8_t)0x04) /*!< Capture/Compare 2 Generation mask. */\n#define TIM5_EGR_CC1G           ((uint8_t)0x02) /*!< Capture/Compare 1 Generation mask. */\n#define TIM5_EGR_UG             ((uint8_t)0x01) /*!< Update Generation mask. */\n/*CCMR*/\n#define TIM5_CCMR_ICxPSC        ((uint8_t)0x0C) /*!< Input Capture x Prescaler mask. */\n#define TIM5_CCMR_ICxF          ((uint8_t)0xF0) /*!< Input Capture x Filter mask. */\n#define TIM5_CCMR_OCM           ((uint8_t)0x70) /*!< Output Compare x Mode mask. */\n#define\tTIM5_CCMR_OCxPE         ((uint8_t)0x08) /*!< Output Compare x Preload Enable mask. */\n#define TIM5_CCMR_CCxS          ((uint8_t)0x03) /*!< Capture/Compare x Selection mask. */\n/*CCER1*/\n#define TIM5_CCER1_CC2P         ((uint8_t)0x20) /*!< Capture/Compare 2 output Polarity mask. */\n#define TIM5_CCER1_CC2E         ((uint8_t)0x10) /*!< Capture/Compare 2 output enable mask. */\n#define TIM5_CCER1_CC1P         ((uint8_t)0x02) /*!< Capture/Compare 1 output Polarity mask. */\n#define TIM5_CCER1_CC1E         ((uint8_t)0x01) /*!< Capture/Compare 1 output enable mask. */\n/*CCER2*/\n#define TIM5_CCER2_CC3P         ((uint8_t)0x02) /*!< Capture/Compare 3 output Polarity mask. */\n#define TIM5_CCER2_CC3E         ((uint8_t)0x01) /*!< Capture/Compare 3 output enable mask. */\n/*CNTR*/\n#define TIM5_CNTRH_CNT          ((uint8_t)0xFF) /*!< Counter Value (MSB) mask. */\n#define TIM5_CNTRL_CNT          ((uint8_t)0xFF) /*!< Counter Value (LSB) mask. */\n/*PSCR*/\n#define TIM5_PSCR_PSC           ((uint8_t)0xFF) /*!< Prescaler Value (MSB) mask. */\n/*ARR*/\n#define TIM5_ARRH_ARR           ((uint8_t)0xFF) /*!< Autoreload Value (MSB) mask. */\n#define TIM5_ARRL_ARR           ((uint8_t)0xFF) /*!< Autoreload Value (LSB) mask. */\n/*CCR1*/\n#define TIM5_CCR1H_CCR1         ((uint8_t)0xFF) /*!< Capture/Compare 1 Value (MSB) mask. */\n#define TIM5_CCR1L_CCR1         ((uint8_t)0xFF) /*!< Capture/Compare 1 Value (LSB) mask. */\n/*CCR2*/\n#define TIM5_CCR2H_CCR2         ((uint8_t)0xFF) /*!< Capture/Compare 2 Value (MSB) mask. */\n#define TIM5_CCR2L_CCR2         ((uint8_t)0xFF) /*!< Capture/Compare 2 Value (LSB) mask. */\n/*CCR3*/\n#define TIM5_CCR3H_CCR3         ((uint8_t)0xFF) /*!< Capture/Compare 3 Value (MSB) mask. */\n#define TIM5_CCR3L_CCR3         ((uint8_t)0xFF) /*!< Capture/Compare 3 Value (LSB) mask. */\n/*CCMR*/\n#define TIM5_CCMR_TIxDirect_Set ((uint8_t)0x01)\n/**\n  * @}\n  */\n\t\n/*----------------------------------------------------------------------------*/\n/**\n  * @brief  8-bit system timer  with synchro module(TIM6)\n  */\n\ntypedef struct TIM6_struct\n{\n    __IO uint8_t CR1; \t/*!< control register 1 */\n    __IO uint8_t CR2; \t/*!< control register 2 */\n    __IO uint8_t SMCR; \t/*!< Synchro mode control register */\n    __IO uint8_t IER; \t/*!< interrupt enable register  */\n    __IO uint8_t SR1; \t/*!< status register 1    */\n    __IO uint8_t EGR; \t/*!< event generation register */\n    __IO uint8_t CNTR; \t/*!< counter register  */\n    __IO uint8_t PSCR; \t/*!< prescaler register */\n    __IO uint8_t ARR; \t/*!< auto-reload register */\n}\nTIM6_TypeDef;\n/** @addtogroup TIM6_Registers_Reset_Value\n  * @{\n  */\n#define TIM6_CR1_RESET_VALUE    ((uint8_t)0x00)\n#define TIM6_CR2_RESET_VALUE    ((uint8_t)0x00)\n#define TIM6_SMCR_RESET_VALUE   ((uint8_t)0x00)\n#define TIM6_IER_RESET_VALUE    ((uint8_t)0x00)\n#define TIM6_SR1_RESET_VALUE    ((uint8_t)0x00)\n#define TIM6_EGR_RESET_VALUE    ((uint8_t)0x00)\n#define TIM6_CNTR_RESET_VALUE   ((uint8_t)0x00)\n#define TIM6_PSCR_RESET_VALUE   ((uint8_t)0x00)\n#define TIM6_ARR_RESET_VALUE    ((uint8_t)0xFF)\n\n/**\n* @}\n*/\n\n/** @addtogroup TIM6_Registers_Bits_Definition\n  * @{\n  */\n/* CR1*/\n#define TIM6_CR1_ARPE    ((uint8_t)0x80) /*!< Auto-Reload Preload Enable Mask. */\n#define TIM6_CR1_OPM     ((uint8_t)0x08) /*!< One Pulse Mode Mask. */\n#define TIM6_CR1_URS     ((uint8_t)0x04) /*!< Update Request Source Mask. */\n#define TIM6_CR1_UDIS    ((uint8_t)0x02) /*!< Update DIsable Mask. */\n#define TIM6_CR1_CEN     ((uint8_t)0x01) /*!< Counter Enable Mask. */\n/* CR2*/\n#define\tTIM6_CR2_MMS\t   ((uint8_t)0x70) /*!< MMS Selection Mask. */\n/* SMCR*/\n#define TIM6_SMCR_MSM    ((uint8_t)0x80) /*!< Master/Slave Mode Mask. */\n#define TIM6_SMCR_TS     ((uint8_t)0x70) /*!< Trigger Selection Mask. */\n#define TIM6_SMCR_SMS    ((uint8_t)0x07) /*!< Slave Mode Selection Mask. */\n/* IER*/\n#define TIM6_IER_TIE     ((uint8_t)0x40) /*!< Trigger Interrupt Enable Mask. */\n#define TIM6_IER_UIE     ((uint8_t)0x01) /*!< Update Interrupt Enable Mask. */\n/* SR1*/\n#define TIM6_SR1_TIF     ((uint8_t)0x40) /*!< Trigger Interrupt Flag mask. */\n#define TIM6_SR1_UIF     ((uint8_t)0x01) /*!< Update Interrupt Flag Mask. */\n/* EGR*/\n#define TIM6_EGR_TG      ((uint8_t)0x40) /*!< Trigger Generation mask. */\n#define TIM6_EGR_UG      ((uint8_t)0x01) /*!< Update Generation Mask. */\n/* CNTR*/\n#define TIM6_CNTR_CNT    ((uint8_t)0xFF) /*!<Counter Value (LSB) Mask. */\n/* PSCR*/\n#define TIM6_PSCR_PSC    ((uint8_t)0x07) /*!<Prescaler Value  Mask. */\n\n#define TIM6_ARR_ARR \t   ((uint8_t)0xFF) /*!<Autoreload Value Mask. */\n/**\n  * @}\n  */\n/*----------------------------------------------------------------------------*/\n/**\n  * @brief  Inter-Integrated Circuit (I2C)\n  */\n\ntypedef struct I2C_struct\n{\n  __IO uint8_t CR1;       /*!< I2C control register 1 */\n  __IO uint8_t CR2;       /*!< I2C control register 2 */\n  __IO uint8_t FREQR;     /*!< I2C frequency register */\n  __IO uint8_t OARL;      /*!< I2C own address register LSB */\n  __IO uint8_t OARH;      /*!< I2C own address register MSB */\n  uint8_t RESERVED1;      /*!< Reserved byte */\n  __IO uint8_t DR;        /*!< I2C data register */\n  __IO uint8_t SR1;       /*!< I2C status register 1 */\n  __IO uint8_t SR2;       /*!< I2C status register 2 */\n  __IO uint8_t SR3;       /*!< I2C status register 3 */\n  __IO uint8_t ITR;       /*!< I2C interrupt register */\n  __IO uint8_t CCRL;      /*!< I2C clock control register low */\n  __IO uint8_t CCRH;      /*!< I2C clock control register high */\n  __IO uint8_t TRISER;    /*!< I2C maximum rise time register */\n  uint8_t RESERVED2;      /*!< Reserved byte */\n}\nI2C_TypeDef;\n\n/** @addtogroup I2C_Registers_Reset_Value\n  * @{\n  */\n\n#define I2C_CR1_RESET_VALUE    ((uint8_t)0x00)\n#define I2C_CR2_RESET_VALUE    ((uint8_t)0x00)\n#define I2C_FREQR_RESET_VALUE  ((uint8_t)0x00)\n#define I2C_OARL_RESET_VALUE   ((uint8_t)0x00)\n#define I2C_OARH_RESET_VALUE   ((uint8_t)0x00)\n#define I2C_DR_RESET_VALUE     ((uint8_t)0x00)\n#define I2C_SR1_RESET_VALUE    ((uint8_t)0x00)\n#define I2C_SR2_RESET_VALUE    ((uint8_t)0x00)\n#define I2C_SR3_RESET_VALUE    ((uint8_t)0x00)\n#define I2C_ITR_RESET_VALUE    ((uint8_t)0x00)\n#define I2C_CCRL_RESET_VALUE   ((uint8_t)0x00)\n#define I2C_CCRH_RESET_VALUE   ((uint8_t)0x00)\n#define I2C_TRISER_RESET_VALUE ((uint8_t)0x02)\n\n/**\n  * @}\n  */\n\n/** @addtogroup I2C_Registers_Bits_Definition\n  * @{\n  */\n\n#define I2C_CR1_NOSTRETCH ((uint8_t)0x80) /*!< Clock Stretching Disable (Slave mode) */\n#define I2C_CR1_ENGC      ((uint8_t)0x40) /*!< General Call Enable */\n#define I2C_CR1_PE        ((uint8_t)0x01) /*!< Peripheral Enable */\n\n#define I2C_CR2_SWRST ((uint8_t)0x80)     /*!< Software Reset */\n#define I2C_CR2_POS   ((uint8_t)0x08)     /*!< Acknowledge */\n#define I2C_CR2_ACK   ((uint8_t)0x04)     /*!< Acknowledge Enable */\n#define I2C_CR2_STOP  ((uint8_t)0x02)     /*!< Stop Generation */\n#define I2C_CR2_START ((uint8_t)0x01)     /*!< Start Generation */\n\n#define I2C_FREQR_FREQ ((uint8_t)0x3F)    /*!< Peripheral Clock Frequency */\n\n#define I2C_OARL_ADD  ((uint8_t)0xFE)     /*!< Interface Address bits [7..1] */\n#define I2C_OARL_ADD0 ((uint8_t)0x01)     /*!< Interface Address bit0 */\n\n#define I2C_OARH_ADDMODE ((uint8_t)0x80)  /*!< Addressing Mode (Slave mode) */\n#define I2C_OARH_ADDCONF ((uint8_t)0x40)  /*!< Address Mode Configuration */\n#define I2C_OARH_ADD     ((uint8_t)0x06)  /*!< Interface Address bits [9..8] */\n\n#define I2C_DR_DR        ((uint8_t)0xFF)  /*!< Data Register */\n\n#define I2C_SR1_TXE      ((uint8_t)0x80)  /*!< Data Register Empty (transmitters) */\n#define I2C_SR1_RXNE     ((uint8_t)0x40)  /*!< Data Register not Empty (receivers) */\n#define I2C_SR1_STOPF    ((uint8_t)0x10)  /*!< Stop detection (Slave mode) */\n#define I2C_SR1_ADD10    ((uint8_t)0x08)  /*!< 10-bit header sent (Master mode) */\n#define I2C_SR1_BTF      ((uint8_t)0x04)  /*!< Byte Transfer Finished */\n#define I2C_SR1_ADDR     ((uint8_t)0x02)  /*!< Address sent (master mode)/matched (slave mode) */\n#define I2C_SR1_SB       ((uint8_t)0x01)  /*!< Start Bit (Master mode) */\n\n#define I2C_SR2_WUFH     ((uint8_t)0x20)  /*!< Wake-up from Halt */\n#define I2C_SR2_OVR      ((uint8_t)0x08)  /*!< Overrun/Underrun */\n#define I2C_SR2_AF       ((uint8_t)0x04)  /*!< Acknowledge Failure */\n#define I2C_SR2_ARLO     ((uint8_t)0x02)  /*!< Arbitration Lost (master mode) */\n#define I2C_SR2_BERR     ((uint8_t)0x01)  /*!< Bus Error */\n\n#define I2C_SR3_GENCALL  ((uint8_t)0x10)  /*!< General Call Header (Slave mode) */\n#define I2C_SR3_TRA      ((uint8_t)0x04)  /*!< Transmitter/Receiver */\n#define I2C_SR3_BUSY     ((uint8_t)0x02)  /*!< Bus Busy */\n#define I2C_SR3_MSL      ((uint8_t)0x01)  /*!< Master/Slave */\n\n#define I2C_ITR_ITBUFEN  ((uint8_t)0x04)  /*!< Buffer Interrupt Enable */\n#define I2C_ITR_ITEVTEN  ((uint8_t)0x02)  /*!< Event Interrupt Enable */\n#define I2C_ITR_ITERREN  ((uint8_t)0x01)  /*!< Error Interrupt Enable */\n\n#define I2C_CCRL_CCR     ((uint8_t)0xFF)  /*!< Clock Control Register (Master mode) */\n\n#define I2C_CCRH_FS      ((uint8_t)0x80)  /*!< Master Mode Selection */\n#define I2C_CCRH_DUTY    ((uint8_t)0x40)  /*!< Fast Mode Duty Cycle */\n#define I2C_CCRH_CCR     ((uint8_t)0x0F)  /*!< Clock Control Register in Fast/Standard mode (Master mode) bits [11..8] */\n\n#define I2C_TRISER_TRISE ((uint8_t)0x3F)  /*!< Maximum Rise Time in Fast/Standard mode (Master mode) */\n\n/**\n  * @}\n  */\n\n/*----------------------------------------------------------------------------*/\n/**\n  * @brief  Interrupt Controller (ITC)\n  */\n\ntypedef struct ITC_struct\n{\n  __IO uint8_t ISPR1; /*!< Interrupt Software Priority register 1 */\n  __IO uint8_t ISPR2; /*!< Interrupt Software Priority register 2 */\n  __IO uint8_t ISPR3; /*!< Interrupt Software Priority register 3 */\n  __IO uint8_t ISPR4; /*!< Interrupt Software Priority register 4 */\n  __IO uint8_t ISPR5; /*!< Interrupt Software Priority register 5 */\n  __IO uint8_t ISPR6; /*!< Interrupt Software Priority register 6 */\n  __IO uint8_t ISPR7; /*!< Interrupt Software Priority register 7 */\n  __IO uint8_t ISPR8; /*!< Interrupt Software Priority register 8 */\n}\nITC_TypeDef;\n\n/** @addtogroup ITC_Registers_Reset_Value\n  * @{\n  */\n\n#define ITC_SPRX_RESET_VALUE ((uint8_t)0xFF) /*!< Reset value of Software Priority registers */\n\n/**\n  * @}\n  */\n\n/** @addtogroup CPU_Registers_Bits_Definition\n  * @{\n  */\n\n#define CPU_CC_I1I0 ((uint8_t)0x28) /*!< Condition Code register, I1 and I0 bits mask */\n\n/**\n  * @}\n  */\n\n/*----------------------------------------------------------------------------*/\n/**\n  * @brief  External Interrupt Controller (EXTI)\n  */\n\ntypedef struct EXTI_struct\n{\n  __IO uint8_t CR1; /*!< External Interrupt Control Register for PORTA to PORTD */\n  __IO uint8_t CR2; /*!< External Interrupt Control Register for PORTE and TLI */\n}\nEXTI_TypeDef;\n\n/** @addtogroup EXTI_Registers_Reset_Value\n  * @{\n  */\n\n#define EXTI_CR1_RESET_VALUE ((uint8_t)0x00)\n#define EXTI_CR2_RESET_VALUE ((uint8_t)0x00)\n\n/**\n  * @}\n  */\n\n/** @addtogroup EXTI_Registers_Bits_Definition\n  * @{\n  */\n\n#define EXTI_CR1_PDIS ((uint8_t)0xC0) /*!< PORTD external interrupt sensitivity bits mask */\n#define EXTI_CR1_PCIS ((uint8_t)0x30) /*!< PORTC external interrupt sensitivity bits mask */\n#define EXTI_CR1_PBIS ((uint8_t)0x0C) /*!< PORTB external interrupt sensitivity bits mask */\n#define EXTI_CR1_PAIS ((uint8_t)0x03) /*!< PORTA external interrupt sensitivity bits mask */\n\n#define EXTI_CR2_TLIS ((uint8_t)0x04) /*!< Top level interrupt sensitivity bit mask */\n#define EXTI_CR2_PEIS ((uint8_t)0x03) /*!< PORTE external interrupt sensitivity bits mask */\n\n/**\n  * @}\n  */\n\n\n\n/*----------------------------------------------------------------------------*/\n/**\n  * @brief  FLASH program and Data memory (FLASH)\n  */\n\ntypedef struct FLASH_struct\n{\n  __IO uint8_t CR1;       /*!< Flash control register 1 */\n  __IO uint8_t CR2;       /*!< Flash control register 2 */\n  __IO uint8_t NCR2;      /*!< Flash complementary control register 2 */\n  __IO uint8_t FPR;       /*!< Flash protection register */\n  __IO uint8_t NFPR;      /*!< Flash complementary protection register */\n  __IO uint8_t IAPSR;     /*!< Flash in-application programming status register */\n  uint8_t RESERVED1;      /*!< Reserved byte */\n  uint8_t RESERVED2;      /*!< Reserved byte */\n  __IO uint8_t PUKR;      /*!< Flash program memory unprotection register */\n  uint8_t RESERVED3;      /*!< Reserved byte */\n  __IO uint8_t DUKR;      /*!< Data EEPROM unprotection register */\n}\nFLASH_TypeDef;\n\n/** @addtogroup FLASH_Registers_Reset_Value\n  * @{\n  */\n\n#define FLASH_CR1_RESET_VALUE   ((uint8_t)0x00)\n#define FLASH_CR2_RESET_VALUE   ((uint8_t)0x00)\n#define FLASH_NCR2_RESET_VALUE  ((uint8_t)0xFF)\n#define FLASH_IAPSR_RESET_VALUE ((uint8_t)0x40)\n#define FLASH_PUKR_RESET_VALUE  ((uint8_t)0x00)\n#define FLASH_DUKR_RESET_VALUE  ((uint8_t)0x00)\n\n/**\n  * @}\n  */\n\n/** @addtogroup FLASH_Registers_Bits_Definition\n  * @{\n  */\n\n#define FLASH_CR1_HALT        ((uint8_t)0x08) /*!< Standby in Halt mode mask */\n#define FLASH_CR1_AHALT       ((uint8_t)0x04) /*!< Standby in Active Halt mode mask */\n#define FLASH_CR1_IE          ((uint8_t)0x02) /*!< Flash Interrupt enable mask */\n#define FLASH_CR1_FIX         ((uint8_t)0x01) /*!< Fix programming time mask */\n\n#define FLASH_CR2_OPT         ((uint8_t)0x80) /*!< Select option byte mask */\n#define FLASH_CR2_WPRG        ((uint8_t)0x40) /*!< Word Programming mask */\n#define FLASH_CR2_ERASE       ((uint8_t)0x20) /*!< Erase block mask */\n#define FLASH_CR2_FPRG        ((uint8_t)0x10) /*!< Fast programming mode mask */\n#define FLASH_CR2_PRG         ((uint8_t)0x01) /*!< Program block mask */\n\n#define FLASH_NCR2_NOPT       ((uint8_t)0x80) /*!< Select option byte mask */\n#define FLASH_NCR2_NWPRG      ((uint8_t)0x40) /*!< Word Programming mask */\n#define FLASH_NCR2_NERASE     ((uint8_t)0x20) /*!< Erase block mask */\n#define FLASH_NCR2_NFPRG      ((uint8_t)0x10) /*!< Fast programming mode mask */\n#define FLASH_NCR2_NPRG       ((uint8_t)0x01) /*!< Program block mask */\n\n#define FLASH_IAPSR_HVOFF     ((uint8_t)0x40) /*!< End of high voltage flag mask */\n#define FLASH_IAPSR_DUL       ((uint8_t)0x08) /*!< Data EEPROM unlocked flag mask */\n#define FLASH_IAPSR_EOP       ((uint8_t)0x04) /*!< End of operation flag mask */\n#define FLASH_IAPSR_PUL       ((uint8_t)0x02) /*!< Flash Program memory unlocked flag mask */\n#define FLASH_IAPSR_WR_PG_DIS ((uint8_t)0x01) /*!< Write attempted to protected page mask */\n\n#define FLASH_PUKR_PUK        ((uint8_t)0xFF) /*!< Flash Program memory unprotection mask */\n\n#define FLASH_DUKR_DUK        ((uint8_t)0xFF) /*!< Data EEPROM unprotection mask */\n\n/**\n  * @}\n  */\n\n/*----------------------------------------------------------------------------*/\n/**\n  * @brief  Option Bytes (OPT)\n  */\ntypedef struct OPT_struct\n{\n  __IO uint8_t OPT0;  /*!< Option byte 0: Read-out protection (not accessible in IAP mode) */\n  __IO uint8_t OPT1;  /*!< Option byte 1: User boot code */\n  __IO uint8_t NOPT1; /*!< Complementary Option byte 1 */\n  __IO uint8_t OPT2;  /*!< Option byte 2: Alternate function remapping */\n  __IO uint8_t NOPT2; /*!< Complementary Option byte 2 */\n  __IO uint8_t OPT3;  /*!< Option byte 3: Watchdog option */\n  __IO uint8_t NOPT3; /*!< Complementary Option byte 3 */\n  __IO uint8_t OPT4;  /*!< Option byte 4: Clock option */\n  __IO uint8_t NOPT4; /*!< Complementary Option byte 4 */\n  __IO uint8_t OPT5;  /*!< Option byte 5: HSE clock startup */\n  __IO uint8_t NOPT5; /*!< Complementary Option byte 5 */\n  uint8_t RESERVED1;  /*!< Reserved Option byte*/\n  uint8_t RESERVED2; /*!< Reserved Option byte*/\n  __IO uint8_t OPT7;  /*!< Option byte 7: flash wait states */\n  __IO uint8_t NOPT7; /*!< Complementary Option byte 7 */\n}\nOPT_TypeDef;\n\n/*----------------------------------------------------------------------------*/\n/**\n  * @brief  Independent Watchdog (IWDG)\n  */\n\ntypedef struct IWDG_struct\n{\n  __IO uint8_t KR;  /*!< Key Register */\n  __IO uint8_t PR;  /*!< Prescaler Register */\n  __IO uint8_t RLR; /*!< Reload Register */\n}\nIWDG_TypeDef;\n\n/** @addtogroup IWDG_Registers_Reset_Value\n  * @{\n  */\n\n#define IWDG_PR_RESET_VALUE  ((uint8_t)0x00)\n#define IWDG_RLR_RESET_VALUE ((uint8_t)0xFF)\n\n/**\n  * @}\n  */\n\n/*----------------------------------------------------------------------------*/\n/**\n  * @brief  Window Watchdog (WWDG)\n  */\n\ntypedef struct WWDG_struct\n{\n  __IO uint8_t CR; /*!< Control Register */\n  __IO uint8_t WR; /*!< Window Register */\n}\nWWDG_TypeDef;\n\n/** @addtogroup WWDG_Registers_Reset_Value\n  * @{\n  */\n\n#define WWDG_CR_RESET_VALUE ((uint8_t)0x7F)\n#define WWDG_WR_RESET_VALUE ((uint8_t)0x7F)\n\n/**\n  * @}\n  */\n\n/** @addtogroup WWDG_Registers_Bits_Definition\n  * @{\n  */\n\n#define WWDG_CR_WDGA ((uint8_t)0x80) /*!< WDGA bit mask */\n#define WWDG_CR_T6   ((uint8_t)0x40) /*!< T6 bit mask */\n#define WWDG_CR_T    ((uint8_t)0x7F) /*!< T bits mask */\n\n#define WWDG_WR_MSB  ((uint8_t)0x80) /*!< MSB bit mask */\n#define WWDG_WR_W    ((uint8_t)0x7F) /*!< W bits mask */\n\n/**\n  * @}\n  */\n\n/*----------------------------------------------------------------------------*/\n/**\n  * @brief  Reset Controller (RST)\n  */\n\ntypedef struct RST_struct\n{\n  __IO uint8_t SR; /*!< Reset status register */\n}\nRST_TypeDef;\n\n/** @addtogroup RST_Registers_Bits_Definition\n  * @{\n  */\n\n#define RST_SR_EMCF   ((uint8_t)0x10) /*!< EMC reset flag bit mask */\n#define RST_SR_SWIMF  ((uint8_t)0x08) /*!< SWIM reset flag bit mask */\n#define RST_SR_ILLOPF ((uint8_t)0x04) /*!< Illegal opcode reset flag bit mask */\n#define RST_SR_IWDGF  ((uint8_t)0x02) /*!< IWDG reset flag bit mask */\n#define RST_SR_WWDGF  ((uint8_t)0x01) /*!< WWDG reset flag bit mask */\n\n/**\n  * @}\n  */\n\n/*----------------------------------------------------------------------------*/\n/**\n  * @brief  Serial Peripheral Interface (SPI)\n  */\n\ntypedef struct SPI_struct\n{\n  __IO uint8_t CR1;    /*!< SPI control register 1 */\n  __IO uint8_t CR2;    /*!< SPI control register 2 */\n  __IO uint8_t ICR;    /*!< SPI interrupt control register */\n  __IO uint8_t SR;     /*!< SPI status register */\n  __IO uint8_t DR;     /*!< SPI data I/O register */\n  __IO uint8_t CRCPR;  /*!< SPI CRC polynomial register */\n  __IO uint8_t RXCRCR; /*!< SPI Rx CRC register */\n  __IO uint8_t TXCRCR; /*!< SPI Tx CRC register */\n}\nSPI_TypeDef;\n\n/** @addtogroup SPI_Registers_Reset_Value\n  * @{\n  */\n\n#define SPI_CR1_RESET_VALUE    ((uint8_t)0x00) /*!< Control Register 1 reset value */\n#define SPI_CR2_RESET_VALUE    ((uint8_t)0x00) /*!< Control Register 2 reset value */\n#define SPI_ICR_RESET_VALUE    ((uint8_t)0x00) /*!< Interrupt Control Register reset value */\n#define SPI_SR_RESET_VALUE     ((uint8_t)0x02) /*!< Status Register reset value */\n#define SPI_DR_RESET_VALUE     ((uint8_t)0x00) /*!< Data Register reset value */\n#define SPI_CRCPR_RESET_VALUE  ((uint8_t)0x07) /*!< Polynomial Register reset value */\n#define SPI_RXCRCR_RESET_VALUE ((uint8_t)0x00) /*!< RX CRC Register reset value */\n#define SPI_TXCRCR_RESET_VALUE ((uint8_t)0x00) /*!< TX CRC Register reset value */\n\n/**\n  * @}\n  */\n\n/** @addtogroup SPI_Registers_Bits_Definition\n  * @{\n  */\n\n#define SPI_CR1_LSBFIRST ((uint8_t)0x80) /*!< Frame format mask */\n#define SPI_CR1_SPE      ((uint8_t)0x40) /*!< Enable bits mask */\n#define SPI_CR1_BR       ((uint8_t)0x38) /*!< Baud rate control mask */\n#define SPI_CR1_MSTR     ((uint8_t)0x04) /*!< Master Selection mask */\n#define SPI_CR1_CPOL     ((uint8_t)0x02) /*!< Clock Polarity mask */\n#define SPI_CR1_CPHA     ((uint8_t)0x01) /*!< Clock Phase mask */\n\n#define SPI_CR2_BDM      ((uint8_t)0x80) /*!< Bi-directional data mode enable mask */\n#define SPI_CR2_BDOE     ((uint8_t)0x40) /*!< Output enable in bi-directional mode mask */\n#define SPI_CR2_CRCEN    ((uint8_t)0x20) /*!< Hardware CRC calculation enable mask */\n#define SPI_CR2_CRCNEXT  ((uint8_t)0x10) /*!< Transmit CRC next mask */\n#define SPI_CR2_RXONLY   ((uint8_t)0x04) /*!< Receive only mask */\n#define SPI_CR2_SSM      ((uint8_t)0x02) /*!< Software slave management mask */\n#define SPI_CR2_SSI      ((uint8_t)0x01) /*!< Internal slave select mask */\n\n#define SPI_ICR_TXEI     ((uint8_t)0x80) /*!< Tx buffer empty interrupt enable mask */\n#define SPI_ICR_RXEI     ((uint8_t)0x40) /*!< Rx buffer empty interrupt enable mask */\n#define SPI_ICR_ERRIE    ((uint8_t)0x20) /*!< Error interrupt enable mask */\n#define SPI_ICR_WKIE     ((uint8_t)0x10) /*!< Wake-up interrupt enable mask */\n\n#define SPI_SR_BSY       ((uint8_t)0x80) /*!< Busy flag */\n#define SPI_SR_OVR       ((uint8_t)0x40) /*!< Overrun flag */\n#define SPI_SR_MODF      ((uint8_t)0x20) /*!< Mode fault */\n#define SPI_SR_CRCERR    ((uint8_t)0x10) /*!< CRC error flag */\n#define SPI_SR_WKUP      ((uint8_t)0x08) /*!< Wake-Up flag */\n#define SPI_SR_TXE       ((uint8_t)0x02) /*!< Transmit buffer empty */\n#define SPI_SR_RXNE      ((uint8_t)0x01) /*!< Receive buffer not empty */\n\n/**\n  * @}\n  */\n\n/*----------------------------------------------------------------------------*/\n/**\n  * @brief  Universal Synchronous Asynchronous Receiver Transmitter (UART1)\n  */\n\ntypedef struct UART1_struct\n{\n  __IO uint8_t SR;   /*!< UART1 status register */\n  __IO uint8_t DR;   /*!< UART1 data register */\n  __IO uint8_t BRR1; /*!< UART1 baud rate register */\n  __IO uint8_t BRR2; /*!< UART1 DIV mantissa[11:8] SCIDIV fraction */\n  __IO uint8_t CR1;  /*!< UART1 control register 1 */\n  __IO uint8_t CR2;  /*!< UART1 control register 2 */\n  __IO uint8_t CR3;  /*!< UART1 control register 3 */\n  __IO uint8_t CR4;  /*!< UART1 control register 4 */\n  __IO uint8_t CR5;  /*!< UART1 control register 5 */\n  __IO uint8_t GTR;  /*!< UART1 guard time register */\n  __IO uint8_t PSCR; /*!< UART1 prescaler register */\n}\nUART1_TypeDef;\n\n/** @addtogroup UART1_Registers_Reset_Value\n  * @{\n  */\n\n#define UART1_SR_RESET_VALUE   ((uint8_t)0xC0)\n#define UART1_BRR1_RESET_VALUE ((uint8_t)0x00)\n#define UART1_BRR2_RESET_VALUE ((uint8_t)0x00)\n#define UART1_CR1_RESET_VALUE  ((uint8_t)0x00)\n#define UART1_CR2_RESET_VALUE  ((uint8_t)0x00)\n#define UART1_CR3_RESET_VALUE  ((uint8_t)0x00)\n#define UART1_CR4_RESET_VALUE  ((uint8_t)0x00)\n#define UART1_CR5_RESET_VALUE  ((uint8_t)0x00)\n#define UART1_GTR_RESET_VALUE  ((uint8_t)0x00)\n#define UART1_PSCR_RESET_VALUE ((uint8_t)0x00)\n\n/**\n  * @}\n  */\n\n/** @addtogroup UART1_Registers_Bits_Definition\n  * @{\n  */\n\n#define UART1_SR_TXE   ((uint8_t)0x80) /*!< Transmit Data Register Empty mask */\n#define UART1_SR_TC    ((uint8_t)0x40) /*!< Transmission Complete mask */\n#define UART1_SR_RXNE  ((uint8_t)0x20) /*!< Read Data Register Not Empty mask */\n#define UART1_SR_IDLE  ((uint8_t)0x10) /*!< IDLE line detected mask */\n#define UART1_SR_OR   ((uint8_t)0x08) /*!< OverRun error mask */\n#define UART1_SR_NF    ((uint8_t)0x04) /*!< Noise Flag mask */\n#define UART1_SR_FE    ((uint8_t)0x02) /*!< Framing Error mask */\n#define UART1_SR_PE    ((uint8_t)0x01) /*!< Parity Error mask */\n\n#define UART1_BRR1_DIVM  ((uint8_t)0xFF) /*!< LSB mantissa of UART1DIV [7:0] mask */\n\n#define UART1_BRR2_DIVM  ((uint8_t)0xF0) /*!< MSB mantissa of UART1DIV [11:8] mask */\n#define UART1_BRR2_DIVF  ((uint8_t)0x0F) /*!< Fraction bits of UART1DIV [3:0] mask */\n\n#define UART1_CR1_R8      ((uint8_t)0x80) /*!< Receive Data bit 8 */\n#define UART1_CR1_T8      ((uint8_t)0x40) /*!< Transmit data bit 8 */\n#define UART1_CR1_UARTD   ((uint8_t)0x20) /*!< UART1 Disable (for low power consumption) */\n#define UART1_CR1_M       ((uint8_t)0x10) /*!< Word length mask */\n#define UART1_CR1_WAKE    ((uint8_t)0x08) /*!< Wake-up method mask */\n#define UART1_CR1_PCEN    ((uint8_t)0x04) /*!< Parity Control Enable mask */\n#define UART1_CR1_PS      ((uint8_t)0x02) /*!< UART1 Parity Selection */\n#define UART1_CR1_PIEN    ((uint8_t)0x01) /*!< UART1 Parity Interrupt Enable mask */\n\n#define UART1_CR2_TIEN    ((uint8_t)0x80) /*!< Transmitter Interrupt Enable mask */\n#define UART1_CR2_TCIEN   ((uint8_t)0x40) /*!< Transmission Complete Interrupt Enable mask */\n#define UART1_CR2_RIEN    ((uint8_t)0x20) /*!< Receiver Interrupt Enable mask */\n#define UART1_CR2_ILIEN   ((uint8_t)0x10) /*!< IDLE Line Interrupt Enable mask */\n#define UART1_CR2_TEN     ((uint8_t)0x08) /*!< Transmitter Enable mask */\n#define UART1_CR2_REN     ((uint8_t)0x04) /*!< Receiver Enable mask */\n#define UART1_CR2_RWU     ((uint8_t)0x02) /*!< Receiver Wake-Up mask */\n#define UART1_CR2_SBK     ((uint8_t)0x01) /*!< Send Break mask */\n\n#define UART1_CR3_LINEN   ((uint8_t)0x40) /*!< Alternate Function output mask */\n#define UART1_CR3_STOP    ((uint8_t)0x30) /*!< STOP bits [1:0] mask */\n#define UART1_CR3_CKEN    ((uint8_t)0x08) /*!< Clock Enable mask */\n#define UART1_CR3_CPOL    ((uint8_t)0x04) /*!< Clock Polarity mask */\n#define UART1_CR3_CPHA    ((uint8_t)0x02) /*!< Clock Phase mask */\n#define UART1_CR3_LBCL    ((uint8_t)0x01) /*!< Last Bit Clock pulse mask */\n\n#define UART1_CR4_LBDIEN  ((uint8_t)0x40) /*!< LIN Break Detection Interrupt Enable mask */\n#define UART1_CR4_LBDL    ((uint8_t)0x20) /*!< LIN Break Detection Length mask */\n#define UART1_CR4_LBDF    ((uint8_t)0x10) /*!< LIN Break Detection Flag mask */\n#define UART1_CR4_ADD     ((uint8_t)0x0F) /*!< Address of the UART1 node mask */\n\n#define UART1_CR5_SCEN    ((uint8_t)0x20) /*!< Smart Card Enable mask */\n#define UART1_CR5_NACK    ((uint8_t)0x10) /*!< Smart Card Nack Enable mask */\n#define UART1_CR5_HDSEL   ((uint8_t)0x08) /*!< Half-Duplex Selection mask */\n#define UART1_CR5_IRLP    ((uint8_t)0x04) /*!< Irda Low Power Selection mask */\n#define UART1_CR5_IREN    ((uint8_t)0x02) /*!< Irda Enable mask */\n\n/**\n  * @}\n  */\n\n/*----------------------------------------------------------------------------*/\n/**\n  * @brief  Universal Synchronous Asynchronous Receiver Transmitter (UART2)\n  */\n\ntypedef struct UART2_struct\n{\n  __IO uint8_t SR;   /*!< UART1 status register */\n  __IO uint8_t DR;   /*!< UART1 data register */\n  __IO uint8_t BRR1; /*!< UART1 baud rate register */\n  __IO uint8_t BRR2; /*!< UART1 DIV mantissa[11:8] SCIDIV fraction */\n  __IO uint8_t CR1;  /*!< UART1 control register 1 */\n  __IO uint8_t CR2;  /*!< UART1 control register 2 */\n  __IO uint8_t CR3;  /*!< UART1 control register 3 */\n  __IO uint8_t CR4;  /*!< UART1 control register 4 */\n  __IO uint8_t CR5;  /*!< UART1 control register 5 */\n\t__IO uint8_t CR6;  /*!< UART1 control register 6 */\n  __IO uint8_t GTR;  /*!< UART1 guard time register */\n  __IO uint8_t PSCR; /*!< UART1 prescaler register */\n}\nUART2_TypeDef;\n\n/** @addtogroup UART2_Registers_Reset_Value\n  * @{\n  */\n\n#define UART2_SR_RESET_VALUE   ((uint8_t)0xC0)\n#define UART2_BRR1_RESET_VALUE ((uint8_t)0x00)\n#define UART2_BRR2_RESET_VALUE ((uint8_t)0x00)\n#define UART2_CR1_RESET_VALUE  ((uint8_t)0x00)\n#define UART2_CR2_RESET_VALUE  ((uint8_t)0x00)\n#define UART2_CR3_RESET_VALUE  ((uint8_t)0x00)\n#define UART2_CR4_RESET_VALUE  ((uint8_t)0x00)\n#define UART2_CR5_RESET_VALUE  ((uint8_t)0x00)\n#define UART2_CR6_RESET_VALUE  ((uint8_t)0x00)\n#define UART2_GTR_RESET_VALUE  ((uint8_t)0x00)\n#define UART2_PSCR_RESET_VALUE ((uint8_t)0x00)\n\n/**\n  * @}\n  */\n\n/** @addtogroup UART2_Registers_Bits_Definition\n  * @{\n  */\n\n#define UART2_SR_TXE   ((uint8_t)0x80) /*!< Transmit Data Register Empty mask */\n#define UART2_SR_TC    ((uint8_t)0x40) /*!< Transmission Complete mask */\n#define UART2_SR_RXNE  ((uint8_t)0x20) /*!< Read Data Register Not Empty mask */\n#define UART2_SR_IDLE  ((uint8_t)0x10) /*!< IDLE line detected mask */\n#define UART2_SR_OR    ((uint8_t)0x08) /*!< OverRun error mask */\n#define UART2_SR_NF    ((uint8_t)0x04) /*!< Noise Flag mask */\n#define UART2_SR_FE    ((uint8_t)0x02) /*!< Framing Error mask */\n#define UART2_SR_PE    ((uint8_t)0x01) /*!< Parity Error mask */\n\n#define UART2_BRR1_DIVM  ((uint8_t)0xFF) /*!< LSB mantissa of UART2DIV [7:0] mask */\n\n#define UART2_BRR2_DIVM  ((uint8_t)0xF0) /*!< MSB mantissa of UART2DIV [11:8] mask */\n#define UART2_BRR2_DIVF  ((uint8_t)0x0F) /*!< Fraction bits of UART2DIV [3:0] mask */\n\n#define UART2_CR1_R8      ((uint8_t)0x80) /*!< Receive Data bit 8 */\n#define UART2_CR1_T8      ((uint8_t)0x40) /*!< Transmit data bit 8 */\n#define UART2_CR1_UARTD   ((uint8_t)0x20) /*!< UART2 Disable (for low power consumption) */\n#define UART2_CR1_M       ((uint8_t)0x10) /*!< Word length mask */\n#define UART2_CR1_WAKE    ((uint8_t)0x08) /*!< Wake-up method mask */\n#define UART2_CR1_PCEN    ((uint8_t)0x04) /*!< Parity Control Enable mask */\n#define UART2_CR1_PS      ((uint8_t)0x02) /*!< UART2 Parity Selection */\n#define UART2_CR1_PIEN    ((uint8_t)0x01) /*!< UART2 Parity Interrupt Enable mask */\n\n#define UART2_CR2_TIEN    ((uint8_t)0x80) /*!< Transmitter Interrupt Enable mask */\n#define UART2_CR2_TCIEN   ((uint8_t)0x40) /*!< Transmission Complete Interrupt Enable mask */\n#define UART2_CR2_RIEN    ((uint8_t)0x20) /*!< Receiver Interrupt Enable mask */\n#define UART2_CR2_ILIEN   ((uint8_t)0x10) /*!< IDLE Line Interrupt Enable mask */\n#define UART2_CR2_TEN     ((uint8_t)0x08) /*!< Transmitter Enable mask */\n#define UART2_CR2_REN     ((uint8_t)0x04) /*!< Receiver Enable mask */\n#define UART2_CR2_RWU     ((uint8_t)0x02) /*!< Receiver Wake-Up mask */\n#define UART2_CR2_SBK     ((uint8_t)0x01) /*!< Send Break mask */\n\n#define UART2_CR3_LINEN   ((uint8_t)0x40) /*!< Alternate Function output mask */\n#define UART2_CR3_STOP    ((uint8_t)0x30) /*!< STOP bits [1:0] mask */\n#define UART2_CR3_CKEN    ((uint8_t)0x08) /*!< Clock Enable mask */\n#define UART2_CR3_CPOL    ((uint8_t)0x04) /*!< Clock Polarity mask */\n#define UART2_CR3_CPHA    ((uint8_t)0x02) /*!< Clock Phase mask */\n#define UART2_CR3_LBCL    ((uint8_t)0x01) /*!< Last Bit Clock pulse mask */\n\n#define UART2_CR4_LBDIEN  ((uint8_t)0x40) /*!< LIN Break Detection Interrupt Enable mask */\n#define UART2_CR4_LBDL    ((uint8_t)0x20) /*!< LIN Break Detection Length mask */\n#define UART2_CR4_LBDF    ((uint8_t)0x10) /*!< LIN Break Detection Flag mask */\n#define UART2_CR4_ADD     ((uint8_t)0x0F) /*!< Address of the UART2 node mask */\n\n#define UART2_CR5_SCEN    ((uint8_t)0x20) /*!< Smart Card Enable mask */\n#define UART2_CR5_NACK    ((uint8_t)0x10) /*!< Smart Card Nack Enable mask */\n#define UART2_CR5_IRLP    ((uint8_t)0x04) /*!< Irda Low Power Selection mask */\n#define UART2_CR5_IREN    ((uint8_t)0x02) /*!< Irda Enable mask */\n\n#define UART2_CR6_LDUM    ((uint8_t)0x80) /*!< LIN Divider Update Method */\n#define UART2_CR6_LSLV    ((uint8_t)0x20) /*!< LIN Slave Enable */\n#define UART2_CR6_LASE    ((uint8_t)0x10) /*!< LIN Auto synchronization Enable */\n#define UART2_CR6_LHDIEN  ((uint8_t)0x04) /*!< LIN Header Detection Interrupt Enable */\n#define UART2_CR6_LHDF    ((uint8_t)0x02) /*!< LIN Header Detection Flag */\n#define UART2_CR6_LSF     ((uint8_t)0x01) /*!< LIN Synch Field */\n\n/**\n  * @}\n  */\n\n\n/*----------------------------------------------------------------------------*/\n/**\n  * @brief  LIN Universal Asynchronous Receiver Transmitter (UART3)\n  */\n\ntypedef struct UART3_struct\n{\n  __IO uint8_t SR;       /*!< status register */\n  __IO uint8_t DR;       /*!< data register */\n  __IO uint8_t BRR1;     /*!< baud rate register */\n  __IO uint8_t BRR2;     /*!< DIV mantissa[11:8] SCIDIV fraction */\n  __IO uint8_t CR1;      /*!< control register 1 */\n  __IO uint8_t CR2;      /*!< control register 2 */\n  __IO uint8_t CR3;      /*!< control register 3 */\n  __IO uint8_t CR4;      /*!< control register 4 */\n  uint8_t RESERVED; /*!< Reserved byte */\n  __IO uint8_t CR6;      /*!< control register 5 */\n}\nUART3_TypeDef;\n\n/** @addtogroup UART3_Registers_Reset_Value\n  * @{\n  */\n\n#define UART3_SR_RESET_VALUE   ((uint8_t)0xC0)\n#define UART3_BRR1_RESET_VALUE ((uint8_t)0x00)\n#define UART3_BRR2_RESET_VALUE ((uint8_t)0x00)\n#define UART3_CR1_RESET_VALUE  ((uint8_t)0x00)\n#define UART3_CR2_RESET_VALUE  ((uint8_t)0x00)\n#define UART3_CR3_RESET_VALUE  ((uint8_t)0x00)\n#define UART3_CR4_RESET_VALUE  ((uint8_t)0x00)\n#define UART3_CR6_RESET_VALUE  ((uint8_t)0x00)\n\n/**\n  * @}\n  */\n\n/** @addtogroup UART3_Registers_Bits_Definition\n  * @{\n  */\n\n#define UART3_SR_TXE      ((uint8_t)0x80) /*!< Transmit Data Register Empty mask */\n#define UART3_SR_TC       ((uint8_t)0x40) /*!< Transmission Complete mask */\n#define UART3_SR_RXNE     ((uint8_t)0x20) /*!< Read Data Register Not Empty mask */\n#define UART3_SR_IDLE     ((uint8_t)0x10) /*!< IDLE line detected mask */\n#define UART3_SR_OR       ((uint8_t)0x08) /*!< OverRun error mask */\n#define UART3_SR_NF       ((uint8_t)0x04) /*!< Noise Flag mask */\n#define UART3_SR_FE       ((uint8_t)0x02) /*!< Framing Error mask */\n#define UART3_SR_PE       ((uint8_t)0x01) /*!< Parity Error mask */\n\n#define UART3_BRR1_DIVM   ((uint8_t)0xFF) /*!< LSB mantissa of UARTDIV [7:0] mask */\n\n#define UART3_BRR2_DIVM   ((uint8_t)0xF0) /*!< MSB mantissa of UARTDIV [11:8] mask */\n#define UART3_BRR2_DIVF   ((uint8_t)0x0F) /*!< Fraction bits of UARTDIV [3:0] mask */\n\n#define UART3_CR1_R8      ((uint8_t)0x80) /*!< Receive Data bit 8 */\n#define UART3_CR1_T8      ((uint8_t)0x40) /*!< Transmit data bit 8 */\n#define UART3_CR1_UARTD   ((uint8_t)0x20) /*!< UART Disable (for low power consumption) */\n#define UART3_CR1_M       ((uint8_t)0x10) /*!< Word length mask */\n#define UART3_CR1_WAKE    ((uint8_t)0x08) /*!< Wake-up method mask */\n#define UART3_CR1_PCEN    ((uint8_t)0x04) /*!< Parity control enable mask */\n#define UART3_CR1_PS      ((uint8_t)0x02) /*!< Parity selection bit mask */\n#define UART3_CR1_PIEN    ((uint8_t)0x01) /*!< Parity interrupt enable bit mask */\n\n#define UART3_CR2_TIEN    ((uint8_t)0x80) /*!< Transmitter Interrupt Enable mask */\n#define UART3_CR2_TCIEN   ((uint8_t)0x40) /*!< Transmission Complete Interrupt Enable mask */\n#define UART3_CR2_RIEN    ((uint8_t)0x20) /*!< Receiver Interrupt Enable mask */\n#define UART3_CR2_ILIEN   ((uint8_t)0x10) /*!< IDLE Line Interrupt Enable mask */\n#define UART3_CR2_TEN     ((uint8_t)0x08) /*!< Transmitter Enable mask */\n#define UART3_CR2_REN     ((uint8_t)0x04) /*!< Receiver Enable mask */\n#define UART3_CR2_RWU     ((uint8_t)0x02) /*!< Receiver Wake-Up mask */\n#define UART3_CR2_SBK     ((uint8_t)0x01) /*!< Send Break mask */\n\n#define UART3_CR3_LINEN   ((uint8_t)0x40) /*!< Alternate Function output mask */\n#define UART3_CR3_STOP    ((uint8_t)0x30) /*!< STOP bits [1:0] mask */\n\n#define UART3_CR4_LBDIEN  ((uint8_t)0x40) /*!< LIN Break Detection Interrupt Enable mask */\n#define UART3_CR4_LBDL    ((uint8_t)0x20) /*!< LIN Break Detection Length mask */\n#define UART3_CR4_LBDF    ((uint8_t)0x10) /*!< LIN Break Detection Flag mask */\n#define UART3_CR4_ADD     ((uint8_t)0x0F) /*!< Address of the UART3 node mask */\n\n#define UART3_CR6_LDUM    ((uint8_t)0x80) /*!< LIN Divider Update Method */\n#define UART3_CR6_LSLV    ((uint8_t)0x20) /*!< LIN Slave Enable */\n#define UART3_CR6_LASE    ((uint8_t)0x10) /*!< LIN Auto synchronization Enable */\n#define UART3_CR6_LHDIEN  ((uint8_t)0x04) /*!< LIN Header Detection Interrupt Enable */\n#define UART3_CR6_LHDF    ((uint8_t)0x02) /*!< LIN Header Detection Flag */\n#define UART3_CR6_LSF     ((uint8_t)0x01) /*!< LIN Synch Field */\n\n/**\n  * @}\n  */\n\n/*----------------------------------------------------------------------------*/\n/**\n  * @brief Universal Synchronous Asynchronous Receiver Transmitter (UART4)\n  */\n#if defined(STM8AF622x)\ntypedef struct UART4_struct\n{\n  __IO uint8_t SR;   /*!< UART4 status register */\n  __IO uint8_t DR;   /*!< UART4 data register */\n  __IO uint8_t BRR1; /*!< UART4 baud rate register */\n  __IO uint8_t BRR2; /*!< UART4 DIV mantissa[11:8] SCIDIV fraction */\n  __IO uint8_t CR1;  /*!< UART4 control register 1 */\n  __IO uint8_t CR2;  /*!< UART4 control register 2 */\n  __IO uint8_t CR3;  /*!< UART4 control register 3 */\n  __IO uint8_t CR4;  /*!< UART4 control register 4 */\n  __IO uint8_t CR5;  /*!< UART4 control register 5 */\n  __IO uint8_t CR6;  /*!< UART4 control register 6 */\n  __IO uint8_t GTR;  /*!< UART4 guard time register */\n  __IO uint8_t PSCR; /*!< UART4 prescaler register */\n}\nUART4_TypeDef;\n\n/** @addtogroup UART4_Registers_Reset_Value\n  * @{\n  */\n\n#define UART4_SR_RESET_VALUE   ((uint8_t)0xC0)\n#define UART4_BRR1_RESET_VALUE ((uint8_t)0x00)\n#define UART4_BRR2_RESET_VALUE ((uint8_t)0x00)\n#define UART4_CR1_RESET_VALUE  ((uint8_t)0x00)\n#define UART4_CR2_RESET_VALUE  ((uint8_t)0x00)\n#define UART4_CR3_RESET_VALUE  ((uint8_t)0x00)\n#define UART4_CR4_RESET_VALUE  ((uint8_t)0x00)\n#define UART4_CR5_RESET_VALUE  ((uint8_t)0x00)\n#define UART4_CR6_RESET_VALUE  ((uint8_t)0x00)\n#define UART4_GTR_RESET_VALUE  ((uint8_t)0x00)\n#define UART4_PSCR_RESET_VALUE ((uint8_t)0x00)\n\n/**\n  * @}\n  */\n\n/** @addtogroup UART4_Registers_Bits_Definition\n  * @{\n  */\n\n#define UART4_SR_TXE   ((uint8_t)0x80) /*!< Transmit Data Register Empty mask */\n#define UART4_SR_TC    ((uint8_t)0x40) /*!< Transmission Complete mask */\n#define UART4_SR_RXNE  ((uint8_t)0x20) /*!< Read Data Register Not Empty mask */\n#define UART4_SR_IDLE  ((uint8_t)0x10) /*!< IDLE line detected mask */\n#define UART4_SR_OR    ((uint8_t)0x08) /*!< OverRun error mask */\n#define UART4_SR_NF    ((uint8_t)0x04) /*!< Noise Flag mask */\n#define UART4_SR_FE    ((uint8_t)0x02) /*!< Framing Error mask */\n#define UART4_SR_PE    ((uint8_t)0x01) /*!< Parity Error mask */\n\n#define UART4_BRR1_DIVM  ((uint8_t)0xFF) /*!< LSB mantissa of UART4DIV [7:0] mask */\n\n#define UART4_BRR2_DIVM  ((uint8_t)0xF0) /*!< MSB mantissa of UART4DIV [11:8] mask */\n#define UART4_BRR2_DIVF  ((uint8_t)0x0F) /*!< Fraction bits of UART4DIV [3:0] mask */\n\n#define UART4_CR1_R8      ((uint8_t)0x80) /*!< Receive Data bit 8 */\n#define UART4_CR1_T8      ((uint8_t)0x40) /*!< Transmit data bit 8 */\n#define UART4_CR1_UARTD   ((uint8_t)0x20) /*!< UART4 Disable (for low power consumption) */\n#define UART4_CR1_M       ((uint8_t)0x10) /*!< Word length mask */\n#define UART4_CR1_WAKE    ((uint8_t)0x08) /*!< Wake-up method mask */\n#define UART4_CR1_PCEN    ((uint8_t)0x04) /*!< Parity Control Enable mask */\n#define UART4_CR1_PS      ((uint8_t)0x02) /*!< UART4 Parity Selection */\n#define UART4_CR1_PIEN    ((uint8_t)0x01) /*!< UART4 Parity Interrupt Enable mask */\n\n#define UART4_CR2_TIEN    ((uint8_t)0x80) /*!< Transmitter Interrupt Enable mask */\n#define UART4_CR2_TCIEN   ((uint8_t)0x40) /*!< Transmission Complete Interrupt Enable mask */\n#define UART4_CR2_RIEN    ((uint8_t)0x20) /*!< Receiver Interrupt Enable mask */\n#define UART4_CR2_ILIEN   ((uint8_t)0x10) /*!< IDLE Line Interrupt Enable mask */\n#define UART4_CR2_TEN     ((uint8_t)0x08) /*!< Transmitter Enable mask */\n#define UART4_CR2_REN     ((uint8_t)0x04) /*!< Receiver Enable mask */\n#define UART4_CR2_RWU     ((uint8_t)0x02) /*!< Receiver Wake-Up mask */\n#define UART4_CR2_SBK     ((uint8_t)0x01) /*!< Send Break mask */\n\n#define UART4_CR3_LINEN   ((uint8_t)0x40) /*!< Alternate Function output mask */\n#define UART4_CR3_STOP    ((uint8_t)0x30) /*!< STOP bits [1:0] mask */\n#define UART4_CR3_CKEN    ((uint8_t)0x08) /*!< Clock Enable mask */\n#define UART4_CR3_CPOL    ((uint8_t)0x04) /*!< Clock Polarity mask */\n#define UART4_CR3_CPHA    ((uint8_t)0x02) /*!< Clock Phase mask */\n#define UART4_CR3_LBCL    ((uint8_t)0x01) /*!< Last Bit Clock pulse mask */\n\n#define UART4_CR4_LBDIEN  ((uint8_t)0x40) /*!< LIN Break Detection Interrupt Enable mask */\n#define UART4_CR4_LBDL    ((uint8_t)0x20) /*!< LIN Break Detection Length mask */\n#define UART4_CR4_LBDF    ((uint8_t)0x10) /*!< LIN Break Detection Flag mask */\n#define UART4_CR4_ADD     ((uint8_t)0x0F) /*!< Address of the UART4 node mask */\n\n#define UART4_CR5_SCEN    ((uint8_t)0x20) /*!< Smart Card Enable mask */\n#define UART4_CR5_NACK    ((uint8_t)0x10) /*!< Smart Card Nack Enable mask */\n#define UART4_CR5_HDSEL   ((uint8_t)0x08) /*!< Half-Duplex Selection mask */\n#define UART4_CR5_IRLP    ((uint8_t)0x04) /*!< Irda Low Power Selection mask */\n#define UART4_CR5_IREN    ((uint8_t)0x02) /*!< Irda Enable mask */\n\n#define UART4_CR6_LDUM    ((uint8_t)0x80) /*!< LIN Divider Update Method */\n#define UART4_CR6_LSLV    ((uint8_t)0x20) /*!< LIN Slave Enable */\n#define UART4_CR6_LASE    ((uint8_t)0x10) /*!< LIN Auto synchronization Enable */\n#define UART4_CR6_LHDIEN  ((uint8_t)0x04) /*!< LIN Header Detection Interrupt Enable */\n#define UART4_CR6_LHDF    ((uint8_t)0x02) /*!< LIN Header Detection Flag */\n#define UART4_CR6_LSF     ((uint8_t)0x01) /*!< LIN Synch Field */\n#endif /* STM8AF622x */\n\n/**\n  * @}\n  */\n\n/*----------------------------------------------------------------------------*/\n\n/*----------------------------------------------------------------------------*/\n/**\n  * @brief  Controller Area Network  (CAN)\n  */\n\ntypedef struct\n{\n  __IO uint8_t MCR;    /*!< CAN master control register */\n  __IO uint8_t MSR;    /*!< CAN master status register */\n  __IO uint8_t TSR;    /*!< CAN transmit status register */\n  __IO uint8_t TPR;    /*!< CAN transmit priority register */\n  __IO uint8_t RFR;    /*!< CAN receive FIFO register */\n  __IO uint8_t IER;    /*!< CAN interrupt enable register */\n  __IO uint8_t DGR;    /*!< CAN diagnosis register */\n  __IO uint8_t PSR;    /*!< CAN page selection register */\n\n  union\n  {\n    struct\n    {\n      __IO uint8_t MCSR;\n      __IO uint8_t MDLCR;\n      __IO uint8_t MIDR1;\n      __IO uint8_t MIDR2;\n      __IO uint8_t MIDR3;\n      __IO uint8_t MIDR4;\n      __IO uint8_t MDAR1;\n      __IO uint8_t MDAR2;\n      __IO uint8_t MDAR3;\n      __IO uint8_t MDAR4;\n      __IO uint8_t MDAR5;\n      __IO uint8_t MDAR6;\n      __IO uint8_t MDAR7;\n      __IO uint8_t MDAR8;\n      __IO uint8_t MTSRL;\n      __IO uint8_t MTSRH;\n    }TxMailbox;\n\n    struct\n    {\n      __IO uint8_t FR01;\n      __IO uint8_t FR02;\n      __IO uint8_t FR03;\n      __IO uint8_t FR04;\n      __IO uint8_t FR05;\n      __IO uint8_t FR06;\n      __IO uint8_t FR07;\n      __IO uint8_t FR08;\n      \n      __IO uint8_t FR09;\n      __IO uint8_t FR10;\n      __IO uint8_t FR11;\n      __IO uint8_t FR12;\n      __IO uint8_t FR13;\n      __IO uint8_t FR14;\n      __IO uint8_t FR15;\n      __IO uint8_t FR16;\n    }Filter;\n\n    struct\n    {\n      __IO uint8_t F0R1;\n      __IO uint8_t F0R2;\n      __IO uint8_t F0R3;\n      __IO uint8_t F0R4;\n      __IO uint8_t F0R5;\n      __IO uint8_t F0R6;\n      __IO uint8_t F0R7;\n      __IO uint8_t F0R8;\n\n      __IO uint8_t F1R1;\n      __IO uint8_t F1R2;\n      __IO uint8_t F1R3;\n      __IO uint8_t F1R4;\n      __IO uint8_t F1R5;\n      __IO uint8_t F1R6;\n      __IO uint8_t F1R7;\n      __IO uint8_t F1R8;\n    }Filter01;\n    \n    struct\n    {\n      __IO uint8_t F2R1;\n      __IO uint8_t F2R2;\n      __IO uint8_t F2R3;\n      __IO uint8_t F2R4;\n      __IO uint8_t F2R5;\n      __IO uint8_t F2R6;\n      __IO uint8_t F2R7;\n      __IO uint8_t F2R8;\n\t\n      __IO uint8_t F3R1;\n      __IO uint8_t F3R2;\n      __IO uint8_t F3R3;\n      __IO uint8_t F3R4;\n      __IO uint8_t F3R5;\n      __IO uint8_t F3R6;\n      __IO uint8_t F3R7;\n      __IO uint8_t F3R8;\n    }Filter23;\n    \n    struct\n    {\n      __IO uint8_t F4R1;\n      __IO uint8_t F4R2;\n      __IO uint8_t F4R3;\n      __IO uint8_t F4R4;\n      __IO uint8_t F4R5;\n      __IO uint8_t F4R6;\n      __IO uint8_t F4R7;\n      __IO uint8_t F4R8;\n\t\t\t\n      __IO uint8_t F5R1;\n      __IO uint8_t F5R2;\n      __IO uint8_t F5R3;\n      __IO uint8_t F5R4;\n      __IO uint8_t F5R5;\n      __IO uint8_t F5R6;\n      __IO uint8_t F5R7;\n      __IO uint8_t F5R8;\n    } Filter45;\n    \n    struct\n    {\n      __IO uint8_t ESR;\n      __IO uint8_t EIER;\n      __IO uint8_t TECR;\n      __IO uint8_t RECR;\n      __IO uint8_t BTR1;\n      __IO uint8_t BTR2;\n      uint8_t Reserved1[2];\n      __IO uint8_t FMR1;\n      __IO uint8_t FMR2;\n      __IO uint8_t FCR1;\n      __IO uint8_t FCR2;\n      __IO uint8_t FCR3;\n      uint8_t Reserved2[3];\n    }Config;\n    \n    struct\n    {\n      __IO uint8_t MFMI;\n      __IO uint8_t MDLCR;\n      __IO uint8_t MIDR1;\n      __IO uint8_t MIDR2;\n      __IO uint8_t MIDR3;\n      __IO uint8_t MIDR4;\n      __IO uint8_t MDAR1;\n      __IO uint8_t MDAR2;\n      __IO uint8_t MDAR3;\n      __IO uint8_t MDAR4;\n      __IO uint8_t MDAR5;\n      __IO uint8_t MDAR6;\n      __IO uint8_t MDAR7;\n      __IO uint8_t MDAR8;\n      __IO uint8_t MTSRL;\n      __IO uint8_t MTSRH;\n    }RxFIFO;\n  }Page; \n} CAN_TypeDef;\n\n/** @addtogroup CAN_Registers_Bits_Definition\n  * @{\n  */\n/******************************* Common ***************************************/\n/* CAN Master Control Register bits */\n#define CAN_MCR_INRQ     ((uint8_t)0x01)\n#define CAN_MCR_SLEEP    ((uint8_t)0x02)\n#define CAN_MCR_TXFP     ((uint8_t)0x04)\n#define CAN_MCR_RFLM     ((uint8_t)0x08)\n#define CAN_MCR_NART     ((uint8_t)0x10)\n#define CAN_MCR_AWUM     ((uint8_t)0x20)\n#define CAN_MCR_ABOM     ((uint8_t)0x40)\n#define CAN_MCR_TTCM     ((uint8_t)0x80)\n\n/* CAN Master Status Register bits */\n#define CAN_MSR_INAK     ((uint8_t)0x01)\n#define CAN_MSR_SLAK     ((uint8_t)0x02)\n#define CAN_MSR_ERRI     ((uint8_t)0x04)\n#define CAN_MSR_WKUI     ((uint8_t)0x08)\n#define CAN_MSR_TX       ((uint8_t)0x10)\n#define CAN_MSR_RX       ((uint8_t)0x20)\n\n/* CAN Transmit Status Register bits */\n#define CAN_TSR_RQCP0    ((uint8_t)0x01)\n#define CAN_TSR_RQCP1    ((uint8_t)0x02)\n#define CAN_TSR_RQCP2    ((uint8_t)0x04)\n#define CAN_TSR_RQCP012  ((uint8_t)0x07)\n#define CAN_TSR_TXOK0    ((uint8_t)0x10)\n#define CAN_TSR_TXOK1    ((uint8_t)0x20)\n#define CAN_TSR_TXOK2    ((uint8_t)0x40)\n\n#define CAN_TPR_CODE0    ((uint8_t)0x01)\n#define CAN_TPR_TME0     ((uint8_t)0x04)\n#define CAN_TPR_TME1     ((uint8_t)0x08)\n#define CAN_TPR_TME2     ((uint8_t)0x10)\n#define CAN_TPR_LOW0     ((uint8_t)0x20)\n#define CAN_TPR_LOW1     ((uint8_t)0x40)\n#define CAN_TPR_LOW2     ((uint8_t)0x80)\n/* CAN Receive FIFO Register bits */\n#define CAN_RFR_FMP01  ((uint8_t)0x03)\n#define CAN_RFR_FULL   ((uint8_t)0x08)\n#define CAN_RFR_FOVR   ((uint8_t)0x10)\n#define CAN_RFR_RFOM   ((uint8_t)0x20)\n\n/* CAN Interrupt Register bits */\n#define CAN_IER_TMEIE  ((uint8_t)0x01)\n#define CAN_IER_FMPIE  ((uint8_t)0x02)\n#define CAN_IER_FFIE   ((uint8_t)0x04)\n#define CAN_IER_FOVIE  ((uint8_t)0x08)\n#define CAN_IER_WKUIE  ((uint8_t)0x80)\n\n\n/* CAN diagnostic Register bits */\n#define CAN_DGR_LBKM  ((uint8_t)0x01)\n#define CAN_DGR_SLIM  ((uint8_t)0x02)\n#define CAN_DGR_SAMP  ((uint8_t)0x04)\n#define CAN_DGR_RX    ((uint8_t)0x08)\n#define CAN_DGR_TXM2E ((uint8_t)0x10)\n\n\n/* CAN page select Register bits */\n#define CAN_PSR_PS0  ((uint8_t)0x01)\n#define CAN_PSR_PS1  ((uint8_t)0x02)\n#define CAN_PSR_PS2  ((uint8_t)0x04)\n\n/******************** Tx MailBox & Fifo Page common bits **********************/\n#define CAN_MCSR_TXRQ    ((uint8_t)0x01)\n#define CAN_MCSR_ABRQ    ((uint8_t)0x02)\n#define CAN_MCSR_RQCP    ((uint8_t)0x04)\n#define CAN_MCSR_TXOK    ((uint8_t)0x08)\n#define CAN_MCSR_ALST    ((uint8_t)0x10)\n#define CAN_MCSR_TERR    ((uint8_t)0x20)\n\n#define CAN_MDLCR_DLC    ((uint8_t)0x0F)\n#define CAN_MDLCR_TGT    ((uint8_t)0x80)\n\n#define CAN_MIDR1_RTR    ((uint8_t)0x20)\n#define CAN_MIDR1_IDE    ((uint8_t)0x40)\n\n\n/************************* Filter Page ****************************************/\n\n/* CAN Error Status Register bits */\n#define CAN_ESR_EWGF     ((uint8_t)0x01)\n#define CAN_ESR_EPVF     ((uint8_t)0x02)\n#define CAN_ESR_BOFF     ((uint8_t)0x04)\n#define CAN_ESR_LEC0     ((uint8_t)0x10)\n#define CAN_ESR_LEC1     ((uint8_t)0x20)\n#define CAN_ESR_LEC2     ((uint8_t)0x40)\n#define CAN_ESR_LEC      ((uint8_t)0x70)\n\n/* CAN Error Status Register bits */\n#define CAN_EIER_EWGIE    ((uint8_t)0x01)\n#define CAN_EIER_EPVIE    ((uint8_t)0x02)\n#define CAN_EIER_BOFIE    ((uint8_t)0x04)\n#define CAN_EIER_LECIE    ((uint8_t)0x10)\n#define CAN_EIER_ERRIE    ((uint8_t)0x80)    \n\n/* CAN transmit error counter Register bits(CAN_TECR) */\n#define CAN_TECR_TEC0     ((uint8_t)0x01)    \n#define CAN_TECR_TEC1     ((uint8_t)0x02)    \n#define CAN_TECR_TEC2     ((uint8_t)0x04)    \n#define CAN_TECR_TEC3     ((uint8_t)0x08)    \n#define CAN_TECR_TEC4     ((uint8_t)0x10)    \n#define CAN_TECR_TEC5     ((uint8_t)0x20)    \n#define CAN_TECR_TEC6     ((uint8_t)0x40)    \n#define CAN_TECR_TEC7     ((uint8_t)0x80)    \n\n/* CAN RECEIVE error counter Register bits(CAN_TECR) */\n#define CAN_RECR_REC0     ((uint8_t)0x01)    \n#define CAN_RECR_REC1     ((uint8_t)0x02)    \n#define CAN_RECR_REC2     ((uint8_t)0x04)    \n#define CAN_RECR_REC3     ((uint8_t)0x08)    \n#define CAN_RECR_REC4     ((uint8_t)0x10)    \n#define CAN_RECR_REC5     ((uint8_t)0x20)    \n#define CAN_RECR_REC6     ((uint8_t)0x40)    \n#define CAN_RECR_REC7     ((uint8_t)0x80)    \n\n/* CAN filter mode register bits (CAN_FMR) */\n#define CAN_FMR1_FML0     ((uint8_t)0x01)    \n#define CAN_FMR1_FMH0     ((uint8_t)0x02)    \n#define CAN_FMR1_FML1     ((uint8_t)0x04)    \n#define CAN_FMR1_FMH1     ((uint8_t)0x08)    \n#define CAN_FMR1_FML2     ((uint8_t)0x10)    \n#define CAN_FMR1_FMH2     ((uint8_t)0x20)    \n#define CAN_FMR1_FML3     ((uint8_t)0x40)    \n#define CAN_FMR1_FMH3     ((uint8_t)0x80)    \n\n#define CAN_FMR2_FML4     ((uint8_t)0x01)    \n#define CAN_FMR2_FMH4     ((uint8_t)0x02)    \n#define CAN_FMR2_FML5     ((uint8_t)0x04)    \n#define CAN_FMR2_FMH5     ((uint8_t)0x08)    \n\n/* CAN filter Config register bits (CAN_FCR) */\n#define CAN_FCR1_FACT0     ((uint8_t)0x01)    \n#define CAN_FCR1_FACT1     ((uint8_t)0x10)    \n#define CAN_FCR2_FACT2     ((uint8_t)0x01)    \n#define CAN_FCR2_FACT3     ((uint8_t)0x10)    \n#define CAN_FCR3_FACT4     ((uint8_t)0x01)    \n#define CAN_FCR3_FACT5     ((uint8_t)0x10)    \n\n#define CAN_FCR1_FSC00     ((uint8_t)0x02)    \n#define CAN_FCR1_FSC01     ((uint8_t)0x04)    \n#define CAN_FCR1_FSC10     ((uint8_t)0x20)    \n#define CAN_FCR1_FSC11     ((uint8_t)0x40)    \n#define CAN_FCR2_FSC20     ((uint8_t)0x02)    \n#define CAN_FCR2_FSC21     ((uint8_t)0x04)    \n#define CAN_FCR2_FSC30     ((uint8_t)0x20)    \n#define CAN_FCR2_FSC31     ((uint8_t)0x40)    \n#define CAN_FCR3_FSC40     ((uint8_t)0x02)    \n#define CAN_FCR3_FSC41     ((uint8_t)0x04)    \n#define CAN_FCR3_FSC50     ((uint8_t)0x20)    \n#define CAN_FCR3_FSC51     ((uint8_t)0x40)\n\n/**\n  * @}\n  */\n\n/** @addtogroup CAN_Registers_Reset_Value\n  * @{\n  */\n#define  \tCAN_MCR_RESET_VALUE\t\t\t((uint8_t)0x02)\n#define  \tCAN_MSR_RESET_VALUE\t\t\t((uint8_t)0x02)\n#define  \tCAN_TSR_RESET_VALUE\t\t\t((uint8_t)0x00)\n#define  \tCAN_TPR_RESET_VALUE\t\t\t((uint8_t)0x0C)\n#define  \tCAN_RFR_RESET_VALUE\t\t\t((uint8_t)0x00)\n#define  \tCAN_IER_RESET_VALUE\t\t\t((uint8_t)0x00)\n#define  \tCAN_DGR_RESET_VALUE\t\t\t((uint8_t)0x0C)\n#define  \tCAN_PSR_RESET_VALUE\t\t\t((uint8_t)0x00)\n\n#define  \tCAN_ESR_RESET_VALUE\t\t\t((uint8_t)0x00)\n#define  \tCAN_EIER_RESET_VALUE\t\t        ((uint8_t)0x00)\n#define  \tCAN_TECR_RESET_VALUE\t\t        ((uint8_t)0x00)\n#define  \tCAN_RECR_RESET_VALUE\t\t        ((uint8_t)0x00)\n#define  \tCAN_BTR1_RESET_VALUE\t\t        ((uint8_t)0x40)\n#define  \tCAN_BTR2_RESET_VALUE\t\t        ((uint8_t)0x23)\n#define  \tCAN_FMR1_RESET_VALUE\t\t        ((uint8_t)0x00)\n#define  \tCAN_FMR2_RESET_VALUE\t\t        ((uint8_t)0x00)\n#define  \tCAN_FCR_RESET_VALUE\t\t\t((uint8_t)0x00)\n\n#define  \tCAN_MFMI_RESET_VALUE\t\t\t((uint8_t)0x00)\n#define  \tCAN_MDLC_RESET_VALUE\t\t\t((uint8_t)0x00)\n#define  \tCAN_MCSR_RESET_VALUE\t\t\t((uint8_t)0x00)\n\n/**\n  * @}\n  */\n\n/**\n  * @brief  Configuration Registers (CFG)\n  */\n\ntypedef struct CFG_struct\n{\n  __IO uint8_t GCR; /*!< Global Configuration register */\n}\nCFG_TypeDef;\n\n/** @addtogroup CFG_Registers_Reset_Value\n  * @{\n  */\n\n#define CFG_GCR_RESET_VALUE ((uint8_t)0x00)\n\n/**\n  * @}\n  */\n\n/** @addtogroup CFG_Registers_Bits_Definition\n  * @{\n  */\n\n#define CFG_GCR_SWD ((uint8_t)0x01) /*!< Swim disable bit mask */\n#define CFG_GCR_AL  ((uint8_t)0x02) /*!< Activation Level bit mask */\n\n/**\n  * @}\n  */\n\n/******************************************************************************/\n/*                          Peripherals Base Address                          */\n/******************************************************************************/\n\n/** @addtogroup MAP_FILE_Base_Addresses\n  * @{\n  */\n#define OPT_BaseAddress         0x4800\n#define GPIOA_BaseAddress       0x5000\n#define GPIOB_BaseAddress       0x5005\n#define GPIOC_BaseAddress       0x500A\n#define GPIOD_BaseAddress       0x500F\n#define GPIOE_BaseAddress       0x5014\n#define GPIOF_BaseAddress       0x5019\n#define GPIOG_BaseAddress       0x501E\n#define GPIOH_BaseAddress       0x5023\n#define GPIOI_BaseAddress       0x5028\n#define FLASH_BaseAddress       0x505A\n#define EXTI_BaseAddress        0x50A0\n#define RST_BaseAddress         0x50B3\n#define CLK_BaseAddress         0x50C0\n#define WWDG_BaseAddress        0x50D1\n#define IWDG_BaseAddress        0x50E0\n#define AWU_BaseAddress         0x50F0\n#define BEEP_BaseAddress        0x50F3\n#define SPI_BaseAddress         0x5200\n#define I2C_BaseAddress         0x5210\n#define UART1_BaseAddress       0x5230\n#define UART2_BaseAddress       0x5240\n#define UART3_BaseAddress       0x5240\n#define UART4_BaseAddress       0x5230\n#define TIM1_BaseAddress        0x5250\n#define TIM2_BaseAddress        0x5300\n#define TIM3_BaseAddress        0x5320\n#define TIM4_BaseAddress        0x5340\n#define TIM5_BaseAddress        0x5300\n#define TIM6_BaseAddress        0x5340\n#define ADC1_BaseAddress        0x53E0\n#define ADC2_BaseAddress        0x5400\n#define CAN_BaseAddress         0x5420\n#define CFG_BaseAddress         0x7F60\n#define ITC_BaseAddress         0x7F70\n#define DM_BaseAddress          0x7F90\n\n/**\n  * @}\n  */\n\n/******************************************************************************/\n/*                          Peripherals declarations                          */\n/******************************************************************************/\n\n#if defined(STM8S105) || defined(STM8S005) || defined(STM8S103) || defined(STM8S003) || \\\n    defined(STM8S001) || defined(STM8S903) || defined(STM8AF626x) || defined(STM8AF622x)\n #define ADC1 ((ADC1_TypeDef *) ADC1_BaseAddress)\n#endif /* (STM8S105)||(STM8S103)||(STM8S005)||(STM8S003)||(STM8S001)||(STM8S903)||(STM8AF626x)||(STM8AF622x)*/\n\n#if defined(STM8S208) || defined(STM8S207) || defined (STM8S007) || defined (STM8AF52Ax) || \\\n    defined (STM8AF62Ax)\n#define ADC2 ((ADC2_TypeDef *) ADC2_BaseAddress)\n#endif /* (STM8S208) ||(STM8S207) || (STM8S007) || (STM8AF52Ax) || (STM8AF62Ax) */\n\n#define AWU ((AWU_TypeDef *) AWU_BaseAddress)\n\n#define BEEP ((BEEP_TypeDef *) BEEP_BaseAddress)\n\n#if defined (STM8S208) || defined (STM8AF52Ax)\n #define CAN ((CAN_TypeDef *) CAN_BaseAddress)\n#endif /* (STM8S208) || (STM8AF52Ax) */\n\n#define CLK ((CLK_TypeDef *) CLK_BaseAddress)\n\n#define EXTI ((EXTI_TypeDef *) EXTI_BaseAddress)\n\n#define FLASH ((FLASH_TypeDef *) FLASH_BaseAddress)\n\n#define OPT ((OPT_TypeDef *) OPT_BaseAddress)\n\n#define GPIOA ((GPIO_TypeDef *) GPIOA_BaseAddress)\n\n#define GPIOB ((GPIO_TypeDef *) GPIOB_BaseAddress)\n\n#define GPIOC ((GPIO_TypeDef *) GPIOC_BaseAddress)\n\n#define GPIOD ((GPIO_TypeDef *) GPIOD_BaseAddress)\n\n#define GPIOE ((GPIO_TypeDef *) GPIOE_BaseAddress)\n\n#define GPIOF ((GPIO_TypeDef *) GPIOF_BaseAddress)\n\n#if defined(STM8S207) || defined (STM8S007) || defined(STM8S208) || defined(STM8S105) || \\\n    defined(STM8S005) || defined (STM8AF52Ax) || defined (STM8AF62Ax) || defined (STM8AF626x)\n #define GPIOG ((GPIO_TypeDef *) GPIOG_BaseAddress)\n#endif /* (STM8S208) ||(STM8S207)  || (STM8S105) || (STM8AF52Ax) || (STM8AF62Ax) || (STM8AF626x) */\n\n#if defined(STM8S207) || defined (STM8S007) || defined(STM8S208) || defined (STM8AF52Ax) || \\\n    defined (STM8AF62Ax)\n #define GPIOH ((GPIO_TypeDef *) GPIOH_BaseAddress)\n #define GPIOI ((GPIO_TypeDef *) GPIOI_BaseAddress)\n#endif /* (STM8S208) ||(STM8S207) || (STM8AF62Ax) || (STM8AF52Ax) */\n\n#define RST ((RST_TypeDef *) RST_BaseAddress)\n\n#define WWDG ((WWDG_TypeDef *) WWDG_BaseAddress)\n#define IWDG ((IWDG_TypeDef *) IWDG_BaseAddress)\n\n#define SPI ((SPI_TypeDef *) SPI_BaseAddress)\n#define I2C ((I2C_TypeDef *) I2C_BaseAddress)\n\n#if defined(STM8S208) || defined(STM8S207) || defined (STM8S007) || defined(STM8S103) || \\\n    defined(STM8S003) || defined(STM8S001) || defined(STM8S903) || defined (STM8AF52Ax) || defined (STM8AF62Ax)\n #define UART1 ((UART1_TypeDef *) UART1_BaseAddress)\n#endif /* (STM8S208) ||(STM8S207)  || (STM8S103) || (STM8S001) || (STM8S903) || (STM8AF52Ax) || (STM8AF62Ax) */\n\n#if defined (STM8S105) || defined (STM8S005) || defined (STM8AF626x)\n #define UART2 ((UART2_TypeDef *) UART2_BaseAddress)\n#endif /* STM8S105 || STM8S005 || STM8AF626x */\n\n#if defined(STM8S208) ||defined(STM8S207) || defined (STM8S007) || defined (STM8AF52Ax) || \\\n    defined (STM8AF62Ax)\n #define UART3 ((UART3_TypeDef *) UART3_BaseAddress)\n#endif /* (STM8S208) ||(STM8S207) || (STM8AF62Ax) || (STM8AF52Ax) */\n\n#if defined(STM8AF622x)\n #define UART4 ((UART4_TypeDef *) UART4_BaseAddress)\n#endif /* (STM8AF622x) */\n\n#define TIM1 ((TIM1_TypeDef *) TIM1_BaseAddress)\n\n#if defined(STM8S208) || defined(STM8S207) || defined (STM8S007) || defined(STM8S103) || \\\n    defined(STM8S003) || defined(STM8S001) || defined(STM8S105) || defined(STM8S005) || defined (STM8AF52Ax) || \\\n    defined (STM8AF62Ax) || defined (STM8AF626x)\n #define TIM2 ((TIM2_TypeDef *) TIM2_BaseAddress)\n#endif /* (STM8S208) ||(STM8S207)  || (STM8S103) || (STM8S001) || (STM8S105) || (STM8AF52Ax) || (STM8AF62Ax) || (STM8AF626x)*/\n\n#if defined(STM8S208) || defined(STM8S207) || defined (STM8S007) || defined(STM8S105) || \\\n    defined(STM8S005) || defined (STM8AF52Ax) || defined (STM8AF62Ax) || defined (STM8AF626x)\n #define TIM3 ((TIM3_TypeDef *) TIM3_BaseAddress)\n#endif /* (STM8S208) ||(STM8S207)  || (STM8S105) || (STM8AF62Ax) || (STM8AF52Ax) || (STM8AF626x)*/\n\n#if defined(STM8S208) ||defined(STM8S207) || defined (STM8S007) || defined(STM8S103) || \\\n    defined(STM8S003) || defined(STM8S001) || defined(STM8S105) || defined(STM8S005) || defined (STM8AF52Ax) || \\\n    defined (STM8AF62Ax) || defined (STM8AF626x)\n #define TIM4 ((TIM4_TypeDef *) TIM4_BaseAddress)\n#endif /* (STM8S208) ||(STM8S207)  || (STM8S103) || (STM8S001) || (STM8S105) || (STM8AF52Ax) || (STM8AF62Ax) || (STM8AF626x)*/\n\n#if defined (STM8S903) || defined (STM8AF622x)\n #define TIM5 ((TIM5_TypeDef *) TIM5_BaseAddress)\n #define TIM6 ((TIM6_TypeDef *) TIM6_BaseAddress)\n#endif /* (STM8S903) || (STM8AF622x) */ \n\n#define ITC ((ITC_TypeDef *) ITC_BaseAddress)\n\n#define CFG ((CFG_TypeDef *) CFG_BaseAddress)\n\n#define DM ((DM_TypeDef *) DM_BaseAddress)\n\n\n#ifdef USE_STDPERIPH_DRIVER\n #include \"stm8s_conf.h\"\n#endif\n\n/* Exported macro --------------------------------------------------------------*/\n\n/*============================== Interrupts ====================================*/\n#ifdef _RAISONANCE_\n #include <intrins.h>\n #define enableInterrupts()    _rim_()  /* enable interrupts */\n #define disableInterrupts()   _sim_()  /* disable interrupts */\n #define rim()                 _rim_()  /* enable interrupts */\n #define sim()                 _sim_()  /* disable interrupts */\n #define nop()                 _nop_()  /* No Operation */\n #define trap()                _trap_() /* Trap (soft IT) */\n #define wfi()                 _wfi_()  /* Wait For Interrupt */\n #define halt()                _halt_() /* Halt */\n#elif defined(_COSMIC_)\n #define enableInterrupts()    {_asm(\"rim\\n\");}  /* enable interrupts */\n #define disableInterrupts()   {_asm(\"sim\\n\");}  /* disable interrupts */\n #define rim()                 {_asm(\"rim\\n\");}  /* enable interrupts */\n #define sim()                 {_asm(\"sim\\n\");}  /* disable interrupts */\n #define nop()                 {_asm(\"nop\\n\");}  /* No Operation */\n #define trap()                {_asm(\"trap\\n\");} /* Trap (soft IT) */\n #define wfi()                 {_asm(\"wfi\\n\");}  /* Wait For Interrupt */\n #define halt()                {_asm(\"halt\\n\");} /* Halt */\n#elif defined(_IAR_)\n #include <intrinsics.h>\n #define enableInterrupts()    __enable_interrupt()   /* enable interrupts */\n #define disableInterrupts()   __disable_interrupt()  /* disable interrupts */\n #define rim()                 __enable_interrupt()   /* enable interrupts */\n #define sim()                 __disable_interrupt()  /* disable interrupts */\n #define nop()                 __no_operation()       /* No Operation */\n #define trap()                __trap()               /* Trap (soft IT) */\n #define wfi()                 __wait_for_interrupt() /* Wait For Interrupt */\n #define halt()                __halt()               /* Halt */\n#elif defined(_SDCC_)\n #define enableInterrupts() \\\n  do { \\\n   __asm__(\"rim\"); \\\n  } while (0) /* enable interrupts */\n #define disableInterrupts() \\\n  do { \\\n   __asm__(\"sim\"); \\\n  } while (0) /* disable interrupts */\n #define rim() \\\n  do { \\\n   __asm__(\"rim\"); \\\n  } while (0) /* enable interrupts */\n #define sim() \\\n  do { \\\n   __asm__(\"sim\"); \\\n  } while (0) /* disable interrupts */\n #define nop() \\\n  do { \\\n   __asm__(\"nop\"); \\\n  } while (0) /* No Operation */\n #define trap() \\\n  do { \\\n   __asm__(\"trap\"); \\\n  } while (0) /* Trap (soft IT) */\n #define wfi() \\\n  do { \\\n   __asm__(\"wfi\"); \\\n  } while (0) /* Wait For Interrupt */\n #define halt() \\\n  do { \\\n   __asm__(\"halt\"); \\\n  } while (0) /* Halt */\n#endif /*_RAISONANCE_*/\n\n/*============================== Interrupt vector Handling ========================*/\n\n#ifdef _COSMIC_\n #define INTERRUPT_HANDLER(a,b) @far @interrupt void a(void)\n #define INTERRUPT_HANDLER_TRAP(a) void @far @interrupt a(void)\n#endif /* _COSMIC_ */\n\n#ifdef _RAISONANCE_\n #define INTERRUPT_HANDLER(a,b) void a(void) interrupt b\n #define INTERRUPT_HANDLER_TRAP(a) void a(void) trap\n#endif /* _RAISONANCE_ */\n\n#ifdef _IAR_\n #define STRINGVECTOR(x) #x\n #define VECTOR_ID(x) STRINGVECTOR( vector = (x) )\n #define INTERRUPT_HANDLER( a, b )  \\\n _Pragma( VECTOR_ID( (b)+2 ) )        \\\n __interrupt void (a)( void )\n #define INTERRUPT_HANDLER_TRAP(a) \\\n _Pragma( VECTOR_ID( 1 ) ) \\\n __interrupt void (a) (void)  \n#endif /* _IAR_ */\n\n#ifdef _SDCC_\n #define INTERRUPT_HANDLER(a,b) void a() __interrupt(b)\n #define INTERRUPT_HANDLER_TRAP(a) void a() __trap\n#endif /* _SDCC_ */\n\n/*============================== Interrupt Handler declaration ========================*/\n#ifdef _COSMIC_\n #define INTERRUPT @far @interrupt\n#elif defined(_IAR_)\n #define INTERRUPT __interrupt\n#endif /* _COSMIC_ */\n\n/*============================== Handling bits ====================================*/\n/*-----------------------------------------------------------------------------\nMethod : I\nDescription : Handle the bit from the character variables.\nComments :    The different parameters of commands are\n              - VAR : Name of the character variable where the bit is located.\n              - Place : Bit position in the variable (7 6 5 4 3 2 1 0)\n              - Value : Can be 0 (reset bit) or not 0 (set bit)\n              The \"MskBit\" command allows to select some bits in a source\n              variables and copy it in a destination var (return the value).\n              The \"ValBit\" command returns the value of a bit in a char\n              variable: the bit is reset if it returns 0 else the bit is set.\n              This method generates not an optimised code yet.\n-----------------------------------------------------------------------------*/\n#define SetBit(VAR,Place)         ( (VAR) |= (uint8_t)((uint8_t)1<<(uint8_t)(Place)) )\n#define ClrBit(VAR,Place)         ( (VAR) &= (uint8_t)((uint8_t)((uint8_t)1<<(uint8_t)(Place))^(uint8_t)255) )\n\n#define ChgBit(VAR,Place)         ( (VAR) ^= (uint8_t)((uint8_t)1<<(uint8_t)(Place)) )\n#define AffBit(VAR,Place,Value)   ((Value) ? \\\n                                   ((VAR) |= ((uint8_t)1<<(Place))) : \\\n                                   ((VAR) &= (((uint8_t)1<<(Place))^(uint8_t)255)))\n#define MskBit(Dest,Msk,Src)      ( (Dest) = ((Msk) & (Src)) | ((~(Msk)) & (Dest)) )\n\n#define ValBit(VAR,Place)         ((uint8_t)(VAR) & (uint8_t)((uint8_t)1<<(uint8_t)(Place)))\n\n#define BYTE_0(n)                 ((uint8_t)((n) & (uint8_t)0xFF))        /*!< Returns the low byte of the 32-bit value */\n#define BYTE_1(n)                 ((uint8_t)(BYTE_0((n) >> (uint8_t)8)))  /*!< Returns the second byte of the 32-bit value */\n#define BYTE_2(n)                 ((uint8_t)(BYTE_0((n) >> (uint8_t)16))) /*!< Returns the third byte of the 32-bit value */\n#define BYTE_3(n)                 ((uint8_t)(BYTE_0((n) >> (uint8_t)24))) /*!< Returns the high byte of the 32-bit value */\n\n#define UNUSED(x)                 ((void)(x))\n/*============================== Assert Macros ====================================*/\n#define IS_STATE_VALUE_OK(SensitivityValue) \\\n  (((SensitivityValue) == ENABLE) || \\\n   ((SensitivityValue) == DISABLE))\n\n/*-----------------------------------------------------------------------------\nMethod : II\nDescription : Handle directly the bit.\nComments :    The idea is to handle directly with the bit name. For that, it is\n              necessary to have RAM area descriptions (example: HW register...)\n              and the following command line for each area.\n              This method generates the most optimized code.\n-----------------------------------------------------------------------------*/\n\n#define AREA 0x00     /* The area of bits begins at address 0x10. */\n\n#define BitClr(BIT)  ( *((unsigned char *) (AREA+(BIT)/8)) &= (~(1<<(7-(BIT)%8))) )\n#define BitSet(BIT)  ( *((unsigned char *) (AREA+(BIT)/8)) |= (1<<(7-(BIT)%8)) )\n#define BitVal(BIT)  ( *((unsigned char *) (AREA+(BIT)/8)) & (1<<(7-(BIT)%8)) )\n\n/* Exported functions ------------------------------------------------------- */\n\n#endif /* __STM8S_H */\n\n/**\n  * @}\n  */\n\n/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\n"
  },
  {
    "path": "src/firmware/tsdz2/stm8s/stm8s_adc1.h",
    "content": "/**\n  ******************************************************************************\n  * @file    stm8s_adc1.h\n  * @author  MCD Application Team\n  * @version V2.3.0\n  * @date    16-June-2017\n  * @brief   This file contains all the prototypes/macros for the ADC1 peripheral.\n   ******************************************************************************\n  * @attention\n  *\n  * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>\n  *\n  * Licensed under MCD-ST Liberty SW License Agreement V2, (the \"License\");\n  * You may not use this file except in compliance with the License.\n  * You may obtain a copy of the License at:\n  *\n  *        http://www.st.com/software_license_agreement_liberty_v2\n  *\n  * Unless required by applicable law or agreed to in writing, software \n  * distributed under the License is distributed on an \"AS IS\" BASIS, \n  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  * See the License for the specific language governing permissions and\n  * limitations under the License.\n  *\n  ******************************************************************************\n  */\n/* Define to prevent recursive inclusion -------------------------------------*/\n#ifndef __STM8S_ADC1_H\n#define __STM8S_ADC1_H\n\n/* Includes ------------------------------------------------------------------*/\n#include \"stm8s.h\"\n\n/* Exported types ------------------------------------------------------------*/\n\n/** @addtogroup ADC1_Exported_Types\n  * @{\n  */\n\n/**\n  * @brief  ADC1 clock prescaler selection\n  */\n\ntypedef enum \n{\n  ADC1_PRESSEL_FCPU_D2  = (uint8_t)0x00, /**< Prescaler selection fADC1 = fcpu/2 */\n  ADC1_PRESSEL_FCPU_D3  = (uint8_t)0x10, /**< Prescaler selection fADC1 = fcpu/3 */\n  ADC1_PRESSEL_FCPU_D4  = (uint8_t)0x20, /**< Prescaler selection fADC1 = fcpu/4 */\n  ADC1_PRESSEL_FCPU_D6  = (uint8_t)0x30, /**< Prescaler selection fADC1 = fcpu/6 */\n  ADC1_PRESSEL_FCPU_D8  = (uint8_t)0x40, /**< Prescaler selection fADC1 = fcpu/8 */\n  ADC1_PRESSEL_FCPU_D10 = (uint8_t)0x50, /**< Prescaler selection fADC1 = fcpu/10 */\n  ADC1_PRESSEL_FCPU_D12 = (uint8_t)0x60, /**< Prescaler selection fADC1 = fcpu/12 */\n  ADC1_PRESSEL_FCPU_D18 = (uint8_t)0x70  /**< Prescaler selection fADC1 = fcpu/18 */\n} ADC1_PresSel_TypeDef;\n\n/**\n  * @brief   ADC1 External conversion trigger event selection\n  */\ntypedef enum \n{\n  ADC1_EXTTRIG_TIM   = (uint8_t)0x00, /**< Conversion from Internal TIM1 TRGO event */\n  ADC1_EXTTRIG_GPIO  = (uint8_t)0x10  /**< Conversion from External interrupt on ADC_ETR pin*/\n} ADC1_ExtTrig_TypeDef;\n\n/**\n  * @brief  ADC1 data alignment\n  */\ntypedef enum \n{\n  ADC1_ALIGN_LEFT  = (uint8_t)0x00, /**< Data alignment left */\n  ADC1_ALIGN_RIGHT = (uint8_t)0x08  /**< Data alignment right */\n} ADC1_Align_TypeDef;\n\n/**\n  * @brief  ADC1 Interrupt source\n  */\ntypedef enum \n{\n  ADC1_IT_AWDIE = (uint16_t)0x010, /**< Analog WDG interrupt enable */\n  ADC1_IT_EOCIE = (uint16_t)0x020, /**< EOC interrupt enable */\n  ADC1_IT_AWD   = (uint16_t)0x140, /**< Analog WDG status */\n  ADC1_IT_AWS0  = (uint16_t)0x110, /**< Analog channel 0 status */\n  ADC1_IT_AWS1  = (uint16_t)0x111, /**< Analog channel 1 status */\n  ADC1_IT_AWS2  = (uint16_t)0x112, /**< Analog channel 2 status */\n  ADC1_IT_AWS3  = (uint16_t)0x113, /**< Analog channel 3 status */\n  ADC1_IT_AWS4  = (uint16_t)0x114, /**< Analog channel 4 status */\n  ADC1_IT_AWS5  = (uint16_t)0x115, /**< Analog channel 5 status */\n  ADC1_IT_AWS6  = (uint16_t)0x116, /**< Analog channel 6 status */\n  ADC1_IT_AWS7  = (uint16_t)0x117, /**< Analog channel 7 status */\n  ADC1_IT_AWS8  = (uint16_t)0x118, /**< Analog channel 8 status */\n  ADC1_IT_AWS9  = (uint16_t)0x119, /**< Analog channel 9 status */\n  ADC1_IT_AWS12 = (uint16_t)0x11C, /**< Analog channel 12 status */\n                                   /* refer to product datasheet for channel 12 availability */\n  ADC1_IT_EOC   = (uint16_t)0x080  /**< EOC pending bit */\n\n} ADC1_IT_TypeDef;\n\n/**\n  * @brief  ADC1 Flags\n  */\ntypedef enum \n{\n  ADC1_FLAG_OVR   = (uint8_t)0x41, /**< Overrun status flag */\n  ADC1_FLAG_AWD   = (uint8_t)0x40, /**< Analog WDG status */\n  ADC1_FLAG_AWS0  = (uint8_t)0x10, /**< Analog channel 0 status */\n  ADC1_FLAG_AWS1  = (uint8_t)0x11, /**< Analog channel 1 status */\n  ADC1_FLAG_AWS2  = (uint8_t)0x12, /**< Analog channel 2 status */\n  ADC1_FLAG_AWS3  = (uint8_t)0x13, /**< Analog channel 3 status */\n  ADC1_FLAG_AWS4  = (uint8_t)0x14, /**< Analog channel 4 status */\n  ADC1_FLAG_AWS5  = (uint8_t)0x15, /**< Analog channel 5 status */\n  ADC1_FLAG_AWS6  = (uint8_t)0x16, /**< Analog channel 6 status */\n  ADC1_FLAG_AWS7  = (uint8_t)0x17, /**< Analog channel 7 status */\n  ADC1_FLAG_AWS8  = (uint8_t)0x18, /**< Analog channel 8  status*/\n  ADC1_FLAG_AWS9  = (uint8_t)0x19, /**< Analog channel 9 status */\n  ADC1_FLAG_AWS12 = (uint8_t)0x1C, /**< Analog channel 12 status */\n                                  /* refer to product datasheet for channel 12 availability */\n  ADC1_FLAG_EOC   = (uint8_t)0x80  /**< EOC falg */\n}ADC1_Flag_TypeDef;\n\n\n/**\n  * @brief  ADC1 schmitt Trigger\n  */\ntypedef enum \n{\n  ADC1_SCHMITTTRIG_CHANNEL0  = (uint8_t)0x00, /**< Schmitt trigger disable on AIN0 */\n  ADC1_SCHMITTTRIG_CHANNEL1  = (uint8_t)0x01, /**< Schmitt trigger disable on AIN1 */\n  ADC1_SCHMITTTRIG_CHANNEL2  = (uint8_t)0x02, /**< Schmitt trigger disable on AIN2 */\n  ADC1_SCHMITTTRIG_CHANNEL3  = (uint8_t)0x03, /**< Schmitt trigger disable on AIN3 */\n  ADC1_SCHMITTTRIG_CHANNEL4  = (uint8_t)0x04, /**< Schmitt trigger disable on AIN4 */\n  ADC1_SCHMITTTRIG_CHANNEL5  = (uint8_t)0x05, /**< Schmitt trigger disable on AIN5 */\n  ADC1_SCHMITTTRIG_CHANNEL6  = (uint8_t)0x06, /**< Schmitt trigger disable on AIN6 */\n  ADC1_SCHMITTTRIG_CHANNEL7  = (uint8_t)0x07, /**< Schmitt trigger disable on AIN7 */\n  ADC1_SCHMITTTRIG_CHANNEL8  = (uint8_t)0x08, /**< Schmitt trigger disable on AIN8 */\n  ADC1_SCHMITTTRIG_CHANNEL9  = (uint8_t)0x09, /**< Schmitt trigger disable on AIN9 */\n  ADC1_SCHMITTTRIG_CHANNEL12 = (uint8_t)0x0C, /**< Schmitt trigger disable on AIN12 */  \n                                              /* refer to product datasheet for channel 12 availability */ \n  ADC1_SCHMITTTRIG_ALL       = (uint8_t)0xFF /**< Schmitt trigger disable on All channels */ \n} ADC1_SchmittTrigg_TypeDef;\n\n/**\n  * @brief  ADC1 conversion mode selection\n  */\n\ntypedef enum \n{\n  ADC1_CONVERSIONMODE_SINGLE     = (uint8_t)0x00, /**< Single conversion mode */\n  ADC1_CONVERSIONMODE_CONTINUOUS = (uint8_t)0x01  /**< Continuous conversion mode */\n} ADC1_ConvMode_TypeDef;\n\n/**\n  * @brief  ADC1 analog channel selection\n  */\n\ntypedef enum \n{\n  ADC1_CHANNEL_0  = (uint8_t)0x00, /**< Analog channel 0 */\n  ADC1_CHANNEL_1  = (uint8_t)0x01, /**< Analog channel 1 */\n  ADC1_CHANNEL_2  = (uint8_t)0x02, /**< Analog channel 2 */\n  ADC1_CHANNEL_3  = (uint8_t)0x03, /**< Analog channel 3 */\n  ADC1_CHANNEL_4  = (uint8_t)0x04, /**< Analog channel 4 */\n  ADC1_CHANNEL_5  = (uint8_t)0x05, /**< Analog channel 5 */\n  ADC1_CHANNEL_6  = (uint8_t)0x06, /**< Analog channel 6 */\n  ADC1_CHANNEL_7  = (uint8_t)0x07, /**< Analog channel 7 */\n  ADC1_CHANNEL_8  = (uint8_t)0x08, /**< Analog channel 8 */\n  ADC1_CHANNEL_9  = (uint8_t)0x09, /**< Analog channel 9 */\n  ADC1_CHANNEL_12 = (uint8_t)0x0C /**< Analog channel 12 */ \n                 /* refer to product datasheet for channel 12 availability */\n} ADC1_Channel_TypeDef;\n\n/**\n  * @}\n  */\n\n/* Exported constants --------------------------------------------------------*/\n\n/* Exported macros ------------------------------------------------------------*/\n\n/* Private macros ------------------------------------------------------------*/\n\n/** @addtogroup ADC1_Private_Macros\n  * @brief  Macros used by the assert function to check the different functions parameters.\n  * @{\n  */\n\n/**\n  * @brief  Macro used by the assert function to check the different prescaler's values.\n  */\n#define IS_ADC1_PRESSEL_OK(PRESCALER) (((PRESCALER) == ADC1_PRESSEL_FCPU_D2) || \\\n                                      ((PRESCALER) == ADC1_PRESSEL_FCPU_D3) || \\\n                                      ((PRESCALER) == ADC1_PRESSEL_FCPU_D4) || \\\n                                      ((PRESCALER) == ADC1_PRESSEL_FCPU_D6) || \\\n                                      ((PRESCALER) == ADC1_PRESSEL_FCPU_D8) || \\\n                                      ((PRESCALER) == ADC1_PRESSEL_FCPU_D10) || \\\n                                      ((PRESCALER) == ADC1_PRESSEL_FCPU_D12) || \\\n                                      ((PRESCALER) == ADC1_PRESSEL_FCPU_D18))\n\n/**\n  * @brief  Macro used by the assert function to check the different external trigger values.\n  */\n#define IS_ADC1_EXTTRIG_OK(EXTRIG) (((EXTRIG) == ADC1_EXTTRIG_TIM) || \\\n                                   ((EXTRIG) == ADC1_EXTTRIG_GPIO))\n\n/**\n  * @brief  Macro used by the assert function to check the different alignment modes.\n  */\n#define IS_ADC1_ALIGN_OK(ALIGN) (((ALIGN) == ADC1_ALIGN_LEFT) || \\\n                                ((ALIGN) == ADC1_ALIGN_RIGHT))\n\n/**\n  * @brief  Macro used by the assert function to check the Interrupt source.\n  */\n#define IS_ADC1_IT_OK(IT) (((IT) == ADC1_IT_EOCIE) || \\\n                          ((IT) == ADC1_IT_AWDIE))\n\n/**\n  * @brief  Macro used by the assert function to check the ADC1 Flag.\n  */\n#define IS_ADC1_FLAG_OK(FLAG) (((FLAG) == ADC1_FLAG_EOC)|| \\\n                              ((FLAG) == ADC1_FLAG_OVR) || \\\n                              ((FLAG) == ADC1_FLAG_AWD) || \\\n                              ((FLAG) == ADC1_FLAG_AWS0) || \\\n                              ((FLAG) == ADC1_FLAG_AWS1) || \\\n                              ((FLAG) == ADC1_FLAG_AWS2) || \\\n                              ((FLAG) == ADC1_FLAG_AWS3) || \\\n                              ((FLAG) == ADC1_FLAG_AWS4) || \\\n                              ((FLAG) == ADC1_FLAG_AWS5) || \\\n                              ((FLAG) == ADC1_FLAG_AWS6) || \\\n                              ((FLAG) == ADC1_FLAG_AWS7) || \\\n                              ((FLAG) == ADC1_FLAG_AWS8) || \\\n                              ((FLAG) == ADC1_FLAG_AWS9))\n\n/**\n  * @brief  Macro used by the assert function to check the ADC1 pending bits.\n  */\n#define IS_ADC1_ITPENDINGBIT_OK(ITPENDINGBIT) (((ITPENDINGBIT) == ADC1_IT_EOC) || \\\n    ((ITPENDINGBIT) == ADC1_IT_AWD) || \\\n    ((ITPENDINGBIT) == ADC1_IT_AWS0) || \\\n    ((ITPENDINGBIT) == ADC1_IT_AWS1) || \\\n    ((ITPENDINGBIT) == ADC1_IT_AWS2) || \\\n    ((ITPENDINGBIT) == ADC1_IT_AWS3) || \\\n    ((ITPENDINGBIT) == ADC1_IT_AWS4) || \\\n    ((ITPENDINGBIT) == ADC1_IT_AWS5) || \\\n    ((ITPENDINGBIT) == ADC1_IT_AWS6) || \\\n    ((ITPENDINGBIT) == ADC1_IT_AWS7) || \\\n    ((ITPENDINGBIT) == ADC1_IT_AWS8) || \\\n    ((ITPENDINGBIT) == ADC1_IT_AWS12) || \\\n    ((ITPENDINGBIT) == ADC1_IT_AWS9))\n\n/**\n  * @brief  Macro used by the assert function to check the different schmitt trigger values.\n  */\n#define IS_ADC1_SCHMITTTRIG_OK(SCHMITTTRIG) (((SCHMITTTRIG) == ADC1_SCHMITTTRIG_CHANNEL0) || \\\n    ((SCHMITTTRIG) == ADC1_SCHMITTTRIG_CHANNEL1) || \\\n    ((SCHMITTTRIG) == ADC1_SCHMITTTRIG_CHANNEL2) || \\\n    ((SCHMITTTRIG) == ADC1_SCHMITTTRIG_CHANNEL3) || \\\n    ((SCHMITTTRIG) == ADC1_SCHMITTTRIG_CHANNEL4) || \\\n    ((SCHMITTTRIG) == ADC1_SCHMITTTRIG_CHANNEL5) || \\\n    ((SCHMITTTRIG) == ADC1_SCHMITTTRIG_CHANNEL6) || \\\n    ((SCHMITTTRIG) == ADC1_SCHMITTTRIG_CHANNEL7) || \\\n    ((SCHMITTTRIG) == ADC1_SCHMITTTRIG_CHANNEL8) || \\\n    ((SCHMITTTRIG) == ADC1_SCHMITTTRIG_CHANNEL12) || \\\n    ((SCHMITTTRIG) == ADC1_SCHMITTTRIG_ALL) || \\\n    ((SCHMITTTRIG) == ADC1_SCHMITTTRIG_CHANNEL9))\n\n/**\n  * @brief  Macro used by the assert function to check the different conversion modes.\n  */\n#define IS_ADC1_CONVERSIONMODE_OK(MODE) (((MODE) == ADC1_CONVERSIONMODE_SINGLE) || \\\n                                        ((MODE) == ADC1_CONVERSIONMODE_CONTINUOUS))\n\n/**\n  * @brief  Macro used by the assert function to check the different channels values.\n  */\n#define IS_ADC1_CHANNEL_OK(CHANNEL) (((CHANNEL) == ADC1_CHANNEL_0) || \\\n                                    ((CHANNEL) == ADC1_CHANNEL_1) || \\\n                                    ((CHANNEL) == ADC1_CHANNEL_2) || \\\n                                    ((CHANNEL) == ADC1_CHANNEL_3) || \\\n                                    ((CHANNEL) == ADC1_CHANNEL_4) || \\\n                                    ((CHANNEL) == ADC1_CHANNEL_5) || \\\n                                    ((CHANNEL) == ADC1_CHANNEL_6) || \\\n                                    ((CHANNEL) == ADC1_CHANNEL_7) || \\\n                                    ((CHANNEL) == ADC1_CHANNEL_8) || \\\n                                    ((CHANNEL) == ADC1_CHANNEL_12) || \\\n                                    ((CHANNEL) == ADC1_CHANNEL_9))\n\n/**\n  * @brief  Macro used by the assert function to check the possible buffer values.\n  */\n#define IS_ADC1_BUFFER_OK(BUFFER) ((BUFFER) <= (uint8_t)0x09)\n\n/**\n  * @}\n  */\n\n/* Exported functions ------------------------------------------------------- */\n\n/** @addtogroup ADC1_Exported_Functions\n  * @{\n  */\nvoid ADC1_DeInit(void);\nvoid ADC1_Init(ADC1_ConvMode_TypeDef ADC1_ConversionMode, \n               ADC1_Channel_TypeDef ADC1_Channel,\n               ADC1_PresSel_TypeDef ADC1_PrescalerSelection, \n               ADC1_ExtTrig_TypeDef ADC1_ExtTrigger, \n               FunctionalState ADC1_ExtTriggerState, ADC1_Align_TypeDef ADC1_Align, \n               ADC1_SchmittTrigg_TypeDef ADC1_SchmittTriggerChannel, \n               FunctionalState ADC1_SchmittTriggerState);\nvoid ADC1_Cmd(FunctionalState NewState);\nvoid ADC1_ScanModeCmd(FunctionalState NewState);\nvoid ADC1_DataBufferCmd(FunctionalState NewState);\nvoid ADC1_ITConfig(ADC1_IT_TypeDef ADC1_IT, FunctionalState NewState);\nvoid ADC1_PrescalerConfig(ADC1_PresSel_TypeDef ADC1_Prescaler);\nvoid ADC1_SchmittTriggerConfig(ADC1_SchmittTrigg_TypeDef ADC1_SchmittTriggerChannel,\n                              FunctionalState NewState);\nvoid ADC1_ConversionConfig(ADC1_ConvMode_TypeDef ADC1_ConversionMode, \n                           ADC1_Channel_TypeDef ADC1_Channel, \n                           ADC1_Align_TypeDef ADC1_Align);\nvoid ADC1_ExternalTriggerConfig(ADC1_ExtTrig_TypeDef ADC1_ExtTrigger, FunctionalState NewState);\nvoid ADC1_AWDChannelConfig(ADC1_Channel_TypeDef Channel, FunctionalState NewState);\nvoid ADC1_StartConversion(void);\nuint16_t ADC1_GetConversionValue(void);\nvoid ADC1_SetHighThreshold(uint16_t Threshold);\nvoid ADC1_SetLowThreshold(uint16_t Threshold);\nuint16_t ADC1_GetBufferValue(uint8_t Buffer);\nFlagStatus ADC1_GetAWDChannelStatus(ADC1_Channel_TypeDef Channel);\nFlagStatus ADC1_GetFlagStatus(ADC1_Flag_TypeDef Flag);\nvoid ADC1_ClearFlag(ADC1_Flag_TypeDef Flag);\nITStatus ADC1_GetITStatus(ADC1_IT_TypeDef ITPendingBit);\nvoid ADC1_ClearITPendingBit(ADC1_IT_TypeDef ITPendingBit);\n/**\n  * @}\n  */\n\n#endif /* __STM8S_ADC1_H */\n\n\n/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\n"
  },
  {
    "path": "src/firmware/tsdz2/stm8s/stm8s_adc2.h",
    "content": "/**\n  ******************************************************************************\n  * @file    stm8s_adc2.h\n  * @author  MCD Application Team\n  * @version V2.3.0\n  * @date    16-June-2017\n  * @brief   This file contains all the prototypes/macros for the ADC2 peripheral.\n   ******************************************************************************\n  * @attention\n  *\n  * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>\n  *\n  * Licensed under MCD-ST Liberty SW License Agreement V2, (the \"License\");\n  * You may not use this file except in compliance with the License.\n  * You may obtain a copy of the License at:\n  *\n  *        http://www.st.com/software_license_agreement_liberty_v2\n  *\n  * Unless required by applicable law or agreed to in writing, software \n  * distributed under the License is distributed on an \"AS IS\" BASIS, \n  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  * See the License for the specific language governing permissions and\n  * limitations under the License.\n  *\n  ******************************************************************************\n  */\n\n\n/* Define to prevent recursive inclusion -------------------------------------*/\n#ifndef __STM8S_ADC2_H\n#define __STM8S_ADC2_H\n\n/* Includes ------------------------------------------------------------------*/\n#include \"stm8s.h\"\n\n/* Exported types ------------------------------------------------------------*/\n\n/** @addtogroup ADC2_Exported_Types\n  * @{\n  */\n\n/**\n  * @brief  ADC2 clock prescaler selection\n  */\n\ntypedef enum {\n  ADC2_PRESSEL_FCPU_D2  = (uint8_t)0x00, /**< Prescaler selection fADC2 = fcpu/2 */\n  ADC2_PRESSEL_FCPU_D3  = (uint8_t)0x10, /**< Prescaler selection fADC2 = fcpu/3 */\n  ADC2_PRESSEL_FCPU_D4  = (uint8_t)0x20, /**< Prescaler selection fADC2 = fcpu/4 */\n  ADC2_PRESSEL_FCPU_D6  = (uint8_t)0x30, /**< Prescaler selection fADC2 = fcpu/6 */\n  ADC2_PRESSEL_FCPU_D8  = (uint8_t)0x40, /**< Prescaler selection fADC2 = fcpu/8 */\n  ADC2_PRESSEL_FCPU_D10 = (uint8_t)0x50, /**< Prescaler selection fADC2 = fcpu/10 */\n  ADC2_PRESSEL_FCPU_D12 = (uint8_t)0x60, /**< Prescaler selection fADC2 = fcpu/12 */\n  ADC2_PRESSEL_FCPU_D18 = (uint8_t)0x70  /**< Prescaler selection fADC2 = fcpu/18 */\n} ADC2_PresSel_TypeDef;\n\n/**\n  * @brief   ADC2 External conversion trigger event selection\n  */\ntypedef enum {\n  ADC2_EXTTRIG_TIM   = (uint8_t)0x00, /**< Conversion from Internal TIM TRGO event */\n  ADC2_EXTTRIG_GPIO  = (uint8_t)0x01  /**< Conversion from External interrupt on ADC_ETR pin*/\n} ADC2_ExtTrig_TypeDef;\n\n/**\n  * @brief  ADC2 data alignment\n  */\ntypedef enum {\n  ADC2_ALIGN_LEFT  = (uint8_t)0x00, /**< Data alignment left */\n  ADC2_ALIGN_RIGHT = (uint8_t)0x08  /**< Data alignment right */\n} ADC2_Align_TypeDef;\n\n/**\n  * @brief  ADC2 schmitt Trigger\n  */\ntypedef enum {\n  ADC2_SCHMITTTRIG_CHANNEL0  = (uint8_t)0x00, /**< Schmitt trigger disable on AIN0 */\n  ADC2_SCHMITTTRIG_CHANNEL1  = (uint8_t)0x01, /**< Schmitt trigger disable on AIN1 */\n  ADC2_SCHMITTTRIG_CHANNEL2  = (uint8_t)0x02, /**< Schmitt trigger disable on AIN2 */\n  ADC2_SCHMITTTRIG_CHANNEL3  = (uint8_t)0x03, /**< Schmitt trigger disable on AIN3 */\n  ADC2_SCHMITTTRIG_CHANNEL4  = (uint8_t)0x04, /**< Schmitt trigger disable on AIN4 */\n  ADC2_SCHMITTTRIG_CHANNEL5  = (uint8_t)0x05, /**< Schmitt trigger disable on AIN5 */\n  ADC2_SCHMITTTRIG_CHANNEL6  = (uint8_t)0x06, /**< Schmitt trigger disable on AIN6 */\n  ADC2_SCHMITTTRIG_CHANNEL7  = (uint8_t)0x07, /**< Schmitt trigger disable on AIN7 */\n  ADC2_SCHMITTTRIG_CHANNEL8  = (uint8_t)0x08, /**< Schmitt trigger disable on AIN8 */\n  ADC2_SCHMITTTRIG_CHANNEL9  = (uint8_t)0x09, /**< Schmitt trigger disable on AIN9 */\n  ADC2_SCHMITTTRIG_CHANNEL10 = (uint8_t)0x0A, /**< Schmitt trigger disable on AIN10 */\n  ADC2_SCHMITTTRIG_CHANNEL11 = (uint8_t)0x0B, /**< Schmitt trigger disable on AIN11 */\n  ADC2_SCHMITTTRIG_CHANNEL12 = (uint8_t)0x0C, /**< Schmitt trigger disable on AIN12 */\n  ADC2_SCHMITTTRIG_CHANNEL13 = (uint8_t)0x0D, /**< Schmitt trigger disable on AIN13 */\n  ADC2_SCHMITTTRIG_CHANNEL14 = (uint8_t)0x0E, /**< Schmitt trigger disable on AIN14 */\n  ADC2_SCHMITTTRIG_CHANNEL15 = (uint8_t)0x0F, /**< Schmitt trigger disable on AIN15 */\n  ADC2_SCHMITTTRIG_ALL       = (uint8_t)0x1F /**< Schmitt trigger disable on all channels */\n\n} ADC2_SchmittTrigg_TypeDef;\n\n/**\n  * @brief  ADC2 conversion mode selection\n  */\n\ntypedef enum {\n  ADC2_CONVERSIONMODE_SINGLE     = (uint8_t)0x00, /**< Single conversion mode */\n  ADC2_CONVERSIONMODE_CONTINUOUS = (uint8_t)0x01  /**< Continuous conversion mode */\n} ADC2_ConvMode_TypeDef;\n\n/**\n  * @brief  ADC2 analog channel selection\n  */\n\ntypedef enum {\n  ADC2_CHANNEL_0  = (uint8_t)0x00, /**< Analog channel 0 */\n  ADC2_CHANNEL_1  = (uint8_t)0x01, /**< Analog channel 1 */\n  ADC2_CHANNEL_2  = (uint8_t)0x02, /**< Analog channel 2 */\n  ADC2_CHANNEL_3  = (uint8_t)0x03, /**< Analog channel 3 */\n  ADC2_CHANNEL_4  = (uint8_t)0x04, /**< Analog channel 4 */\n  ADC2_CHANNEL_5  = (uint8_t)0x05, /**< Analog channel 5 */\n  ADC2_CHANNEL_6  = (uint8_t)0x06, /**< Analog channel 6 */\n  ADC2_CHANNEL_7  = (uint8_t)0x07, /**< Analog channel 7 */\n  ADC2_CHANNEL_8  = (uint8_t)0x08, /**< Analog channel 8 */\n  ADC2_CHANNEL_9  = (uint8_t)0x09, /**< Analog channel 9 */\n  ADC2_CHANNEL_10 = (uint8_t)0x0A, /**< Analog channel 10 */\n  ADC2_CHANNEL_11 = (uint8_t)0x0B, /**< Analog channel 11 */\n  ADC2_CHANNEL_12 = (uint8_t)0x0C, /**< Analog channel 12 */\n  ADC2_CHANNEL_13 = (uint8_t)0x0D, /**< Analog channel 13 */\n  ADC2_CHANNEL_14 = (uint8_t)0x0E, /**< Analog channel 14 */\n  ADC2_CHANNEL_15 = (uint8_t)0x0F  /**< Analog channel 15 */\n} ADC2_Channel_TypeDef;\n\n/**\n  * @}\n  */\n\n/* Exported constants --------------------------------------------------------*/\n\n/* Exported macros ------------------------------------------------------------*/\n\n/* Private macros ------------------------------------------------------------*/\n\n/** @addtogroup ADC2_Private_Macros\n  * @brief  Macros used by the assert function to check the different functions parameters.\n  * @{\n  */\n\n/**\n  * @brief  Macro used by the assert function to check the different prescaler's values.\n  */\n#define IS_ADC2_PRESSEL_OK(PRESCALER) (((PRESCALER) == ADC2_PRESSEL_FCPU_D2) || \\\n                                      ((PRESCALER) == ADC2_PRESSEL_FCPU_D3) || \\\n                                      ((PRESCALER) == ADC2_PRESSEL_FCPU_D4) || \\\n                                      ((PRESCALER) == ADC2_PRESSEL_FCPU_D6) || \\\n                                      ((PRESCALER) == ADC2_PRESSEL_FCPU_D8) || \\\n                                      ((PRESCALER) == ADC2_PRESSEL_FCPU_D10) || \\\n                                      ((PRESCALER) == ADC2_PRESSEL_FCPU_D12) || \\\n                                      ((PRESCALER) == ADC2_PRESSEL_FCPU_D18))\n\n/**\n  * @brief  Macro used by the assert function to check the different external trigger values.\n  */\n#define IS_ADC2_EXTTRIG_OK(EXTRIG) (((EXTRIG) == ADC2_EXTTRIG_TIM) || \\\n\t\t\t\t\t\t\t\t   ((EXTRIG) == ADC2_EXTTRIG_GPIO))\n\n/**\n  * @brief  Macro used by the assert function to check the different alignment modes.\n  */\n#define IS_ADC2_ALIGN_OK(ALIGN) (((ALIGN) == ADC2_ALIGN_LEFT) || \\\n                                ((ALIGN) == ADC2_ALIGN_RIGHT))\n\n\n/**\n  * @brief  Macro used by the assert function to check the different schmitt trigger values.\n  */\n#define IS_ADC2_SCHMITTTRIG_OK(SCHMITTTRIG) (((SCHMITTTRIG) == ADC2_SCHMITTTRIG_CHANNEL0) || \\\n    ((SCHMITTTRIG) == ADC2_SCHMITTTRIG_CHANNEL1) || \\\n    ((SCHMITTTRIG) == ADC2_SCHMITTTRIG_CHANNEL2) || \\\n    ((SCHMITTTRIG) == ADC2_SCHMITTTRIG_CHANNEL3) || \\\n    ((SCHMITTTRIG) == ADC2_SCHMITTTRIG_CHANNEL4) || \\\n    ((SCHMITTTRIG) == ADC2_SCHMITTTRIG_CHANNEL5) || \\\n    ((SCHMITTTRIG) == ADC2_SCHMITTTRIG_CHANNEL6) || \\\n    ((SCHMITTTRIG) == ADC2_SCHMITTTRIG_CHANNEL7) || \\\n    ((SCHMITTTRIG) == ADC2_SCHMITTTRIG_CHANNEL8) || \\\n    ((SCHMITTTRIG) == ADC2_SCHMITTTRIG_CHANNEL9) || \\\n    ((SCHMITTTRIG) == ADC2_SCHMITTTRIG_CHANNEL10) || \\\n    ((SCHMITTTRIG) == ADC2_SCHMITTTRIG_CHANNEL11) || \\\n    ((SCHMITTTRIG) == ADC2_SCHMITTTRIG_CHANNEL12) || \\\n    ((SCHMITTTRIG) == ADC2_SCHMITTTRIG_CHANNEL13) || \\\n    ((SCHMITTTRIG) == ADC2_SCHMITTTRIG_CHANNEL14) || \\\n    ((SCHMITTTRIG) == ADC2_SCHMITTTRIG_CHANNEL15) || \\\n    ((SCHMITTTRIG) == ADC2_SCHMITTTRIG_ALL))\n\n/**\n  * @brief  Macro used by the assert function to check the different conversion modes.\n  */\n#define IS_ADC2_CONVERSIONMODE_OK(MODE) (((MODE) == ADC2_CONVERSIONMODE_SINGLE) || \\\n                                        ((MODE) == ADC2_CONVERSIONMODE_CONTINUOUS))\n\n/**\n  * @brief  Macro used by the assert function to check the different channels values.\n  */\n#define IS_ADC2_CHANNEL_OK(CHANNEL) (((CHANNEL) == ADC2_CHANNEL_0) || \\\n                                    ((CHANNEL) == ADC2_CHANNEL_1) || \\\n                                    ((CHANNEL) == ADC2_CHANNEL_2) || \\\n                                    ((CHANNEL) == ADC2_CHANNEL_3) || \\\n                                    ((CHANNEL) == ADC2_CHANNEL_4) || \\\n                                    ((CHANNEL) == ADC2_CHANNEL_5) || \\\n                                    ((CHANNEL) == ADC2_CHANNEL_6) || \\\n                                    ((CHANNEL) == ADC2_CHANNEL_7) || \\\n                                    ((CHANNEL) == ADC2_CHANNEL_8) || \\\n                                    ((CHANNEL) == ADC2_CHANNEL_9) || \\\n                                    ((CHANNEL) == ADC2_CHANNEL_10) || \\\n                                    ((CHANNEL) == ADC2_CHANNEL_11) || \\\n                                    ((CHANNEL) == ADC2_CHANNEL_12) || \\\n                                    ((CHANNEL) == ADC2_CHANNEL_13) || \\\n                                    ((CHANNEL) == ADC2_CHANNEL_14) || \\\n                                    ((CHANNEL) == ADC2_CHANNEL_15))\n\n/**\n  * @}\n  */\n\n/* Exported functions ------------------------------------------------------- */\n\n/** @addtogroup ADC2_Exported_Functions\n  * @{\n  */\nvoid ADC2_DeInit(void);\nvoid ADC2_Init(ADC2_ConvMode_TypeDef ADC2_ConversionMode, \n               ADC2_Channel_TypeDef ADC2_Channel, \n               ADC2_PresSel_TypeDef ADC2_PrescalerSelection, \n               ADC2_ExtTrig_TypeDef ADC2_ExtTrigger, \n               FunctionalState ADC2_ExtTriggerState, \n               ADC2_Align_TypeDef ADC2_Align, \n               ADC2_SchmittTrigg_TypeDef ADC2_SchmittTriggerChannel, \n               FunctionalState ADC2_SchmittTriggerState);\nvoid ADC2_Cmd(FunctionalState NewState);\nvoid ADC2_ITConfig(FunctionalState NewState);\nvoid ADC2_PrescalerConfig(ADC2_PresSel_TypeDef ADC2_Prescaler);\nvoid ADC2_SchmittTriggerConfig(ADC2_SchmittTrigg_TypeDef ADC2_SchmittTriggerChannel, \n                              FunctionalState NewState);\nvoid ADC2_ConversionConfig(ADC2_ConvMode_TypeDef ADC2_ConversionMode, \n                           ADC2_Channel_TypeDef ADC2_Channel, \n                           ADC2_Align_TypeDef ADC2_Align);\nvoid ADC2_ExternalTriggerConfig(ADC2_ExtTrig_TypeDef ADC2_ExtTrigger, FunctionalState NewState);\nvoid ADC2_StartConversion(void);\nuint16_t ADC2_GetConversionValue(void);\nFlagStatus ADC2_GetFlagStatus(void);\nvoid ADC2_ClearFlag(void);\nITStatus ADC2_GetITStatus(void);\nvoid ADC2_ClearITPendingBit(void);\n/**\n  * @}\n  */\n\n#endif /* __STM8S_ADC2_H */\n\n\n/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\n"
  },
  {
    "path": "src/firmware/tsdz2/stm8s/stm8s_awu.h",
    "content": "/**\n  ******************************************************************************\n  * @file    stm8s_awu.h\n  * @author  MCD Application Team\n  * @version V2.3.0\n  * @date    16-June-2017\n  * @brief   This file contains all functions prototype and macros for the AWU peripheral.\n   ******************************************************************************\n  * @attention\n  *\n  * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>\n  *\n  * Licensed under MCD-ST Liberty SW License Agreement V2, (the \"License\");\n  * You may not use this file except in compliance with the License.\n  * You may obtain a copy of the License at:\n  *\n  *        http://www.st.com/software_license_agreement_liberty_v2\n  *\n  * Unless required by applicable law or agreed to in writing, software \n  * distributed under the License is distributed on an \"AS IS\" BASIS, \n  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  * See the License for the specific language governing permissions and\n  * limitations under the License.\n  *\n  ******************************************************************************\n  */\n\n/* Define to prevent recursive inclusion -------------------------------------*/\n#ifndef __STM8S_AWU_H\n#define __STM8S_AWU_H\n\n/* Includes ------------------------------------------------------------------*/\n#include \"stm8s.h\"\n\n/* Exported types ------------------------------------------------------------*/\n\n/** @addtogroup AWU_Exported_Types\n  * @{\n  */\n\n/**\n  * @brief  AWU TimeBase selection\n  */\n\ntypedef enum\n{\n  AWU_TIMEBASE_NO_IT  = (uint8_t)0,    /*!< No AWU interrupt selected */\n  AWU_TIMEBASE_250US  = (uint8_t)1,    /*!< AWU Timebase equals 0.25 ms */\n  AWU_TIMEBASE_500US  = (uint8_t)2,    /*!< AWU Timebase equals 0.5 ms */\n  AWU_TIMEBASE_1MS    = (uint8_t)3,    /*!< AWU Timebase equals 1 ms */\n  AWU_TIMEBASE_2MS    = (uint8_t)4,    /*!< AWU Timebase equals 2 ms */\n  AWU_TIMEBASE_4MS    = (uint8_t)5,    /*!< AWU Timebase equals 4 ms */\n  AWU_TIMEBASE_8MS    = (uint8_t)6,    /*!< AWU Timebase equals 8 ms */\n  AWU_TIMEBASE_16MS   = (uint8_t)7,    /*!< AWU Timebase equals 16 ms */\n  AWU_TIMEBASE_32MS   = (uint8_t)8,    /*!< AWU Timebase equals 32 ms */\n  AWU_TIMEBASE_64MS   = (uint8_t)9,    /*!< AWU Timebase equals 64 ms */\n  AWU_TIMEBASE_128MS  = (uint8_t)10,   /*!< AWU Timebase equals 128 ms */\n  AWU_TIMEBASE_256MS  = (uint8_t)11,   /*!< AWU Timebase equals 256 ms */\n  AWU_TIMEBASE_512MS  = (uint8_t)12,   /*!< AWU Timebase equals 512 ms */\n  AWU_TIMEBASE_1S     = (uint8_t)13,   /*!< AWU Timebase equals 1 s */\n  AWU_TIMEBASE_2S     = (uint8_t)14,   /*!< AWU Timebase equals 2 s */\n  AWU_TIMEBASE_12S    = (uint8_t)15,   /*!< AWU Timebase equals 12 s */\n  AWU_TIMEBASE_30S    = (uint8_t)16    /*!< AWU Timebase equals 30 s */\n} AWU_Timebase_TypeDef;\n\n/**\n  * @}\n  */\n\n/* Exported constants --------------------------------------------------------*/\n\n/** @addtogroup AWU_Exported_Constants\n  * @{\n  */\n\n#define LSI_FREQUENCY_MIN ((uint32_t)110000) /*!< LSI minimum value in Hertz */\n#define LSI_FREQUENCY_MAX ((uint32_t)150000) /*!< LSI maximum value in Hertz */\n\n/**\n  * @}\n  */\n\n/* Exported macros ------------------------------------------------------------*/\n\n/* Private macros ------------------------------------------------------------*/\n\n/** @addtogroup AWU_Private_Macros\n  * @{\n  */\n\n/**\n  * @brief  Macro used by the assert function to check the different functions parameters.\n  */\n\n/**\n  * @brief   Macro used by the assert function to check the AWU timebases\n  */\n#define IS_AWU_TIMEBASE_OK(TB) \\\n  (((TB) == AWU_TIMEBASE_NO_IT) || \\\n   ((TB) == AWU_TIMEBASE_250US) || \\\n   ((TB) == AWU_TIMEBASE_500US) || \\\n   ((TB) == AWU_TIMEBASE_1MS)   || \\\n   ((TB) == AWU_TIMEBASE_2MS)   || \\\n   ((TB) == AWU_TIMEBASE_4MS)   || \\\n   ((TB) == AWU_TIMEBASE_8MS)   || \\\n   ((TB) == AWU_TIMEBASE_16MS)  || \\\n   ((TB) == AWU_TIMEBASE_32MS)  || \\\n   ((TB) == AWU_TIMEBASE_64MS)  || \\\n   ((TB) == AWU_TIMEBASE_128MS) || \\\n   ((TB) == AWU_TIMEBASE_256MS) || \\\n   ((TB) == AWU_TIMEBASE_512MS) || \\\n   ((TB) == AWU_TIMEBASE_1S)    || \\\n   ((TB) == AWU_TIMEBASE_2S)    || \\\n   ((TB) == AWU_TIMEBASE_12S)   || \\\n   ((TB) == AWU_TIMEBASE_30S))\n\n/**\n  * @brief    Macro used by the assert function to check the LSI frequency (in Hz)\n  */\n#define IS_LSI_FREQUENCY_OK(FREQ) \\\n  (((FREQ) >= LSI_FREQUENCY_MIN) && \\\n   ((FREQ) <= LSI_FREQUENCY_MAX))\n\n/**\n  * @}\n  */\n\n/* Exported functions ------------------------------------------------------- */\n\n/** @addtogroup AWU_Exported_Functions\n  * @{\n  */\nvoid AWU_DeInit(void);\nvoid AWU_Init(AWU_Timebase_TypeDef AWU_TimeBase);\nvoid AWU_Cmd(FunctionalState NewState);\nvoid AWU_LSICalibrationConfig(uint32_t LSIFreqHz);\nvoid AWU_IdleModeEnable(void);\nFlagStatus AWU_GetFlagStatus(void);\n\n/**\n  * @}\n  */\n\n#endif /* __STM8S_AWU_H */\n\n\n/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\n"
  },
  {
    "path": "src/firmware/tsdz2/stm8s/stm8s_beep.h",
    "content": "/**\n  ******************************************************************************\n  * @file    stm8s_beep.h\n  * @author  MCD Application Team\n  * @version V2.3.0\n  * @date    16-June-2017\n  * @brief   This file contains all functions prototype and macros for the BEEP peripheral.\n   ******************************************************************************\n  * @attention\n  *\n  * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>\n  *\n  * Licensed under MCD-ST Liberty SW License Agreement V2, (the \"License\");\n  * You may not use this file except in compliance with the License.\n  * You may obtain a copy of the License at:\n  *\n  *        http://www.st.com/software_license_agreement_liberty_v2\n  *\n  * Unless required by applicable law or agreed to in writing, software \n  * distributed under the License is distributed on an \"AS IS\" BASIS, \n  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  * See the License for the specific language governing permissions and\n  * limitations under the License.\n  *\n  ******************************************************************************\n  */\n\n\n/* Define to prevent recursive inclusion -------------------------------------*/\n#ifndef __STM8S_BEEP_H\n#define __STM8S_BEEP_H\n\n/* Includes ------------------------------------------------------------------*/\n#include \"stm8s.h\"\n\n/* Exported types ------------------------------------------------------------*/\n\n/** @addtogroup BEEP_Exported_Types\n  * @{\n  */\n\n/**\n  * @brief  BEEP Frequency selection\n  */\ntypedef enum {\n  BEEP_FREQUENCY_1KHZ = (uint8_t)0x00,  /*!< Beep signal output frequency equals to 1 KHz */\n  BEEP_FREQUENCY_2KHZ = (uint8_t)0x40,  /*!< Beep signal output frequency equals to 2 KHz */\n  BEEP_FREQUENCY_4KHZ = (uint8_t)0x80   /*!< Beep signal output frequency equals to 4 KHz */\n} BEEP_Frequency_TypeDef;\n\n/**\n  * @}\n  */\n\n/* Exported constants --------------------------------------------------------*/\n\n/** @addtogroup BEEP_Exported_Constants\n  * @{\n  */\n\n#define BEEP_CALIBRATION_DEFAULT ((uint8_t)0x0B) /*!< Default value when calibration is not done */\n\n#define LSI_FREQUENCY_MIN ((uint32_t)110000) /*!< LSI minimum value in Hertz */\n#define LSI_FREQUENCY_MAX ((uint32_t)150000) /*!< LSI maximum value in Hertz */\n\n/**\n  * @}\n  */\n\n/* Exported macros -----------------------------------------------------------*/\n/* Private macros ------------------------------------------------------------*/\n\n/** @addtogroup BEEP_Private_Macros\n  * @{\n  */\n\n/**\n  * @brief  Macro used by the assert function to check the different functions parameters.\n  */\n\n/**\n  * @brief  Macro used by the assert function to check the BEEP frequencies.\n  */\n#define IS_BEEP_FREQUENCY_OK(FREQ) \\\n  (((FREQ) == BEEP_FREQUENCY_1KHZ) || \\\n   ((FREQ) == BEEP_FREQUENCY_2KHZ) || \\\n   ((FREQ) == BEEP_FREQUENCY_4KHZ))\n\n/**\n  * @brief   Macro used by the assert function to check the LSI frequency (in Hz).\n  */\n#define IS_LSI_FREQUENCY_OK(FREQ) \\\n  (((FREQ) >= LSI_FREQUENCY_MIN) && \\\n   ((FREQ) <= LSI_FREQUENCY_MAX))\n\n/**\n  * @}\n  */\n\n/* Exported functions ------------------------------------------------------- */\n\n/** @addtogroup BEEP_Exported_Functions\n  * @{\n  */\n\nvoid BEEP_DeInit(void);\nvoid BEEP_Init(BEEP_Frequency_TypeDef BEEP_Frequency);\nvoid BEEP_Cmd(FunctionalState NewState);\nvoid BEEP_LSICalibrationConfig(uint32_t LSIFreqHz);\n\n\n/**\n  * @}\n  */\n\n#endif /* __STM8S_BEEP_H */\n\n\n/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\n"
  },
  {
    "path": "src/firmware/tsdz2/stm8s/stm8s_can.h",
    "content": "/**\n  ******************************************************************************\n  * @file    stm8s_can.h\n  * @author  MCD Application Team\n  * @version V2.3.0\n  * @date    16-June-2017\n  * @brief   This file contains all the functions for the CAN peripheral.\n   ******************************************************************************\n  * @attention\n  *\n  * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>\n  *\n  * Licensed under MCD-ST Liberty SW License Agreement V2, (the \"License\");\n  * You may not use this file except in compliance with the License.\n  * You may obtain a copy of the License at:\n  *\n  *        http://www.st.com/software_license_agreement_liberty_v2\n  *\n  * Unless required by applicable law or agreed to in writing, software \n  * distributed under the License is distributed on an \"AS IS\" BASIS, \n  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  * See the License for the specific language governing permissions and\n  * limitations under the License.\n  *\n  ******************************************************************************\n  */\n\n/* Define to prevent recursive inclusion -------------------------------------*/\n#ifndef __STM8S_CAN_H\n#define __STM8S_CAN_H\n\n/* Includes ------------------------------------------------------------------*/\n#include \"stm8s.h\"\n\n/* Exported constants --------------------------------------------------------*/\n#define CAN_STDID_SIZE ((uint16_t)0x07FF)\n#define CAN_EXTID_SIZE ((uint32_t)0x1FFFFFFF)\n#define CAN_DLC_MAX ((uint8_t)0x08)\n\n\n/** @addtogroup CAN_Exported_Types\n  * @{\n  */\n\n\n/**\n  * @brief  CAN Page Mapping\n */\ntypedef enum\n{\n CAN_Page_TxMailBox0  = ((uint8_t) 0), /*!< CAN TX mailbox 0 reg page */\n CAN_Page_TxMailBox1  = ((uint8_t) 1), /*!< CAN TX mailbox 1 reg page */\n CAN_Page_TxMailBox2  = ((uint8_t) 5), /*!< CAN TX mailbox 2 reg page */\n CAN_Page_Filter01    = ((uint8_t) 2), /*!< CAN Filters 0 & 1 reg page*/\n CAN_Page_Filter23    = ((uint8_t) 3), /*!< CAN Filters 2 & 3 reg page*/\n CAN_Page_Filter45    = ((uint8_t) 4), /*!< CAN Filters 4 & 5 reg page*/\n CAN_Page_Config      = ((uint8_t) 6), /*!< CAN Configuration control/status reg page*/\n CAN_Page_RxFifo      = ((uint8_t) 7) /*!< CAN RX FIFO registers page */\n}CAN_Page_TypeDef;\n\n\n\n/**\n  * @brief   CAN sleep constants \n */\ntypedef enum {\n  CAN_InitStatus_Failed =0,                        /*!< CAN initialization failed */\n  CAN_InitStatus_Success =! CAN_InitStatus_Failed  /*!< CAN initialization OK*/\n} CAN_InitStatus_TypeDef;\n\n \n /**\n  * @brief  CAN operating mode */\n typedef enum\n{\n  CAN_OperatingMode_Initialization    =((uint8_t)0x00),    /*!< Initialization mode */\n  CAN_OperatingMode_Normal            =((uint8_t)0x01),    /*!< Normal mode */\n  CAN_OperatingMode_Sleep             =((uint8_t)0x02)    /*!< sleep mode */\n}CAN_OperatingMode_TypeDef;\n\n /**\n  * @brief  CAN operating mode status */\n typedef enum\n{\n  CAN_ModeStatus_Failed    = ((uint8_t)0x00),          /*!< CAN entering the specific mode failed */\n  CAN_ModeStatus_Success    =! CAN_ModeStatus_Failed   /*!< CAN entering the specific mode Succeed */\n}CAN_ModeStatus_TypeDef;\n\n /**\n  * @brief   CAN Time Triggered Communication mode \n  */\ntypedef enum\n{\n CAN_MasterCtrl_AllDisabled          =((uint8_t)0x00),  /*!<  CAN  ALL Master Control Option are DISABLED */\n CAN_MasterCtrl_AllEnabled           =((uint8_t)0xFC),  /*!<  CAN  ALL Master Control Option are DISABLED */\n CAN_MasterCtrl_TimeTriggerCOMMode   =((uint8_t)0x80),  /*!<  CAN Time Triggered Communication mode ENABLED */\n CAN_MasterCtrl_AutoBusOffManagement =((uint8_t)0x40),  /*!<  CAN Auto Bus Off Management ENABLED */\n CAN_MasterCtrl_AutoWakeUpMode       =((uint8_t)0x20),  /*!<  CAN Automatic WakeUp Mode ENABLED , sleep mode is left automatically by hardware  */\n CAN_MasterCtrl_NoAutoReTx           =((uint8_t)0x10),  /*!<  CAN Non Automatic Retransmission ENABLED, MSG  will be transmitted only once */\n CAN_MasterCtrl_RxFifoLockedMode     =((uint8_t)0x08),  /*!<  CAN Receive FIFO Locked  against overrun ENABLED */\n CAN_MasterCtrl_TxFifoPriority       =((uint8_t)0x04)   /*!<  CAN Transmit FIFO Priority  driven by the request order (not by the identifier of the MSG) */\n }CAN_MasterCtrl_TypeDef;\n\n/**\n  * @brief   CAN  mode options */\ntypedef enum\n{\n  CAN_Mode_Normal             =((uint8_t)0x00),  /*!< normal mode */\n  CAN_Mode_LoopBack           =((uint8_t)0x01),  /*!< loopback mode */\n  CAN_Mode_Silent             =((uint8_t)0x02),  /*!< silent mode */\n  CAN_Mode_Silent_LoopBack    =((uint8_t)0x03)  /*!< loopback combined with silent mode */\n}CAN_Mode_TypeDef;\n\n/**\n  * @brief  CAN synchronisation jump width (SJW)*/\ntypedef enum\n{\n  CAN_SynJumpWidth_1TimeQuantum                 =((uint8_t)0x00),  /*!< 1 time quantum */\n  CAN_SynJumpWidth_2TimeQuantum                 =((uint8_t)0x40),  /*!< 2 time quantum */\n  CAN_SynJumpWidth_3TimeQuantum                 =((uint8_t)0x80),  /*!< 3 time quantum */\n  CAN_SynJumpWidth_4TimeQuantum                 =((uint8_t)0xC0)  /*!< 4 time quantum */\n}CAN_SynJumpWidth_TypeDef;\n\n/**\n  * @brief   time quantum in bit segment 1 */\ntypedef enum\n{\n  CAN_BitSeg1_1TimeQuantum                 =((uint8_t)0x00),  /*!< 1 time quantum */\n  CAN_BitSeg1_2TimeQuantum                 =((uint8_t)0x01),  /*!< 2 time quantum */\n  CAN_BitSeg1_3TimeQuantum                 =((uint8_t)0x02),  /*!< 3 time quantum */\n  CAN_BitSeg1_4TimeQuantum                 =((uint8_t)0x03) , /*!< 4 time quantum */\n  CAN_BitSeg1_5TimeQuantum                 =((uint8_t)0x04) , /*!< 5 time quantum */\n  CAN_BitSeg1_6TimeQuantum                 =((uint8_t)0x05) , /*!< 6 time quantum */\n  CAN_BitSeg1_7TimeQuantum                 =((uint8_t)0x06) , /*!< 7 time quantum */\n  CAN_BitSeg1_8TimeQuantum                 =((uint8_t)0x07),  /*!< 8 time quantum */\n  CAN_BitSeg1_9TimeQuantum                 =((uint8_t)0x08),  /*!< 9 time quantum */\n  CAN_BitSeg1_10TimeQuantum                =((uint8_t)0x09),  /*!< 10 time quantum */\n  CAN_BitSeg1_11TimeQuantum                =((uint8_t)0x0A),  /*!< 11 time quantum */\n  CAN_BitSeg1_12TimeQuantum                =((uint8_t)0x0B),  /*!< 12 time quantum */\n  CAN_BitSeg1_13TimeQuantum                =((uint8_t)0x0C),  /*!< 13 time quantum */\n  CAN_BitSeg1_14TimeQuantum                =((uint8_t)0x0D),  /*!< 14 time quantum */\n  CAN_BitSeg1_15TimeQuantum                =((uint8_t)0x0E),  /*!< 15 time quantum */\n  CAN_BitSeg1_16TimeQuantum                =((uint8_t)0x0F)  /*!< 16 time quantum */\n}CAN_BitSeg1_TypeDef;\n\n/**\n  * @brief   time quantum in bit segment 2 */\ntypedef enum\n{\n  CAN_BitSeg2_1TimeQuantum                = ((uint8_t)0x00),  /*!< 1 time quantum */\n  CAN_BitSeg2_2TimeQuantum                = ((uint8_t)0x10),  /*!< 2 time quantum */\n  CAN_BitSeg2_3TimeQuantum                = ((uint8_t)0x20),  /*!< 3 time quantum */\n  CAN_BitSeg2_4TimeQuantum                = ((uint8_t)0x30),  /*!< 4 time quantum */\n  CAN_BitSeg2_5TimeQuantum                = ((uint8_t)0x40),  /*!< 5 time quantum */\n  CAN_BitSeg2_6TimeQuantum                = ((uint8_t)0x50),  /*!< 6 time quantum */\n  CAN_BitSeg2_7TimeQuantum                = ((uint8_t)0x60),  /*!< 7 time quantum */\n  CAN_BitSeg2_8TimeQuantum                = ((uint8_t)0x70)   /*!< 8 time quantum */\n}CAN_BitSeg2_TypeDef;\n\n\n/**\n  * @brief   CAN filter number */\ntypedef enum\n{                                                                  \n  CAN_FilterNumber_0                = ((uint8_t)0x00),  /*!< Filter number 0 */ \n  CAN_FilterNumber_1                = ((uint8_t)0x01),  /*!< Filter number 1 */ \n  CAN_FilterNumber_2                = ((uint8_t)0x02),  /*!< Filter number 2 */\n  CAN_FilterNumber_3                = ((uint8_t)0x03),  /*!< Filter number 3 */\n  CAN_FilterNumber_4                = ((uint8_t)0x04),  /*!< Filter number 4 */ \n  CAN_FilterNumber_5                = ((uint8_t)0x05)   /*!< Filter number 5 */ \n}CAN_FilterNumber_TypeDef;\n\n/**\n  * @brief   CAN filter mode */\ntypedef enum\n{\n  CAN_FilterMode_IdMask                  =  ((uint8_t)0x00),    /*!< id/mask mode */\n  CAN_FilterMode_IdMask_IdList           =  ((uint8_t)0x10),    /*!< Id/Mask mode First and IdList mode second */\n  CAN_FilterMode_IdList_IdMask           =  ((uint8_t)0x11),    /*!< IdList mode First and IdMask mode second */\n  CAN_FilterMode_IdList                  =  ((uint8_t)0x01)     /*!< identifier list mode */\n}CAN_FilterMode_TypeDef;\n\n/**\n  * @brief   CAN filter scale */\ntypedef enum\n{\n  CAN_FilterScale_8Bit       =((uint8_t)0x00), /*!< 8-bit filter scale */\n  CAN_FilterScale_16_8Bit    =((uint8_t)0x02), /*!< 16/8-bit filter scale */\n  CAN_FilterScale_16Bit      =((uint8_t)0x04), /*!< 16-bit filter scale */\n  CAN_FilterScale_32Bit      =((uint8_t)0x06)  /*!< 32-bit filter scale */\n}CAN_FilterScale_TypeDef;\n\n\n/**\n  * @brief   CAN Tx mailboxes*/\ntypedef enum\n{\n CAN_TransmitMailBox_0       = ((uint8_t) 0x00),  /*!< CAN TX mailbox 0 reg page */\n CAN_TransmitMailBox_1       = ((uint8_t) 0x01),  /*!< CAN TX mailbox 1 reg page */\n CAN_TransmitMailBox_2       = ((uint8_t) 0x05)   /*!< CAN TX mailbox 2 reg page */\n}CAN_TransmitMailBox_TypeDef;\n\n/**\n  * @brief   CAN Pending Messages number*/\ntypedef enum\n{\n  CAN_NbrPendingMessage_0     =  ((uint8_t)0x00),  /*!< No Msg Pending */\n  CAN_NbrPendingMessage_1     =  ((uint8_t)0x01),  /*!< 1 Msg Pending */\n  CAN_NbrPendingMessage_2     =  ((uint8_t)0x02),  /*!< 2 Msg Pending */\n  CAN_NbrPendingMessage_3     =  ((uint8_t)0x03)  /*!< 3 Msg Pending */\n}CAN_NbrPendingMessage_TypeDef;\n\n/**\n  * @brief   CAN identifier type */\ntypedef enum\n{\n  CAN_Id_Standard                 =((uint8_t)0x00),  /*!< Standard Id */\n  CAN_Id_Extended                 =((uint8_t)0x40)  /*!< Extended Id */\n}CAN_Id_TypeDef;\n\n/**\n  * @brief   CAN remote transmission request */\ntypedef enum\n{\n  CAN_RTR_Data               = ((uint8_t)0x00),  /*!< Data frame */\n  CAN_RTR_Remote             = ((uint8_t)0x20)  /*!< Remote frame */\n}CAN_RTR_TypeDef;\n\n/**\n  * @brief   CAN transmit Status */\ntypedef enum\n{\n  CAN_TxStatus_Failed                 =((uint8_t)0xF0), /*!< CAN transmission failed */\n  CAN_TxStatus_Ok                     =((uint8_t)0xF1), /*!< CAN transmission succeeded */\n  CAN_TxStatus_Pending                =((uint8_t)0xF2), /*!< CAN transmission pending */\n  CAN_TxStatus_NoMailBox              =((uint8_t)0xF4), /*!< CAN cell did not provide an empty mailbox */\n  CAN_TxStatus_MailBoxEmpty           =((uint8_t)0xF5), /*!< CAN Tx mailbox is Empty */\n  CAN_TxStatus_MailBox0Ok             =((uint8_t)0x00), /*!< CAN transmission succeeded by mail box 1*/\n  CAN_TxStatus_MailBox1Ok             =((uint8_t)0x01), /*!< CAN transmission succeeded by mail box 2*/\n  CAN_TxStatus_MailBox2Ok             =((uint8_t)0x05) /*!< CAN transmission succeeded by mail box 3*/\n}CAN_TxStatus_TypeDef;\n\n/**\n  * @brief   CAN sleep Status */\ntypedef enum\n{\n  CAN_Sleep_Failed             = ((uint8_t)0x00), /*!< CAN did not enter the sleep mode */\n  CAN_Sleep_Ok                 = ((uint8_t)0x01) /*!< CAN entered the sleep mode */\n}CAN_Sleep_TypeDef;\n/**\n  * @brief   CAN wake up status */\ntypedef enum\n{\n CAN_WakeUp_Failed          =   ((uint8_t)0x00), /*!< CAN did not leave the sleep mode */\n CAN_WakeUp_Ok              =   ((uint8_t)0x01) /*!< CAN leaved the sleep mode */\n}CAN_WakeUp_TypeDef;\n\n/**\n  * @brief   CAN flags */\ntypedef enum\n{\n  /* if the flag is 0x3XXX, it means that it can be got (CAN_GetFlagStatus) and Cleared (CAN_ClearFlag) */\n  /* if the flag is 0x1XXX, it means that it can only be got (CAN_GetFlagStatus)  */\n  /*Transmit Flags*/\n  CAN_FLAG_RQCP0            =((uint16_t)0x3401), /*!< Request MailBox0  Flag */\n  CAN_FLAG_RQCP1            =((uint16_t)0x3402), /*!< Request MailBox1  Flag */\n  CAN_FLAG_RQCP2            =((uint16_t)0x3404), /*!< Request MailBox2  Flag */\n  /*Receive Flags*/\n  CAN_FLAG_FMP              =((uint16_t)0x1203), /*!< FIFO Message Pending Flag */\n  CAN_FLAG_FF               =((uint16_t)0x3208), /*!< FIFO Full  Flag */\n  CAN_FLAG_FOV              =((uint16_t)0x3210), /*!< FIFO Overrun  Flag */\n  /*Wake up Flag*/\n  CAN_FLAG_WKU              =((uint16_t)0x3108), /*!< wake up   Flag */\n  /*Error Flags*/\n  CAN_FLAG_EWG              =((uint16_t)0x1001), /*!< Error Warning Flag */\n  CAN_FLAG_EPV              =((uint16_t)0x1002), /*!< Error Passive Flag */\n  CAN_FLAG_BOF              =((uint16_t)0x1004), /*!< Bus-Off Flag */\n  CAN_FLAG_LEC              =((uint16_t)0x3070) /*!< Last error code Flag */\n}CAN_FLAG_TypeDef;\n\n/**\n  * @brief   CAN interrupts */\ntypedef enum\n{\n  /*Transmit Interruption*/\n  CAN_IT_TME                  =((uint16_t)0x0001), /*!< Transmit mailbox empty interrupt */\n  /*Receive Interruptions*/\n  CAN_IT_FMP                  =((uint16_t)0x0002), /*!< FIFO  message pending interrupt   */  \n  CAN_IT_FF                   =((uint16_t)0x0004), /*!< FIFO  full    interrupt                    */\n  CAN_IT_FOV                  =((uint16_t)0x0008), /*!< FIFO  overrun  interrupt               */\n  /*Wake Up Interruption*/\n  CAN_IT_WKU                  =((uint16_t)0x0080), /*!< Wake-up interrupt                         */\n  /*Error Interruptions*/\n  CAN_IT_ERR                  =((uint16_t)0x4000), /*!< Genaral Error interrupt                 */\n  CAN_IT_EWG                  =((uint16_t)0x0100), /*!< Error warning interrupt                */\n  CAN_IT_EPV                  =((uint16_t)0x0200), /*!< Error passive  interrupt                */\n  CAN_IT_BOF                  =((uint16_t)0x0400), /*!< Bus-off   interrupt                        */\n  CAN_IT_LEC                  =((uint16_t)0x0800)  /*!< Last error code interrupt              */\n} CAN_IT_TypeDef;\n\n/**\n  * @brief   CAN ST7 Compatibility*/\ntypedef enum\n{\n  CAN_ST7Compatibility_Enable     =  ((uint8_t)0x00), /*!< CAN is compatible with ST7 beCAN (only 2 mailboxes are available)*/\n  CAN_ST7Compatibility_Disable    =  ((uint8_t)0x10)  /*!< CAN is not compatible with ST7 beCAN ( 3 mailboxes are available)*/\n}CAN_ST7Compatibility_TypeDef;\n\n/**\n  * @brief   CAN Error Code description */\ntypedef enum\n{                                                                  \n  CAN_ErrorCode_NoErr                 = ((uint8_t)0x00),  /*!< No Error  */ \n  CAN_ErrorCode_StuffErr              = ((uint8_t)0x10),  /*!< Stuff Error  */ \n  CAN_ErrorCode_FormErr               = ((uint8_t)0x20),  /*!< Form Error  */ \n  CAN_ErrorCode_ACKErr                = ((uint8_t)0x30),  /*!< Acknowledgment Error  */ \n  CAN_ErrorCode_BitRecessiveErr       = ((uint8_t)0x40),  /*!< Bit Recessive Error  */ \n  CAN_ErrorCode_BitDominantErr        = ((uint8_t)0x50),  /*!< Bit Dominant Error  */ \n  CAN_ErrorCode_CRCErr                = ((uint8_t)0x60),  /*!< CRC Error  */ \n  CAN_ErrorCode_SoftwareSetErr        = ((uint8_t)0x70)  /*!< Software Set Error  */ \n}CAN_ErrorCode_TypeDef;\n/**\n  * @}\n  */\n/* Private macros ------------------------------------------------------------*/\n/** @addtogroup CAN_Private_Macros\n  * @{\n  */\n/**\n  * @brief  Macro used by the assert function in order to check the CAN ST7 Compatibility parameters.\n  */\n#define IS_CAN_ST7_COMPATIBILITY_OK(STATE) (((STATE) == CAN_ST7Compatibility_Enable) || ((STATE) == CAN_ST7Compatibility_Disable))\n/**\n  * @brief  Macro used by the assert function in order to check  CAN operating mode.\n  */\n#define IS_CAN_OPERATINGMODE_OK(MODE) (((MODE) == CAN_OperatingMode_Initialization) ||\\\n                                    ((MODE) == CAN_OperatingMode_Normal)|| \\\n                        ((MODE) == CAN_OperatingMode_Sleep))\n/**\n  * @brief  Macro used by the assert function in order to check CAN Time Triggered Communication mode.\n  */\n#define IS_CAN_MASTERCTRL_OK(MODE) (((MODE) == CAN_MasterCtrl_AllDisabled) || \\\n                                    (((MODE) <= CAN_MasterCtrl_AllEnabled) && ((MODE) >= CAN_MasterCtrl_TxFifoPriority)))\n/**\n  * @brief  Macro used by the assert function in order to check   CAN  mode options .\n  */\n#define IS_CAN_MODE_OK(MODE) (((MODE) == CAN_Mode_Normal) || ((MODE) == CAN_Mode_LoopBack)|| \\\n                           ((MODE) == CAN_Mode_Silent) || ((MODE) == CAN_Mode_Silent_LoopBack))\n/**\n  * @brief  Macro used by the assert function in order to check the CAN synchronisation jump width (SJW).\n  */\n#define IS_CAN_SYNJUMPWIDTH_OK(SJW) (((SJW) == CAN_SynJumpWidth_1TimeQuantum) || ((SJW) == CAN_SynJumpWidth_2TimeQuantum)|| \\\n                         ((SJW) == CAN_SynJumpWidth_3TimeQuantum) || ((SJW) == CAN_SynJumpWidth_4TimeQuantum))\n/**\n  * @brief  Macro used by the assert function in order to check time quantum in bit segment 1 .\n  */\n#define IS_CAN_BITSEG1_OK(BS1) ((BS1) <= CAN_BitSeg1_16TimeQuantum)\n/**\n  * @brief  Macro used by the assert function in order to check time quantum in bit segment 2.\n  */\n#define IS_CAN_BITSEG2_OK(BS2) ((((BS2) >= CAN_BitSeg2_2TimeQuantum) && ((BS2) <= CAN_BitSeg2_8TimeQuantum))|| ((BS2) == CAN_BitSeg2_1TimeQuantum))\n/**\n  * @brief  Macro used by the assert function in order to check CAN clock prescaler.\n  */\n#define IS_CAN_PRESCALER_OK(PRESCALER) (((PRESCALER) >= 1) && ((PRESCALER) <= 64))\n/**\n  * @brief  Macro used by the assert function in order to check CAN filter number.\n  */\n#define IS_CAN_FILTER_NUMBER_OK(NUMBER) (((NUMBER) == CAN_FilterNumber_0) || \\\n                                       ((NUMBER) == CAN_FilterNumber_1) || \\\n                                       ((NUMBER) == CAN_FilterNumber_2) || \\\n                                       ((NUMBER) == CAN_FilterNumber_3) || \\\n                                       ((NUMBER) == CAN_FilterNumber_4) || \\\n                                       ((NUMBER) == CAN_FilterNumber_5))\n/**\n  * @brief  Macro used by the assert function in order to check  CAN filter mode.\n  */\n#define IS_CAN_FILTER_MODE_OK(MODE) (((MODE) == CAN_FilterMode_IdMask) || \\\n                                     ((MODE) == CAN_FilterMode_IdMask_IdList) || \\\n                                     ((MODE) == CAN_FilterMode_IdList_IdMask) || \\\n                                  ((MODE) == CAN_FilterMode_IdList))\n/**\n  * @brief  Macro used by the assert function in order to check CAN filter scale.\n  */\n#define IS_CAN_FILTER_SCALE_OK(SCALE) (((SCALE) == CAN_FilterScale_8Bit)|| \\\n                                    ((SCALE) == CAN_FilterScale_16_8Bit) ||\\\n                                    ((SCALE) == CAN_FilterScale_16Bit  )||\\\n                                    ((SCALE) == CAN_FilterScale_32Bit))\n/**\n  * @brief  Macro used by the assert function in order to check CAN Tx mailboxes.\n  */\n#define IS_CAN_TRANSMITMAILBOX_OK(TRANSMITMAILBOX) (((TRANSMITMAILBOX) == CAN_TransmitMailBox_0) || \\\n                                                 ((TRANSMITMAILBOX) == CAN_TransmitMailBox_1) || \\\n                                                 ((TRANSMITMAILBOX) == CAN_TransmitMailBox_2))\n/**\n  * @brief  Macro used by the assert function in order to check the Standard ID to be sent.\n  */\n#define IS_CAN_STDID_OK(STDID)   ((STDID) <= ((uint16_t)CAN_STDID_SIZE))\n/**\n  * @brief  Macro used by the assert function in order to check the Extended ID to be sent.\n  */\n#define IS_CAN_EXTID_OK(EXTID)   ((EXTID) <= ((uint32_t)CAN_EXTID_SIZE))\n/**\n  * @brief  Macro used by the assert function in order to check the DLC to be sent.\n  */\n#define IS_CAN_DLC_OK(DLC)       ((DLC) <= CAN_DLC_MAX)\n/**\n  * @brief  Macro used by the assert function in order to check the type of the ID to be sent.\n  */\n#define IS_CAN_IDTYPE_OK(IDTYPE) (((IDTYPE) == CAN_Id_Standard) || ((IDTYPE) == CAN_Id_Extended))\n/**\n  * @brief  Macro used by the assert function in order to check CAN  transmission  Frame Type.\n  */\n#define IS_CAN_RTR_OK(RTR) (((RTR) == CAN_RTR_Data) || ((RTR) == CAN_RTR_Remote))\n\n/**\n  * @brief  Macro used by the assert function in order to check  CAN flags which can be got by @ref CAN_GetFlagStatus\n  */\n#define IS_CAN_FLAG_STATUS_OK(FLAG) (((FLAG) == CAN_FLAG_RQCP0) || ((FLAG) == CAN_FLAG_RQCP1) ||\\\n                                  ((FLAG) == CAN_FLAG_RQCP2) || ((FLAG) == CAN_FLAG_FMP) ||\\\n                                  ((FLAG) == CAN_FLAG_FF) || ((FLAG) == CAN_FLAG_FOV) ||\\\n                                  ((FLAG) == CAN_FLAG_WKU) || ((FLAG) == CAN_FLAG_EWG) ||\\\n                                  ((FLAG) == CAN_FLAG_EPV) || ((FLAG) == CAN_FLAG_BOF) ||\\\n                                  ((FLAG) == CAN_FLAG_LEC))\n/**\n  * @brief  Macro used by the assert function in order to check  CAN flags which can be cleared by @ref CAN_ClearFlag\n  */\n#define IS_CAN_FLAG_CLEAR_OK(FLAG) (((FLAG) == CAN_FLAG_RQCP0) || ((FLAG) == CAN_FLAG_RQCP1) ||\\\n                                    ((FLAG) == CAN_FLAG_RQCP2) ||  ((FLAG) == CAN_FLAG_FF)   ||\\\n                                    ((FLAG) == CAN_FLAG_FOV)  ||  ((FLAG) == CAN_FLAG_WKU) ||\\\n                                    ((FLAG) == CAN_FLAG_LEC))\n/**\n  * @brief  Macro used by the assert function in order to check the  CAN Configuration interrupts.\n  */\n#define CAN_IT_CONFIG_MASK  ~(uint16_t)(CAN_IT_TME|CAN_IT_FMP|CAN_IT_FF|CAN_IT_FOV|CAN_IT_WKU|CAN_IT_EWG|CAN_IT_EPV|CAN_IT_BOF|CAN_IT_LEC|CAN_IT_ERR)\n#define IS_CAN_IT_CONFIG_OK(IT) (((IT) != 0x0000) && ((uint16_t)((uint16_t)(IT) & (uint16_t)CAN_IT_CONFIG_MASK) == 0x0000))\n/**\n  * @brief  Macro used by the assert function in order to check the  CAN status interrupts.\n  */\n#define IS_CAN_IT_STATUS_OK(IT) (((IT) == CAN_IT_TME)   || ((IT) == CAN_IT_FMP) ||\\\n                             ((IT) == CAN_IT_FF)    || ((IT) == CAN_IT_FOV) || \\\n                             ((IT) == CAN_IT_WKU)   || ((IT) == CAN_IT_ERR)  || \\\n                             ((IT) == CAN_IT_EWG)   || ((IT) == CAN_IT_EPV)  || \\\n                             ((IT) == CAN_IT_BOF)   || ((IT) == CAN_IT_LEC)  )\n/**\n  * @brief  Macro used by the assert function in order to check the  CAN Pending bit interrupts.\n  */\n#define IS_CAN_IT_PENDING_BIT_OK(IT) (((IT) == CAN_IT_TME) || ((IT) == CAN_IT_FF)  ||\\\n                                      ((IT) == CAN_IT_FOV)  || ((IT) == CAN_IT_WKU) ||\\\n                                      ((IT) == CAN_IT_ERR)  || ((IT) == CAN_IT_EWG) ||\\\n                                      ((IT) == CAN_IT_EPV) || ((IT) == CAN_IT_BOF)||\\\n                                      ((IT) == CAN_IT_LEC))\n/**\n  * @brief  Macro used by the assert function in order to check the Last Error Code.\n  */\n#define IS_CAN_LAST_ERROR_CODE_OK(CODE)  (((CODE) & 0x8F) == 0x00)\n/**\n  * @}\n  */\n\n/* Exported function prototypes --------------------------------------------- */\n/** @addtogroup CAN_Exported_Functions\n  * @{\n  */\nvoid CAN_DeInit(void);\nCAN_InitStatus_TypeDef CAN_Init(CAN_MasterCtrl_TypeDef CAN_MasterCtrl,\n                                CAN_Mode_TypeDef CAN_Mode,\n                                CAN_SynJumpWidth_TypeDef CAN_SynJumpWidth,\n                                CAN_BitSeg1_TypeDef CAN_BitSeg1,\n                                CAN_BitSeg2_TypeDef CAN_BitSeg2,\n                                uint8_t CAN_Prescaler);\n\nvoid CAN_FilterInit(CAN_FilterNumber_TypeDef CAN_FilterNumber,\n                    FunctionalState CAN_FilterActivation,\n                    CAN_FilterMode_TypeDef CAN_FilterMode,\n                    CAN_FilterScale_TypeDef CAN_FilterScale,\n                    uint8_t CAN_FilterID1,  \n                    uint8_t CAN_FilterID2,\n                    uint8_t CAN_FilterID3,\n                     uint8_t CAN_FilterID4,\n                    uint8_t CAN_FilterIDMask1,\n                     uint8_t CAN_FilterIDMask2,\n                    uint8_t CAN_FilterIDMask3,\n                    uint8_t CAN_FilterIDMask4);\nvoid CAN_ITConfig(CAN_IT_TypeDef CAN_IT, FunctionalState NewState);\nvoid CAN_ST7CompatibilityCmd(CAN_ST7Compatibility_TypeDef CAN_ST7Compatibility);\nCAN_TxStatus_TypeDef CAN_Transmit( uint32_t CAN_Id,\n                                   CAN_Id_TypeDef CAN_IDE,\n                                   CAN_RTR_TypeDef CAN_RTR,\n                                   uint8_t CAN_DLC,\n                                   uint8_t *CAN_Data);\nvoid CAN_TTComModeCmd(FunctionalState NewState);\nCAN_TxStatus_TypeDef CAN_TransmitStatus(CAN_TransmitMailBox_TypeDef CAN_TransmitMailbox);\nvoid CAN_CancelTransmit(CAN_TransmitMailBox_TypeDef CAN_TransmitMailbox);\nvoid CAN_FIFORelease(void);\nCAN_NbrPendingMessage_TypeDef CAN_MessagePending(void);\nvoid CAN_Receive(void);\nuint32_t CAN_GetReceivedId(void);\nCAN_Id_TypeDef CAN_GetReceivedIDE(void);\nCAN_RTR_TypeDef CAN_GetReceivedRTR(void);\nuint8_t CAN_GetReceivedDLC(void);\nuint8_t CAN_GetReceivedData(uint8_t CAN_DataIndex);\nuint8_t CAN_GetReceivedFMI(void);\nuint16_t CAN_GetMessageTimeStamp(void);\nCAN_Sleep_TypeDef CAN_Sleep(void);\nCAN_WakeUp_TypeDef CAN_WakeUp(void);\nCAN_ModeStatus_TypeDef CAN_OperatingModeRequest(CAN_OperatingMode_TypeDef CAN_OperatingMode);\nCAN_ErrorCode_TypeDef CAN_GetLastErrorCode(void);\nCAN_Page_TypeDef CAN_GetSelectedPage(void);\nvoid CAN_SelectPage(CAN_Page_TypeDef CAN_Page);\nFlagStatus CAN_GetFlagStatus(CAN_FLAG_TypeDef CAN_Flag);\nvoid CAN_ClearFlag(CAN_FLAG_TypeDef CAN_Flag);\nITStatus CAN_GetITStatus(CAN_IT_TypeDef CAN_IT);\nvoid CAN_ClearITPendingBit(CAN_IT_TypeDef CAN_IT);\n/**\n  * @}\n  */\n#endif /* __STM8S_CAN_H */\n\n\n/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\n"
  },
  {
    "path": "src/firmware/tsdz2/stm8s/stm8s_clk.h",
    "content": "/**\n  ******************************************************************************\n  * @file    stm8s_clk.h\n  * @author  MCD Application Team\n  * @version V2.3.0\n  * @date    16-June-2017\n  * @brief   This file contains all functions prototype and macros for the CLK peripheral.\n   ******************************************************************************\n  * @attention\n  *\n  * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>\n  *\n  * Licensed under MCD-ST Liberty SW License Agreement V2, (the \"License\");\n  * You may not use this file except in compliance with the License.\n  * You may obtain a copy of the License at:\n  *\n  *        http://www.st.com/software_license_agreement_liberty_v2\n  *\n  * Unless required by applicable law or agreed to in writing, software \n  * distributed under the License is distributed on an \"AS IS\" BASIS, \n  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  * See the License for the specific language governing permissions and\n  * limitations under the License.\n  *\n  ******************************************************************************\n  */\n\n\n/* Define to prevent recursive inclusion -------------------------------------*/\n#ifndef __STM8S_CLK_H\n#define __STM8S_CLK_H\n\n/* Includes ------------------------------------------------------------------*/\n/* Contains the description of all STM8 hardware registers */\n#include \"stm8s.h\"\n\n/* Exported types ------------------------------------------------------------*/\n/** @addtogroup CLK_Exported_Types\n  * @{\n  */\n\n/**\n   * @brief  Switch Mode Auto, Manual.\n   */\ntypedef enum {\n  CLK_SWITCHMODE_MANUAL = (uint8_t)0x00, /*!< Enable the manual clock switching mode */\n  CLK_SWITCHMODE_AUTO   = (uint8_t)0x01  /*!< Enable the automatic clock switching mode */\n} CLK_SwitchMode_TypeDef;\n\n/**\n   * @brief  Current Clock State.\n   */\ntypedef enum {\n  CLK_CURRENTCLOCKSTATE_DISABLE = (uint8_t)0x00, /*!< Current clock disable */\n  CLK_CURRENTCLOCKSTATE_ENABLE  = (uint8_t)0x01  /*!< Current clock enable */\n} CLK_CurrentClockState_TypeDef;\n\n/**\n   * @brief   Clock security system configuration.\n   */\ntypedef enum {\n  CLK_CSSCONFIG_ENABLEWITHIT = (uint8_t)0x05, /*!< Enable CSS with detection interrupt */\n  CLK_CSSCONFIG_ENABLE    = (uint8_t)0x01, /*!< Enable CSS without detection interrupt */\n  CLK_CSSCONFIG_DISABLE      = (uint8_t)0x00  /*!< Leave CSS desactivated (to be used in CLK_Init() function) */\n} CLK_CSSConfig_TypeDef;\n\n/**\n   * @brief   CLK Clock Source.\n   */\ntypedef enum {\n  CLK_SOURCE_HSI    = (uint8_t)0xE1, /*!< Clock Source HSI. */\n  CLK_SOURCE_LSI    = (uint8_t)0xD2, /*!< Clock Source LSI. */\n  CLK_SOURCE_HSE    = (uint8_t)0xB4 /*!< Clock Source HSE. */\n} CLK_Source_TypeDef;\n\n/**\n   * @brief   CLK HSI Calibration Value.\n   */\ntypedef enum {\n  CLK_HSITRIMVALUE_0   = (uint8_t)0x00, /*!< HSI Calibration Value 0 */\n  CLK_HSITRIMVALUE_1   = (uint8_t)0x01, /*!< HSI Calibration Value 1 */\n  CLK_HSITRIMVALUE_2   = (uint8_t)0x02, /*!< HSI Calibration Value 2 */\n  CLK_HSITRIMVALUE_3   = (uint8_t)0x03, /*!< HSI Calibration Value 3 */\n  CLK_HSITRIMVALUE_4   = (uint8_t)0x04, /*!< HSI Calibration Value 4 */\n  CLK_HSITRIMVALUE_5   = (uint8_t)0x05, /*!< HSI Calibration Value 5 */\n  CLK_HSITRIMVALUE_6   = (uint8_t)0x06, /*!< HSI Calibration Value 6 */\n  CLK_HSITRIMVALUE_7   = (uint8_t)0x07  /*!< HSI Calibration Value 7 */\n} CLK_HSITrimValue_TypeDef;\n\n/**\n   * @brief    CLK  Clock Output\n   */\ntypedef enum {\n  CLK_OUTPUT_HSI      = (uint8_t)0x00, /*!< Clock Output HSI */\n  CLK_OUTPUT_LSI      = (uint8_t)0x02, /*!< Clock Output LSI */\n  CLK_OUTPUT_HSE      = (uint8_t)0x04, /*!< Clock Output HSE */\n  CLK_OUTPUT_CPU      = (uint8_t)0x08, /*!< Clock Output CPU */\n  CLK_OUTPUT_CPUDIV2  = (uint8_t)0x0A, /*!< Clock Output CPU/2 */\n  CLK_OUTPUT_CPUDIV4  = (uint8_t)0x0C, /*!< Clock Output CPU/4 */\n  CLK_OUTPUT_CPUDIV8  = (uint8_t)0x0E, /*!< Clock Output CPU/8 */\n  CLK_OUTPUT_CPUDIV16 = (uint8_t)0x10, /*!< Clock Output CPU/16 */\n  CLK_OUTPUT_CPUDIV32 = (uint8_t)0x12, /*!< Clock Output CPU/32 */\n  CLK_OUTPUT_CPUDIV64 = (uint8_t)0x14, /*!< Clock Output CPU/64 */\n  CLK_OUTPUT_HSIRC    = (uint8_t)0x16, /*!< Clock Output HSI RC */\n  CLK_OUTPUT_MASTER   = (uint8_t)0x18, /*!< Clock Output Master */\n  CLK_OUTPUT_OTHERS   = (uint8_t)0x1A  /*!< Clock Output OTHER */\n} CLK_Output_TypeDef;\n\n/**\n   * @brief    CLK Enable peripheral\n   */\n/* Elements values convention: 0xXY\n    X = choice between the peripheral registers\n        X = 0 : PCKENR1\n        X = 1 : PCKENR2\n    Y = Peripheral position in the register\n*/\ntypedef enum {\n  CLK_PERIPHERAL_I2C     = (uint8_t)0x00, /*!< Peripheral Clock Enable 1, I2C */\n  CLK_PERIPHERAL_SPI     = (uint8_t)0x01, /*!< Peripheral Clock Enable 1, SPI */\n#if defined(STM8S208) || defined(STM8S207) || defined(STM8S007) || defined(STM8AF52Ax) || defined(STM8AF62Ax)\n  CLK_PERIPHERAL_UART1   = (uint8_t)0x02, /*!< Peripheral Clock Enable 1, UART1 */\n#else\n  CLK_PERIPHERAL_UART1   = (uint8_t)0x03, /*!< Peripheral Clock Enable 1, UART1 */\n#endif\n  CLK_PERIPHERAL_UART2   = (uint8_t)0x03, /*!< Peripheral Clock Enable 1, UART2 */\n  CLK_PERIPHERAL_UART3   = (uint8_t)0x03, /*!< Peripheral Clock Enable 1, UART3 */\n  CLK_PERIPHERAL_TIMER6  = (uint8_t)0x04, /*!< Peripheral Clock Enable 1, Timer6 */\n  CLK_PERIPHERAL_TIMER4  = (uint8_t)0x04, /*!< Peripheral Clock Enable 1, Timer4 */\n  CLK_PERIPHERAL_TIMER5  = (uint8_t)0x05, /*!< Peripheral Clock Enable 1, Timer5 */\n  CLK_PERIPHERAL_TIMER2  = (uint8_t)0x05, /*!< Peripheral Clock Enable 1, Timer2 */\n  CLK_PERIPHERAL_TIMER3  = (uint8_t)0x06, /*!< Peripheral Clock Enable 1, Timer3 */\n  CLK_PERIPHERAL_TIMER1  = (uint8_t)0x07, /*!< Peripheral Clock Enable 1, Timer1 */\n  CLK_PERIPHERAL_AWU     = (uint8_t)0x12, /*!< Peripheral Clock Enable 2, AWU */\n  CLK_PERIPHERAL_ADC     = (uint8_t)0x13, /*!< Peripheral Clock Enable 2, ADC */\n  CLK_PERIPHERAL_CAN     = (uint8_t)0x17 /*!< Peripheral Clock Enable 2, CAN */\n} CLK_Peripheral_TypeDef;\n\n/**\n   * @brief   CLK Flags.\n   */\n/* Elements values convention: 0xXZZ\n    X = choice between the flags registers\n        X = 1 : ICKR\n        X = 2 : ECKR\n        X = 3 : SWCR\n    X = 4 : CSSR\n X = 5 : CCOR\n   ZZ = flag mask in the register (same as map file)\n*/\ntypedef enum {\n  CLK_FLAG_LSIRDY  = (uint16_t)0x0110, /*!< Low speed internal oscillator ready Flag */\n  CLK_FLAG_HSIRDY  = (uint16_t)0x0102, /*!< High speed internal oscillator ready Flag */\n  CLK_FLAG_HSERDY  = (uint16_t)0x0202, /*!< High speed external oscillator ready Flag */\n  CLK_FLAG_SWIF    = (uint16_t)0x0308, /*!< Clock switch interrupt Flag */\n  CLK_FLAG_SWBSY   = (uint16_t)0x0301, /*!< Switch busy Flag */\n  CLK_FLAG_CSSD    = (uint16_t)0x0408, /*!< Clock security system detection Flag */\n  CLK_FLAG_AUX     = (uint16_t)0x0402, /*!< Auxiliary oscillator connected to master clock */\n  CLK_FLAG_CCOBSY  = (uint16_t)0x0504, /*!< Configurable clock output busy */\n  CLK_FLAG_CCORDY  = (uint16_t)0x0502 /*!< Configurable clock output ready */\n}CLK_Flag_TypeDef;\n\n/**\n   * @brief  CLK interrupt configuration and Flags cleared by software.\n   */\ntypedef enum {\n  CLK_IT_CSSD = (uint8_t)0x0C, /*!< Clock security system detection Flag */\n  CLK_IT_SWIF = (uint8_t)0x1C /*!< Clock switch interrupt Flag */\n}CLK_IT_TypeDef;\n\n/**\n   * @brief   CLK Clock Divisor.\n   */\n\n/* Warning:\n   0xxxxxx = HSI divider\n   1xxxxxx = CPU divider\n   Other bits correspond to the divider's bits mapping\n*/\ntypedef enum {\n  CLK_PRESCALER_HSIDIV1   = (uint8_t)0x00, /*!< High speed internal clock prescaler: 1 */\n  CLK_PRESCALER_HSIDIV2   = (uint8_t)0x08, /*!< High speed internal clock prescaler: 2 */\n  CLK_PRESCALER_HSIDIV4   = (uint8_t)0x10, /*!< High speed internal clock prescaler: 4 */\n  CLK_PRESCALER_HSIDIV8   = (uint8_t)0x18, /*!< High speed internal clock prescaler: 8 */\n  CLK_PRESCALER_CPUDIV1   = (uint8_t)0x80, /*!< CPU clock division factors 1 */\n  CLK_PRESCALER_CPUDIV2   = (uint8_t)0x81, /*!< CPU clock division factors 2 */\n  CLK_PRESCALER_CPUDIV4   = (uint8_t)0x82, /*!< CPU clock division factors 4 */\n  CLK_PRESCALER_CPUDIV8   = (uint8_t)0x83, /*!< CPU clock division factors 8 */\n  CLK_PRESCALER_CPUDIV16  = (uint8_t)0x84, /*!< CPU clock division factors 16 */\n  CLK_PRESCALER_CPUDIV32  = (uint8_t)0x85, /*!< CPU clock division factors 32 */\n  CLK_PRESCALER_CPUDIV64  = (uint8_t)0x86, /*!< CPU clock division factors 64 */\n  CLK_PRESCALER_CPUDIV128 = (uint8_t)0x87  /*!< CPU clock division factors 128 */\n} CLK_Prescaler_TypeDef;\n\n/**\n   * @brief   SWIM Clock divider.\n   */\ntypedef enum {\n  CLK_SWIMDIVIDER_2 = (uint8_t)0x00, /*!< SWIM clock is divided by 2 */\n  CLK_SWIMDIVIDER_OTHER = (uint8_t)0x01 /*!< SWIM clock is not divided by 2 */\n}CLK_SWIMDivider_TypeDef;\n\n/**\n  * @}\n  */\n\n/* Exported constants --------------------------------------------------------*/\n\n/** @addtogroup CLK_Exported_Constants\n  * @{\n  */\n#define CLK_TIMEOUT ((uint16_t)0xFFFF) /*!< Max Timeout for the clock switch operation. */\n/**\n  * @}\n  */\n\n/* Private macros ------------------------------------------------------------*/\n/** @addtogroup CLK_Private_Macros\n  * @{\n  */\n\n/**\n  * @brief  Macros used by the assert function in order to check the different functions parameters.\n  */\n\n/**\n  * @brief  Macros used by the assert function in order to check the clock switching modes.\n  */\n#define IS_CLK_SWITCHMODE_OK(MODE) (((MODE) == CLK_SWITCHMODE_MANUAL) || ((MODE) == CLK_SWITCHMODE_AUTO))\n\n/**\n  * @brief  Macros used by the assert function in order to check the current clock state.\n  */\n#define IS_CLK_CURRENTCLOCKSTATE_OK(STATE) (((STATE) == CLK_CURRENTCLOCKSTATE_DISABLE) ||\\\n                                            ((STATE) == CLK_CURRENTCLOCKSTATE_ENABLE))\n\n/**\n  * @brief  Macros used by the assert function in order to check the CSS configuration.\n  */\n#define IS_CLK_CSSCONFIG_OK(CSSVALUE) (((CSSVALUE) == CLK_CSSCONFIG_ENABLEWITHIT) ||\\\n                                       ((CSSVALUE) == CLK_CSSCONFIG_ENABLE) ||\\\n                                       ((CSSVALUE) == CLK_CSSCONFIG_DISABLE))\n\n/**\n  * @brief  Macros used by the assert function in order to check the different clock sources.\n  */\n#define IS_CLK_SOURCE_OK(SOURCE) (((SOURCE) == CLK_SOURCE_HSI) ||\\\n                                  ((SOURCE) == CLK_SOURCE_LSI) ||\\\n                                  ((SOURCE) == CLK_SOURCE_HSE))\n\n/**\n  * @brief  Macros used by the assert function in order to check the different HSI trimming values.\n  */\n#define IS_CLK_HSITRIMVALUE_OK(TRIMVALUE) (((TRIMVALUE) == CLK_HSITRIMVALUE_0) ||\\\n    ((TRIMVALUE) == CLK_HSITRIMVALUE_1) ||\\\n    ((TRIMVALUE) == CLK_HSITRIMVALUE_2) ||\\\n    ((TRIMVALUE) == CLK_HSITRIMVALUE_3) ||\\\n    ((TRIMVALUE) == CLK_HSITRIMVALUE_4) ||\\\n    ((TRIMVALUE) == CLK_HSITRIMVALUE_5) ||\\\n    ((TRIMVALUE) == CLK_HSITRIMVALUE_6) ||\\\n    ((TRIMVALUE) == CLK_HSITRIMVALUE_7))\n\n/**\n  * @brief  Macros used by the assert function in order to check the different clocks to output.\n  */\n#define IS_CLK_OUTPUT_OK(OUTPUT) (((OUTPUT) == CLK_OUTPUT_HSI) ||\\\n                                  ((OUTPUT) == CLK_OUTPUT_HSE) ||\\\n                                  ((OUTPUT) == CLK_OUTPUT_LSI) ||\\\n                                  ((OUTPUT) == CLK_OUTPUT_CPU) ||\\\n                                  ((OUTPUT) == CLK_OUTPUT_CPUDIV2) ||\\\n                                  ((OUTPUT) == CLK_OUTPUT_CPUDIV4) ||\\\n                                  ((OUTPUT) == CLK_OUTPUT_CPUDIV8) ||\\\n                                  ((OUTPUT) == CLK_OUTPUT_CPUDIV16) ||\\\n                                  ((OUTPUT) == CLK_OUTPUT_CPUDIV32) ||\\\n                                  ((OUTPUT) == CLK_OUTPUT_CPUDIV64) ||\\\n                                  ((OUTPUT) == CLK_OUTPUT_HSIRC) ||\\\n                                  ((OUTPUT) == CLK_OUTPUT_MASTER) ||\\\n                                  ((OUTPUT) == CLK_OUTPUT_OTHERS))\n\n/**\n  * @brief  Macros used by the assert function in order to check the different peripheral's clock.\n  */\n#define IS_CLK_PERIPHERAL_OK(PERIPHERAL) (((PERIPHERAL) == CLK_PERIPHERAL_I2C) ||\\\n    ((PERIPHERAL) == CLK_PERIPHERAL_SPI) ||\\\n    ((PERIPHERAL) == CLK_PERIPHERAL_UART3) ||\\\n    ((PERIPHERAL) == CLK_PERIPHERAL_UART2) ||\\\n    ((PERIPHERAL) == CLK_PERIPHERAL_UART1) ||\\\n    ((PERIPHERAL) == CLK_PERIPHERAL_TIMER4) ||\\\n    ((PERIPHERAL) == CLK_PERIPHERAL_TIMER2) ||\\\n    ((PERIPHERAL) == CLK_PERIPHERAL_TIMER5) ||\\\n    ((PERIPHERAL) == CLK_PERIPHERAL_TIMER6) ||\\\n    ((PERIPHERAL) == CLK_PERIPHERAL_TIMER3) ||\\\n    ((PERIPHERAL) == CLK_PERIPHERAL_TIMER1) ||\\\n    ((PERIPHERAL) == CLK_PERIPHERAL_CAN) ||\\\n    ((PERIPHERAL) == CLK_PERIPHERAL_ADC) ||\\\n    ((PERIPHERAL) == CLK_PERIPHERAL_AWU))\n\n/**\n  * @brief  Macros used by the assert function in order to check the different clock flags.\n  */\n#define IS_CLK_FLAG_OK(FLAG) (((FLAG) == CLK_FLAG_LSIRDY) ||\\\n                              ((FLAG) == CLK_FLAG_HSIRDY) ||\\\n                              ((FLAG) == CLK_FLAG_HSERDY) ||\\\n                              ((FLAG) == CLK_FLAG_SWIF) ||\\\n                              ((FLAG) == CLK_FLAG_SWBSY) ||\\\n                              ((FLAG) == CLK_FLAG_CSSD) ||\\\n                              ((FLAG) == CLK_FLAG_AUX) ||\\\n                              ((FLAG) == CLK_FLAG_CCOBSY) ||\\\n                              ((FLAG) == CLK_FLAG_CCORDY))\n\n/**\n  * @brief  Macros used by the assert function in order to check the different clock IT pending bits.\n  */\n#define IS_CLK_IT_OK(IT) (((IT) == CLK_IT_CSSD) || ((IT) == CLK_IT_SWIF))\n\n/**\n  * @brief  Macros used by the assert function in order to check the different HSI prescaler values.\n  */\n#define IS_CLK_HSIPRESCALER_OK(PRESCALER) (((PRESCALER) == CLK_PRESCALER_HSIDIV1) ||\\\n    ((PRESCALER) == CLK_PRESCALER_HSIDIV2) ||\\\n    ((PRESCALER) == CLK_PRESCALER_HSIDIV4) ||\\\n    ((PRESCALER) == CLK_PRESCALER_HSIDIV8))\n\n/**\n  * @brief  Macros used by the assert function in order to check the different clock  prescaler values.\n  */\n#define IS_CLK_PRESCALER_OK(PRESCALER) (((PRESCALER) == CLK_PRESCALER_HSIDIV1) ||\\\n                                        ((PRESCALER) == CLK_PRESCALER_HSIDIV2) ||\\\n                                        ((PRESCALER) == CLK_PRESCALER_HSIDIV4) ||\\\n                                        ((PRESCALER) == CLK_PRESCALER_HSIDIV8) ||\\\n                                        ((PRESCALER) == CLK_PRESCALER_CPUDIV1) ||\\\n                                        ((PRESCALER) == CLK_PRESCALER_CPUDIV2) ||\\\n                                        ((PRESCALER) == CLK_PRESCALER_CPUDIV4) ||\\\n                                        ((PRESCALER) == CLK_PRESCALER_CPUDIV8) ||\\\n                                        ((PRESCALER) == CLK_PRESCALER_CPUDIV16) ||\\\n                                        ((PRESCALER) == CLK_PRESCALER_CPUDIV32) ||\\\n                                        ((PRESCALER) == CLK_PRESCALER_CPUDIV64) ||\\\n                                        ((PRESCALER) == CLK_PRESCALER_CPUDIV128))\n\n/**\n  * @brief  Macros used by the assert function in order to check the different SWIM dividers values.\n  */\n#define IS_CLK_SWIMDIVIDER_OK(SWIMDIVIDER) (((SWIMDIVIDER) == CLK_SWIMDIVIDER_2) || ((SWIMDIVIDER) == CLK_SWIMDIVIDER_OTHER))\n\n/**\n  * @}\n  */\n\n/** @addtogroup CLK_Exported_functions\n  * @{\n  */\nvoid CLK_DeInit(void);\nvoid CLK_HSECmd(FunctionalState NewState);\nvoid CLK_HSICmd(FunctionalState NewState);\nvoid CLK_LSICmd(FunctionalState NewState);\nvoid CLK_CCOCmd(FunctionalState NewState);\nvoid CLK_ClockSwitchCmd(FunctionalState NewState);\nvoid CLK_FastHaltWakeUpCmd(FunctionalState NewState);\nvoid CLK_SlowActiveHaltWakeUpCmd(FunctionalState NewState);\nvoid CLK_PeripheralClockConfig(CLK_Peripheral_TypeDef CLK_Peripheral, FunctionalState NewState);\nErrorStatus CLK_ClockSwitchConfig(CLK_SwitchMode_TypeDef CLK_SwitchMode, CLK_Source_TypeDef CLK_NewClock, FunctionalState ITState, CLK_CurrentClockState_TypeDef CLK_CurrentClockState);\nvoid CLK_HSIPrescalerConfig(CLK_Prescaler_TypeDef HSIPrescaler);\nvoid CLK_CCOConfig(CLK_Output_TypeDef CLK_CCO);\nvoid CLK_ITConfig(CLK_IT_TypeDef CLK_IT, FunctionalState NewState);\nvoid CLK_SYSCLKConfig(CLK_Prescaler_TypeDef CLK_Prescaler);\nvoid CLK_SWIMConfig(CLK_SWIMDivider_TypeDef CLK_SWIMDivider);\nvoid CLK_ClockSecuritySystemEnable(void);\nvoid CLK_SYSCLKEmergencyClear(void);\nvoid CLK_AdjustHSICalibrationValue(CLK_HSITrimValue_TypeDef CLK_HSICalibrationValue);\nuint32_t CLK_GetClockFreq(void);\nCLK_Source_TypeDef CLK_GetSYSCLKSource(void);\nFlagStatus CLK_GetFlagStatus(CLK_Flag_TypeDef CLK_FLAG);\nITStatus CLK_GetITStatus(CLK_IT_TypeDef CLK_IT);\nvoid CLK_ClearITPendingBit(CLK_IT_TypeDef CLK_IT);\n\n/**\n  * @}\n  */\n#endif /* __STM8S_CLK_H */\n\n\n/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\n"
  },
  {
    "path": "src/firmware/tsdz2/stm8s/stm8s_exti.h",
    "content": "/**\n  ******************************************************************************\n  * @file    stm8s_exti.h\n  * @author  MCD Application Team\n  * @version V2.3.0\n  * @date    16-June-2017\n  * @brief   This file contains all functions prototype and macros for the EXTI peripheral.\n   ******************************************************************************\n  * @attention\n  *\n  * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>\n  *\n  * Licensed under MCD-ST Liberty SW License Agreement V2, (the \"License\");\n  * You may not use this file except in compliance with the License.\n  * You may obtain a copy of the License at:\n  *\n  *        http://www.st.com/software_license_agreement_liberty_v2\n  *\n  * Unless required by applicable law or agreed to in writing, software \n  * distributed under the License is distributed on an \"AS IS\" BASIS, \n  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  * See the License for the specific language governing permissions and\n  * limitations under the License.\n  *\n  ******************************************************************************\n  */\n\n/* Define to prevent recursive inclusion -------------------------------------*/\n#ifndef __STM8S_EXTI_H\n#define __STM8S_EXTI_H\n\n/* Includes ------------------------------------------------------------------*/\n#include \"stm8s.h\"\n\n/* Exported types ------------------------------------------------------------*/\n\n/** @addtogroup EXTI_Exported_Types\n  * @{\n  */\n\n/**\n  * @brief  EXTI Sensitivity values for PORTA to PORTE\n  */\ntypedef enum {\n  EXTI_SENSITIVITY_FALL_LOW  = (uint8_t)0x00, /*!< Interrupt on Falling edge and Low level */\n  EXTI_SENSITIVITY_RISE_ONLY = (uint8_t)0x01, /*!< Interrupt on Rising edge only */\n  EXTI_SENSITIVITY_FALL_ONLY = (uint8_t)0x02, /*!< Interrupt on Falling edge only */\n  EXTI_SENSITIVITY_RISE_FALL = (uint8_t)0x03  /*!< Interrupt on Rising and Falling edges */\n} EXTI_Sensitivity_TypeDef;\n\n/**\n  * @brief  EXTI Sensitivity values for TLI\n  */\ntypedef enum {\n  EXTI_TLISENSITIVITY_FALL_ONLY = (uint8_t)0x00, /*!< Top Level Interrupt on Falling edge only */\n  EXTI_TLISENSITIVITY_RISE_ONLY = (uint8_t)0x04  /*!< Top Level Interrupt on Rising edge only */\n} EXTI_TLISensitivity_TypeDef;\n\n/**\n  * @brief  EXTI PortNum possible values\n  */\ntypedef enum {\n  EXTI_PORT_GPIOA = (uint8_t)0x00, /*!< GPIO Port A */\n  EXTI_PORT_GPIOB = (uint8_t)0x01, /*!< GPIO Port B */\n  EXTI_PORT_GPIOC = (uint8_t)0x02, /*!< GPIO Port C */\n  EXTI_PORT_GPIOD = (uint8_t)0x03, /*!< GPIO Port D */\n  EXTI_PORT_GPIOE = (uint8_t)0x04  /*!< GPIO Port E */\n} EXTI_Port_TypeDef;\n\n/**\n  * @}\n  */\n\n/* Private macros ------------------------------------------------------------*/\n\n/** @addtogroup EXTI_Private_Macros\n  * @{\n  */\n\n/**\n  * @brief  Macro used by the assert function in order to check the different sensitivity values for PORTA to PORTE.\n  */\n#define IS_EXTI_SENSITIVITY_OK(SensitivityValue) \\\n  (((SensitivityValue) == EXTI_SENSITIVITY_FALL_LOW) || \\\n   ((SensitivityValue) == EXTI_SENSITIVITY_RISE_ONLY) || \\\n   ((SensitivityValue) == EXTI_SENSITIVITY_FALL_ONLY) || \\\n   ((SensitivityValue) == EXTI_SENSITIVITY_RISE_FALL))\n\n/**\n  * @brief  Macro used by the assert function in order to check the different sensitivity values for TLI.\n  */\n#define IS_EXTI_TLISENSITIVITY_OK(SensitivityValue) \\\n  (((SensitivityValue) == EXTI_TLISENSITIVITY_FALL_ONLY) || \\\n   ((SensitivityValue) == EXTI_TLISENSITIVITY_RISE_ONLY))\n\n/**\n  * @brief  Macro used by the assert function in order to check the different Port values\n  */\n#define IS_EXTI_PORT_OK(PORT) \\\n  (((PORT) == EXTI_PORT_GPIOA) ||\\\n   ((PORT) == EXTI_PORT_GPIOB) ||\\\n   ((PORT) == EXTI_PORT_GPIOC) ||\\\n   ((PORT) == EXTI_PORT_GPIOD) ||\\\n   ((PORT) == EXTI_PORT_GPIOE))\n\n/**\n  * @brief  Macro used by the assert function in order to check the different values of the EXTI PinMask\n  */\n#define IS_EXTI_PINMASK_OK(PinMask) ((((PinMask) & (uint8_t)0x00) == (uint8_t)0x00) && ((PinMask) != (uint8_t)0x00))\n\n/**\n  * @}\n  */\n\n/* Exported functions ------------------------------------------------------- */\n\n/** @addtogroup EXTI_Exported_Functions\n  * @{\n  */\n\nvoid EXTI_DeInit(void);\nvoid EXTI_SetExtIntSensitivity(EXTI_Port_TypeDef Port, EXTI_Sensitivity_TypeDef SensitivityValue);\nvoid EXTI_SetTLISensitivity(EXTI_TLISensitivity_TypeDef SensitivityValue);\nEXTI_Sensitivity_TypeDef EXTI_GetExtIntSensitivity(EXTI_Port_TypeDef Port);\nEXTI_TLISensitivity_TypeDef EXTI_GetTLISensitivity(void);\n\n/**\n  * @}\n  */\n\n#endif /* __STM8S_EXTI_H */\n\n\n/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\n"
  },
  {
    "path": "src/firmware/tsdz2/stm8s/stm8s_flash.h",
    "content": "/**\n  ******************************************************************************\n  * @file    stm8s_flash.h\n  * @author  MCD Application Team\n  * @version V2.3.0\n  * @date    16-June-2017\n  * @brief   This file contains all functions prototype and macros for the FLASH peripheral.\n   ******************************************************************************\n  * @attention\n  *\n  * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>\n  *\n  * Licensed under MCD-ST Liberty SW License Agreement V2, (the \"License\");\n  * You may not use this file except in compliance with the License.\n  * You may obtain a copy of the License at:\n  *\n  *        http://www.st.com/software_license_agreement_liberty_v2\n  *\n  * Unless required by applicable law or agreed to in writing, software \n  * distributed under the License is distributed on an \"AS IS\" BASIS, \n  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  * See the License for the specific language governing permissions and\n  * limitations under the License.\n  *\n  ******************************************************************************\n  */\n\n/* Define to prevent recursive inclusion -------------------------------------*/\n#ifndef __STM8S_FLASH_H\n#define __STM8S_FLASH_H\n\n/* Includes ------------------------------------------------------------------*/\n#include \"stm8s.h\"\n\n/* Exported constants --------------------------------------------------------*/\n\n/** @addtogroup FLASH_Exported_Constants\n  * @{\n  */\n\n#define FLASH_PROG_START_PHYSICAL_ADDRESS ((uint32_t)0x008000) /*!< Program memory: start address */\n\n#if defined (STM8S208) || defined(STM8S207) || defined(STM8S007) || defined (STM8AF52Ax) || defined (STM8AF62Ax)\n #define FLASH_PROG_END_PHYSICAL_ADDRESS   ((uint32_t)0x027FFF) /*!< Program memory: end address */\n #define FLASH_PROG_BLOCKS_NUMBER          ((uint16_t)1024)     /*!< Program memory: total number of blocks */\n #define FLASH_DATA_START_PHYSICAL_ADDRESS ((uint32_t)0x004000) /*!< Data EEPROM memory: start address */\n #define FLASH_DATA_END_PHYSICAL_ADDRESS   ((uint32_t)0x0047FF) /*!< Data EEPROM memory: end address */\n #define FLASH_DATA_BLOCKS_NUMBER          ((uint16_t)16)       /*!< Data EEPROM memory: total number of blocks */\n #define FLASH_BLOCK_SIZE                  ((uint8_t)128)       /*!< Number of bytes in a block (common for Program and Data memories) */\n#endif /* STM8S208, STM8S207, STM8S007, STM8AF52Ax, STM8AF62Ax */\n\n#if defined(STM8S105) || defined(STM8S005) || defined(STM8AF626x)\n #define FLASH_PROG_END_PHYSICAL_ADDRESS   ((uint32_t)0xFFFF)   /*!< Program memory: end address */\n #define FLASH_PROG_BLOCKS_NUMBER          ((uint16_t)256)      /*!< Program memory: total number of blocks */\n #define FLASH_DATA_START_PHYSICAL_ADDRESS ((uint32_t)0x004000) /*!< Data EEPROM memory: start address */\n #define FLASH_DATA_END_PHYSICAL_ADDRESS   ((uint32_t)0x0043FF) /*!< Data EEPROM memory: end address */\n #define FLASH_DATA_BLOCKS_NUMBER          ((uint16_t)8)        /*!< Data EEPROM memory: total number of blocks */\n #define FLASH_BLOCK_SIZE                  ((uint8_t)128)       /*!< Number of bytes in a block (common for Program and Data memories) */\n#endif /* STM8S105 or STM8AF626x */\n\n#if defined(STM8S103) || defined(STM8S003) || defined(STM8S001) || defined(STM8S903) || defined(STM8AF622x)\n #define FLASH_PROG_END_PHYSICAL_ADDRESS   ((uint32_t)0x9FFF)   /*!< Program memory: end address */\n #define FLASH_PROG_BLOCKS_NUMBER          ((uint16_t)128)      /*!< Program memory: total number of blocks */\n #define FLASH_DATA_START_PHYSICAL_ADDRESS ((uint32_t)0x004000) /*!< Data EEPROM memory: start address */\n #define FLASH_DATA_END_PHYSICAL_ADDRESS   ((uint32_t)0x00427F) /*!< Data EEPROM memory: end address */\n #define FLASH_DATA_BLOCKS_NUMBER          ((uint16_t)10)       /*!< Data EEPROM memory: total number of blocks */\n #define FLASH_BLOCK_SIZE                  ((uint8_t)64)        /*!< Number of bytes in a block (common for Program and Data memories) */\n#endif /* STM8S103 or STM8S003 or STM8S001 or STM8S903 or STM8AF622x*/\n\n#define FLASH_RASS_KEY1 ((uint8_t)0x56) /*!< First RASS key */\n#define FLASH_RASS_KEY2 ((uint8_t)0xAE) /*!< Second RASS key */\n\n#define OPTION_BYTE_START_PHYSICAL_ADDRESS  ((uint16_t)0x4800)\n#define OPTION_BYTE_END_PHYSICAL_ADDRESS    ((uint16_t)0x487F)\n#define FLASH_OPTIONBYTE_ERROR              ((uint16_t)0x5555) /*!< Error code option byte \n                                                                   (if value read is not equal to complement value read) */\n/**\n  * @}\n  */\n\n/* Exported types ------------------------------------------------------------*/\n\n/** @addtogroup FLASH_Exported_Types\n  * @{\n  */\n\n/**\n  * @brief  FLASH Memory types\n  */\ntypedef enum {\n    FLASH_MEMTYPE_PROG      = (uint8_t)0xFD, /*!< Program memory */\n    FLASH_MEMTYPE_DATA      = (uint8_t)0xF7  /*!< Data EEPROM memory */\n} FLASH_MemType_TypeDef;\n\n/**\n  * @brief  FLASH programming modes\n  */\ntypedef enum {\n    FLASH_PROGRAMMODE_STANDARD = (uint8_t)0x00, /*!< Standard programming mode */\n    FLASH_PROGRAMMODE_FAST     = (uint8_t)0x10  /*!< Fast programming mode */\n} FLASH_ProgramMode_TypeDef;\n\n/**\n  * @brief  FLASH fixed programming time\n  */\ntypedef enum {\n    FLASH_PROGRAMTIME_STANDARD = (uint8_t)0x00, /*!< Standard programming time fixed at 1/2 tprog */\n    FLASH_PROGRAMTIME_TPROG    = (uint8_t)0x01  /*!< Programming time fixed at tprog */\n} FLASH_ProgramTime_TypeDef;\n\n/**\n  * @brief  FLASH Low Power mode select\n  */\ntypedef enum {\n    FLASH_LPMODE_POWERDOWN         = (uint8_t)0x04, /*!< HALT: Power-Down / ACTIVE-HALT: Power-Down */\n    FLASH_LPMODE_STANDBY           = (uint8_t)0x08, /*!< HALT: Standby    / ACTIVE-HALT: Standby */\n    FLASH_LPMODE_POWERDOWN_STANDBY = (uint8_t)0x00, /*!< HALT: Power-Down / ACTIVE-HALT: Standby */\n    FLASH_LPMODE_STANDBY_POWERDOWN = (uint8_t)0x0C  /*!< HALT: Standby    / ACTIVE-HALT: Power-Down */\n}\nFLASH_LPMode_TypeDef;\n\n/**\n  * @brief  FLASH status of the last operation\n  */\ntypedef enum {\n#if defined (STM8S208) || defined(STM8S207) || defined(STM8S007) || defined(STM8S105) || \\\n    defined(STM8S005) || defined (STM8AF52Ax) || defined (STM8AF62Ax) || defined(STM8AF626x)\t\t\n\t\tFLASH_STATUS_END_HIGH_VOLTAGE           = (uint8_t)0x40, /*!< End of high voltage */\n#endif /* STM8S208, STM8S207, STM8S105, STM8AF62Ax, STM8AF52Ax, STM8AF626x */\n\t\tFLASH_STATUS_SUCCESSFUL_OPERATION       = (uint8_t)0x04, /*!< End of operation flag */\n\t\tFLASH_STATUS_TIMEOUT = (uint8_t)0x02, /*!< Time out error */\n    FLASH_STATUS_WRITE_PROTECTION_ERROR     = (uint8_t)0x01 /*!< Write attempted to protected page */\n} FLASH_Status_TypeDef;\n\n/**\n  * @brief  FLASH flags definition\n * - Warning : FLAG value = mapping position register\n  */\ntypedef enum {\n#if defined (STM8S208) || defined(STM8S207) || defined(STM8S007) || defined(STM8S105) || \\\n    defined(STM8S005) || defined (STM8AF52Ax) || defined (STM8AF62Ax) || defined(STM8AF626x)\n    FLASH_FLAG_HVOFF     = (uint8_t)0x40,     /*!< End of high voltage flag */\n#endif /* STM8S208, STM8S207, STM8S105, STM8AF62Ax, STM8AF52Ax, STM8AF626x */\n    FLASH_FLAG_DUL       = (uint8_t)0x08,     /*!< Data EEPROM unlocked flag */\n    FLASH_FLAG_EOP       = (uint8_t)0x04,     /*!< End of programming (write or erase operation) flag */\n    FLASH_FLAG_PUL       = (uint8_t)0x02,     /*!< Flash Program memory unlocked flag */\n    FLASH_FLAG_WR_PG_DIS = (uint8_t)0x01      /*!< Write attempted to protected page flag */\n} FLASH_Flag_TypeDef;\n\n/**\n  * @}\n  */\n\n/* Private macros ------------------------------------------------------------*/\n\n/**\n  * @brief  Macros used by the assert function in order to check the different functions parameters.\n  * @addtogroup FLASH_Private_Macros\n  * @{\n  */\n\n/**\n  * @brief  Macro used by the assert function in order to check the different sensitivity values for the flash program Address\n  */\n\n#define IS_FLASH_PROG_ADDRESS_OK(ADDRESS) (((ADDRESS) >= FLASH_PROG_START_PHYSICAL_ADDRESS) && \\\n    ((ADDRESS) <= FLASH_PROG_END_PHYSICAL_ADDRESS))\n\n/**\n  * @brief  Macro used by the assert function in order to check the different sensitivity values for the data eeprom Address\n  */\n\n#define IS_FLASH_DATA_ADDRESS_OK(ADDRESS) (((ADDRESS) >= FLASH_DATA_START_PHYSICAL_ADDRESS) && \\\n    ((ADDRESS) <= FLASH_DATA_END_PHYSICAL_ADDRESS))\n\n/**\n  * @brief  Macro used by the assert function in order to check the different sensitivity values for the data eeprom and flash program Address\n  */\n#define IS_FLASH_ADDRESS_OK(ADDRESS)((((ADDRESS) >= FLASH_PROG_START_PHYSICAL_ADDRESS) && ((ADDRESS) <= FLASH_PROG_END_PHYSICAL_ADDRESS)) || \\\n                                     (((ADDRESS) >= FLASH_DATA_START_PHYSICAL_ADDRESS) && ((ADDRESS) <= FLASH_DATA_END_PHYSICAL_ADDRESS)))\n\n/**\n  * @brief  Macro used by the assert function in order to check the different sensitivity values for the flash program Block number\n  */\n#define IS_FLASH_PROG_BLOCK_NUMBER_OK(BLOCKNUM) ((BLOCKNUM) < FLASH_PROG_BLOCKS_NUMBER)\n\n/**\n  * @brief  Macro used by the assert function in order to check the different sensitivity values for the data eeprom Block number\n  */\n#define IS_FLASH_DATA_BLOCK_NUMBER_OK(BLOCKNUM) ((BLOCKNUM) < FLASH_DATA_BLOCKS_NUMBER)\n\n/**\n  * @brief  Macro used by the assert function in order to check the different sensitivity values for the flash memory type\n  */\n\n#define IS_MEMORY_TYPE_OK(MEMTYPE) (((MEMTYPE) == FLASH_MEMTYPE_PROG) || \\\n                                    ((MEMTYPE) == FLASH_MEMTYPE_DATA))\n\n/**\n  * @brief  Macro used by the assert function in order to check the different sensitivity values for the flash program mode\n  */\n\n#define IS_FLASH_PROGRAM_MODE_OK(MODE) (((MODE) == FLASH_PROGRAMMODE_STANDARD) || \\\n                                        ((MODE) == FLASH_PROGRAMMODE_FAST))\n\n/**\n  * @brief  Macro used by the assert function in order to check the program time mode\n  */\n\n#define IS_FLASH_PROGRAM_TIME_OK(TIME) (((TIME) == FLASH_PROGRAMTIME_STANDARD) || \\\n                                        ((TIME) == FLASH_PROGRAMTIME_TPROG))\n\n/**\n  * @brief  Macro used by the assert function in order to check the different \n  *         sensitivity values for the low power mode\n  */\n\n#define IS_FLASH_LOW_POWER_MODE_OK(LPMODE) (((LPMODE) == FLASH_LPMODE_POWERDOWN) || \\\n    ((LPMODE) == FLASH_LPMODE_STANDBY) || \\\n    ((LPMODE) == FLASH_LPMODE_POWERDOWN_STANDBY) || \\\n    ((LPMODE) == FLASH_LPMODE_STANDBY_POWERDOWN))\n\n/**\n  * @brief  Macro used by the assert function in order to check the different \n  *         sensitivity values for the option bytes Address\n  */\n#define IS_OPTION_BYTE_ADDRESS_OK(ADDRESS) (((ADDRESS) >= OPTION_BYTE_START_PHYSICAL_ADDRESS) && \\\n    ((ADDRESS) <= OPTION_BYTE_END_PHYSICAL_ADDRESS))\n\n\n/**\n  * @brief  Macro used by the assert function in order to check the different flags values\n  */\n#if defined (STM8S208) || defined(STM8S207) || defined(STM8S007) || defined(STM8S105) || \\\n    defined(STM8S005) || defined (STM8AF52Ax) || defined (STM8AF62Ax) || defined(STM8AF626x)\n #define IS_FLASH_FLAGS_OK(FLAG) (((FLAG) == FLASH_FLAG_HVOFF) || \\\n                                 ((FLAG) == FLASH_FLAG_DUL) || \\\n                                 ((FLAG) == FLASH_FLAG_EOP) || \\\n                                 ((FLAG) == FLASH_FLAG_PUL) || \\\n                                 ((FLAG) == FLASH_FLAG_WR_PG_DIS))\n#else /* STM8S103, STM8S001, STM8S903, STM8AF622x */\n #define IS_FLASH_FLAGS_OK(FLAG) (((FLAG) == FLASH_FLAG_DUL) || \\\n                                 ((FLAG) == FLASH_FLAG_EOP) || \\\n                                 ((FLAG) == FLASH_FLAG_PUL) || \\\n                                 ((FLAG) == FLASH_FLAG_WR_PG_DIS))\n#endif /* STM8S208, STM8S207, STM8S105, STM8AF62Ax, STM8AF52Ax, STM8AF626x */\n/**\n  * @}\n  */\n\n/* Exported functions ------------------------------------------------------- */\n\n/** @addtogroup FLASH_Exported_Functions\n  * @{\n  */\nvoid FLASH_Unlock(FLASH_MemType_TypeDef FLASH_MemType);\nvoid FLASH_Lock(FLASH_MemType_TypeDef FLASH_MemType);\nvoid FLASH_DeInit(void);\nvoid FLASH_ITConfig(FunctionalState NewState);\nvoid FLASH_EraseByte(uint32_t Address);\nvoid FLASH_ProgramByte(uint32_t Address, uint8_t Data);\nuint8_t FLASH_ReadByte(uint32_t Address);\nvoid FLASH_ProgramWord(uint32_t Address, uint32_t Data);\nuint16_t FLASH_ReadOptionByte(uint16_t Address);\nvoid FLASH_ProgramOptionByte(uint16_t Address, uint8_t Data);\nvoid FLASH_EraseOptionByte(uint16_t Address);\nvoid FLASH_SetLowPowerMode(FLASH_LPMode_TypeDef FLASH_LPMode);\nvoid FLASH_SetProgrammingTime(FLASH_ProgramTime_TypeDef FLASH_ProgTime);\nFLASH_LPMode_TypeDef FLASH_GetLowPowerMode(void);\nFLASH_ProgramTime_TypeDef FLASH_GetProgrammingTime(void);\nuint32_t FLASH_GetBootSize(void);\nFlagStatus FLASH_GetFlagStatus(FLASH_Flag_TypeDef FLASH_FLAG);\n\n/**\n@code\n All the functions declared below must be executed from RAM exclusively, except \n for the FLASH_WaitForLastOperation function which can be executed from Flash.\n \n Steps of the execution from RAM differs from one toolchain to another.\n for more details refer to stm8s_flash.c file.\n \n To enable execution from RAM you can either uncomment the following define \n in the stm8s.h file or define it in your toolchain compiler preprocessor\n - #define RAM_EXECUTION  (1) \n\n@endcode\n*/\nIN_RAM(void FLASH_EraseBlock(uint16_t BlockNum, FLASH_MemType_TypeDef FLASH_MemType));\nIN_RAM(void FLASH_ProgramBlock(uint16_t BlockNum, FLASH_MemType_TypeDef FLASH_MemType, \n                        FLASH_ProgramMode_TypeDef FLASH_ProgMode, uint8_t *Buffer));\nIN_RAM(FLASH_Status_TypeDef FLASH_WaitForLastOperation(FLASH_MemType_TypeDef FLASH_MemType));\n\n/**\n  * @}\n  */\n\n#endif /*__STM8S_FLASH_H */\n\n\n/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\n"
  },
  {
    "path": "src/firmware/tsdz2/stm8s/stm8s_gpio.h",
    "content": "/**\n  ******************************************************************************\n  * @file    stm8s_gpio.h\n  * @author  MCD Application Team\n  * @version V2.3.0\n  * @date    16-June-2017\n  * @brief   This file contains all functions prototype and macros for the GPIO peripheral.\n   ******************************************************************************\n  * @attention\n  *\n  * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>\n  *\n  * Licensed under MCD-ST Liberty SW License Agreement V2, (the \"License\");\n  * You may not use this file except in compliance with the License.\n  * You may obtain a copy of the License at:\n  *\n  *        http://www.st.com/software_license_agreement_liberty_v2\n  *\n  * Unless required by applicable law or agreed to in writing, software \n  * distributed under the License is distributed on an \"AS IS\" BASIS, \n  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  * See the License for the specific language governing permissions and\n  * limitations under the License.\n  *\n  ******************************************************************************\n  */\n\n/* Define to prevent recursive inclusion -------------------------------------*/\n#ifndef __STM8S_GPIO_H\n#define __STM8S_GPIO_H\n\n/* Includes ------------------------------------------------------------------*/\n#include \"stm8s.h\"\n\n/* Exported variables ------------------------------------------------------- */\n/* Exported types ------------------------------------------------------------*/\n\n/** @addtogroup GPIO_Exported_Types\n  * @{\n  */\n\n/**\n  * @brief  GPIO modes\n  *\n  * Bits definitions:\n  * - Bit 7: 0 = INPUT mode\n  *          1 = OUTPUT mode\n  *          1 = PULL-UP (input) or PUSH-PULL (output)\n  * - Bit 5: 0 = No external interrupt (input) or No slope control (output)\n  *          1 = External interrupt (input) or Slow control enabled (output)\n  * - Bit 4: 0 = Low level (output)\n  *          1 = High level (output push-pull) or HI-Z (output open-drain)\n  */\ntypedef enum\n{\n  GPIO_MODE_IN_FL_NO_IT      = (uint8_t)0x00,  /*!< Input floating, no external interrupt */\n  GPIO_MODE_IN_PU_NO_IT      = (uint8_t)0x40,  /*!< Input pull-up, no external interrupt */\n  GPIO_MODE_IN_FL_IT         = (uint8_t)0x20,  /*!< Input floating, external interrupt */\n  GPIO_MODE_IN_PU_IT         = (uint8_t)0x60,  /*!< Input pull-up, external interrupt */\n  GPIO_MODE_OUT_OD_LOW_FAST  = (uint8_t)0xA0,  /*!< Output open-drain, low level, 10MHz */\n  GPIO_MODE_OUT_PP_LOW_FAST  = (uint8_t)0xE0,  /*!< Output push-pull, low level, 10MHz */\n  GPIO_MODE_OUT_OD_LOW_SLOW  = (uint8_t)0x80,  /*!< Output open-drain, low level, 2MHz */\n  GPIO_MODE_OUT_PP_LOW_SLOW  = (uint8_t)0xC0,  /*!< Output push-pull, low level, 2MHz */\n  GPIO_MODE_OUT_OD_HIZ_FAST  = (uint8_t)0xB0,  /*!< Output open-drain, high-impedance level,10MHz */\n  GPIO_MODE_OUT_PP_HIGH_FAST = (uint8_t)0xF0,  /*!< Output push-pull, high level, 10MHz */\n  GPIO_MODE_OUT_OD_HIZ_SLOW  = (uint8_t)0x90,  /*!< Output open-drain, high-impedance level, 2MHz */\n  GPIO_MODE_OUT_PP_HIGH_SLOW = (uint8_t)0xD0   /*!< Output push-pull, high level, 2MHz */\n}GPIO_Mode_TypeDef;\n\n/**\n  * @brief  Definition of the GPIO pins. Used by the @ref GPIO_Init function in\n  * order to select the pins to be initialized.\n  */\n\ntypedef enum\n{\n  GPIO_PIN_0    = ((uint8_t)0x01),  /*!< Pin 0 selected */\n  GPIO_PIN_1    = ((uint8_t)0x02),  /*!< Pin 1 selected */\n  GPIO_PIN_2    = ((uint8_t)0x04),  /*!< Pin 2 selected */\n  GPIO_PIN_3    = ((uint8_t)0x08),   /*!< Pin 3 selected */\n  GPIO_PIN_4    = ((uint8_t)0x10),  /*!< Pin 4 selected */\n  GPIO_PIN_5    = ((uint8_t)0x20),  /*!< Pin 5 selected */\n  GPIO_PIN_6    = ((uint8_t)0x40),  /*!< Pin 6 selected */\n  GPIO_PIN_7    = ((uint8_t)0x80),  /*!< Pin 7 selected */\n  GPIO_PIN_LNIB = ((uint8_t)0x0F),  /*!< Low nibble pins selected */\n  GPIO_PIN_HNIB = ((uint8_t)0xF0),  /*!< High nibble pins selected */\n  GPIO_PIN_ALL  = ((uint8_t)0xFF)   /*!< All pins selected */\n}GPIO_Pin_TypeDef;\n\n/**\n  * @}\n  */\n\n/* Exported constants --------------------------------------------------------*/\n/* Exported macros -----------------------------------------------------------*/\n/* Private macros ------------------------------------------------------------*/\n\n/** @addtogroup GPIO_Private_Macros\n  * @{\n  */\n\n/**\n  * @brief  Macro used by the assert function to check the different functions parameters.\n  */\n\n/**\n  * @brief  Macro used by the assert function in order to check the different\n  * values of GPIOMode_TypeDef.\n  */\n#define IS_GPIO_MODE_OK(MODE) \\\n  (((MODE) == GPIO_MODE_IN_FL_NO_IT)    || \\\n   ((MODE) == GPIO_MODE_IN_PU_NO_IT)    || \\\n   ((MODE) == GPIO_MODE_IN_FL_IT)       || \\\n   ((MODE) == GPIO_MODE_IN_PU_IT)       || \\\n   ((MODE) == GPIO_MODE_OUT_OD_LOW_FAST)  || \\\n   ((MODE) == GPIO_MODE_OUT_PP_LOW_FAST)  || \\\n   ((MODE) == GPIO_MODE_OUT_OD_LOW_SLOW)  || \\\n   ((MODE) == GPIO_MODE_OUT_PP_LOW_SLOW)  || \\\n   ((MODE) == GPIO_MODE_OUT_OD_HIZ_FAST)  || \\\n   ((MODE) == GPIO_MODE_OUT_PP_HIGH_FAST)  || \\\n   ((MODE) == GPIO_MODE_OUT_OD_HIZ_SLOW)  || \\\n   ((MODE) == GPIO_MODE_OUT_PP_HIGH_SLOW))\n\n/**\n  * @brief  Macro used by the assert function in order to check the different\n  * values of GPIO_Pins.\n  */\n#define IS_GPIO_PIN_OK(PIN)  ((PIN) != (uint8_t)0x00)\n\n/**\n  * @}\n  */\n\n/* Exported functions ------------------------------------------------------- */\n/** @addtogroup GPIO_Exported_Functions\n  * @{\n  */\n\nvoid GPIO_DeInit(GPIO_TypeDef* GPIOx);\nvoid GPIO_Init(GPIO_TypeDef* GPIOx, GPIO_Pin_TypeDef GPIO_Pin, GPIO_Mode_TypeDef GPIO_Mode);\nvoid GPIO_Write(GPIO_TypeDef* GPIOx, uint8_t PortVal);\nvoid GPIO_WriteHigh(GPIO_TypeDef* GPIOx, GPIO_Pin_TypeDef PortPins);\nvoid GPIO_WriteLow(GPIO_TypeDef* GPIOx, GPIO_Pin_TypeDef PortPins);\nvoid GPIO_WriteReverse(GPIO_TypeDef* GPIOx, GPIO_Pin_TypeDef PortPins);\nuint8_t GPIO_ReadInputData(GPIO_TypeDef* GPIOx);\nuint8_t GPIO_ReadOutputData(GPIO_TypeDef* GPIOx);\nBitStatus GPIO_ReadInputPin(GPIO_TypeDef* GPIOx, GPIO_Pin_TypeDef GPIO_Pin);\nvoid GPIO_ExternalPullUpConfig(GPIO_TypeDef* GPIOx, GPIO_Pin_TypeDef GPIO_Pin, FunctionalState NewState);\n/**\n  * @}\n  */\n\n#endif /* __STM8L_GPIO_H */\n\n\n/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\n"
  },
  {
    "path": "src/firmware/tsdz2/stm8s/stm8s_i2c.h",
    "content": "/**\n  ******************************************************************************\n  * @file    stm8s_i2c.h\n  * @author  MCD Application Team\n  * @version V2.3.0\n  * @date    16-June-2017\n  * @brief  This file contains all functions prototype and macros for the I2C peripheral.\n   ******************************************************************************\n  * @attention\n  *\n  * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>\n  *\n  * Licensed under MCD-ST Liberty SW License Agreement V2, (the \"License\");\n  * You may not use this file except in compliance with the License.\n  * You may obtain a copy of the License at:\n  *\n  *        http://www.st.com/software_license_agreement_liberty_v2\n  *\n  * Unless required by applicable law or agreed to in writing, software \n  * distributed under the License is distributed on an \"AS IS\" BASIS, \n  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  * See the License for the specific language governing permissions and\n  * limitations under the License.\n  *\n  ******************************************************************************\n  */\n\n/* Define to prevent recursive inclusion -------------------------------------*/\n#ifndef __STM8S_I2C_H\n#define __STM8S_I2C_H\n\n/* Includes ------------------------------------------------------------------*/\n#include \"stm8s.h\"\n\n/* Exported types ------------------------------------------------------------*/\n\n/** @addtogroup I2C_Exported_Types\n  * @{\n  */\n\n/**\n  * @brief  I2C duty cycle (fast mode only)\n  */\ntypedef enum\n{\n  I2C_DUTYCYCLE_2    = (uint8_t)0x00,  /*!< Fast mode Tlow/THigh = 2 */\n  I2C_DUTYCYCLE_16_9 = (uint8_t)0x40   /*!< Fast mode Tlow/Thigh = 16/9 */\n} I2C_DutyCycle_TypeDef;\n\n/**\n  * @brief  I2C Acknowledgement configuration\n  */\ntypedef enum\n{\n  I2C_ACK_NONE = (uint8_t)0x00,  /*!< No acknowledge */\n  I2C_ACK_CURR = (uint8_t)0x01,  /*!< Acknowledge on the current byte */\n  I2C_ACK_NEXT = (uint8_t)0x02   /*!< Acknowledge on the next byte */\n} I2C_Ack_TypeDef;\n\n/**\n  * @brief  I2C Addressing Mode (slave mode only)\n  */\ntypedef enum\n{\n  I2C_ADDMODE_7BIT  = (uint8_t)0x00,  /*!< 7-bit slave address (10-bit address not acknowledged) */\n  I2C_ADDMODE_10BIT = (uint8_t)0x80   /*!< 10-bit slave address (7-bit address not acknowledged) */\n} I2C_AddMode_TypeDef;\n\n/**\n  * @brief  I2C Interrupt sources\n  * Warning: the values correspond to the bit position in the ITR register\n  */\ntypedef enum\n{\n    I2C_IT_ERR     = (uint8_t)0x01, \t/*!< Error Interruption */\n    I2C_IT_EVT     = (uint8_t)0x02, \t/*!< Event Interruption */\n    I2C_IT_BUF     = (uint8_t)0x04 \t/*!< Buffer Interruption */\n} I2C_IT_TypeDef;\n\n/**\n  * @brief  I2C transfer direction\n  * Warning: the values correspond to the ADD0 bit position in the OARL register\n  */\ntypedef enum\n{\n  I2C_DIRECTION_TX = (uint8_t)0x00,  /*!< Transmission direction */\n  I2C_DIRECTION_RX = (uint8_t)0x01   /*!< Reception direction */\n} I2C_Direction_TypeDef;\n\n/**\n  * @brief  I2C Flags\n  * @brief Elements values convention: 0xXXYY\n  *  X = SRx registers index\n  *      X = 1 : SR1\n  *      X = 2 : SR2\n  *      X = 3 : SR3\n  *  Y = Flag mask in the register\n  */\n\ntypedef enum\n{\n  /* SR1 register flags */\n  I2C_FLAG_TXEMPTY             = (uint16_t)0x0180,  /*!< Transmit Data Register Empty flag */\n  I2C_FLAG_RXNOTEMPTY          = (uint16_t)0x0140,  /*!< Read Data Register Not Empty flag */\n  I2C_FLAG_STOPDETECTION       = (uint16_t)0x0110,  /*!< Stop detected flag */\n  I2C_FLAG_HEADERSENT          = (uint16_t)0x0108,  /*!< 10-bit Header sent flag */\n  I2C_FLAG_TRANSFERFINISHED    = (uint16_t)0x0104,  /*!< Data Byte Transfer Finished flag */\n  I2C_FLAG_ADDRESSSENTMATCHED  = (uint16_t)0x0102,  /*!< Address Sent/Matched (master/slave) flag */\n  I2C_FLAG_STARTDETECTION      = (uint16_t)0x0101,  /*!< Start bit sent flag */\n\n  /* SR2 register flags */\n  I2C_FLAG_WAKEUPFROMHALT      = (uint16_t)0x0220,  /*!< Wake Up From Halt Flag */\n  I2C_FLAG_OVERRUNUNDERRUN     = (uint16_t)0x0208,  /*!< Overrun/Underrun flag */\n  I2C_FLAG_ACKNOWLEDGEFAILURE  = (uint16_t)0x0204,  /*!< Acknowledge Failure Flag */\n  I2C_FLAG_ARBITRATIONLOSS     = (uint16_t)0x0202,  /*!< Arbitration Loss Flag */\n  I2C_FLAG_BUSERROR            = (uint16_t)0x0201,  /*!< Misplaced Start or Stop condition */\n\n  /* SR3 register flags */\n  I2C_FLAG_GENERALCALL         = (uint16_t)0x0310,  /*!< General Call header received Flag */\n  I2C_FLAG_TRANSMITTERRECEIVER = (uint16_t)0x0304,  /*!< Transmitter Receiver Flag */\n  I2C_FLAG_BUSBUSY             = (uint16_t)0x0302,  /*!< Bus Busy Flag */\n  I2C_FLAG_MASTERSLAVE         = (uint16_t)0x0301   /*!< Master Slave Flag */\n} I2C_Flag_TypeDef;\n\n/**\n  * @brief I2C Pending bits\n  * Elements values convention: 0xXYZZ\n  *  X = SRx registers index\n  *      X = 1 : SR1\n  *      X = 2 : SR2\n  *  Y = Position of the corresponding Interrupt\n  *  ZZ = flag mask in the dedicated register(X register)\n  */\n\ntypedef enum\n{\n    /* SR1 register flags */\n    I2C_ITPENDINGBIT_TXEMPTY             = (uint16_t)0x1680, \t/*!< Transmit Data Register Empty  */\n    I2C_ITPENDINGBIT_RXNOTEMPTY          = (uint16_t)0x1640, \t/*!< Read Data Register Not Empty  */\n    I2C_ITPENDINGBIT_STOPDETECTION       = (uint16_t)0x1210, \t/*!< Stop detected  */\n    I2C_ITPENDINGBIT_HEADERSENT          = (uint16_t)0x1208, \t/*!< 10-bit Header sent */\n    I2C_ITPENDINGBIT_TRANSFERFINISHED    = (uint16_t)0x1204, \t/*!< Data Byte Transfer Finished  */\n    I2C_ITPENDINGBIT_ADDRESSSENTMATCHED  = (uint16_t)0x1202, \t/*!< Address Sent/Matched (master/slave)  */\n    I2C_ITPENDINGBIT_STARTDETECTION      = (uint16_t)0x1201, \t/*!< Start bit sent  */\n\n    /* SR2 register flags */\n    I2C_ITPENDINGBIT_WAKEUPFROMHALT      = (uint16_t)0x2220, \t/*!< Wake Up From Halt  */\n    I2C_ITPENDINGBIT_OVERRUNUNDERRUN     = (uint16_t)0x2108, \t/*!< Overrun/Underrun  */\n    I2C_ITPENDINGBIT_ACKNOWLEDGEFAILURE  = (uint16_t)0x2104, \t/*!< Acknowledge Failure  */\n    I2C_ITPENDINGBIT_ARBITRATIONLOSS     = (uint16_t)0x2102, \t/*!< Arbitration Loss  */\n    I2C_ITPENDINGBIT_BUSERROR            = (uint16_t)0x2101  \t/*!< Misplaced Start or Stop condition */\n} I2C_ITPendingBit_TypeDef;\n\n/**\n  * @brief I2C possible events\n  * Values convention: 0xXXYY\n  * XX = Event SR3 corresponding value\n  * YY = Event SR1 corresponding value\n  * @note if Event = EV3_2 the rule above does not apply\n  * YY = Event SR2 corresponding value\n  */\n\ntypedef enum\n{\n  /*========================================\n\n                       I2C Master Events (Events grouped in order of communication)\n                                                          ==========================================*/\n  /**\n    * @brief  Communication start\n    *\n    * After sending the START condition (I2C_GenerateSTART() function) the master\n    * has to wait for this event. It means that the Start condition has been correctly\n    * released on the I2C bus (the bus is free, no other devices is communicating).\n    *\n    */\n  /* --EV5 */\n  I2C_EVENT_MASTER_MODE_SELECT               = (uint16_t)0x0301,  /*!< BUSY, MSL and SB flag */\n\n  /**\n    * @brief  Address Acknowledge\n    *\n    * After checking on EV5 (start condition correctly released on the bus), the\n    * master sends the address of the slave(s) with which it will communicate\n    * (I2C_Send7bitAddress() function, it also determines the direction of the communication:\n    * Master transmitter or Receiver).\n    * Then the master has to wait that a slave acknowledges his address.\n    * If an acknowledge is sent on the bus, one of the following events will\n    * be set:\n    *\n    *  1) In case of Master Receiver (7-bit addressing):\n    *  the I2C_EVENT_MASTER_RECEIVER_MODE_SELECTED event is set.\n    *\n    *  2) In case of Master Transmitter (7-bit addressing):\n    *  the I2C_EVENT_MASTER_TRANSMITTER_MODE_SELECTED is set\n    *\n    *  3) In case of 10-Bit addressing mode, the master (just after generating the START\n    *  and checking on EV5) has to send the header of 10-bit addressing mode (I2C_SendData()\n    *  function).\n    *  Then master should wait on EV9. It means that the 10-bit addressing\n    *  header has been correctly sent on the bus.\n    *  Then master should send the second part of the 10-bit address (LSB) using\n    *  the function I2C_Send7bitAddress(). Then master should wait for event EV6.\n    *\n    */\n  /* --EV6 */\n  I2C_EVENT_MASTER_TRANSMITTER_MODE_SELECTED = (uint16_t)0x0782,  /*!< BUSY, MSL, ADDR, TXE and TRA flags */\n  I2C_EVENT_MASTER_RECEIVER_MODE_SELECTED    = (uint16_t)0x0302,  /*!< BUSY, MSL and ADDR flags */\n  /* --EV9 */\n  I2C_EVENT_MASTER_MODE_ADDRESS10            = (uint16_t)0x0308,  /*!< BUSY, MSL and ADD10 flags */\n\n  /**\n    * @brief Communication events\n    *\n    * If a communication is established (START condition generated and slave address\n    * acknowledged) then the master has to check on one of the following events for\n    * communication procedures:\n    *\n    * 1) Master Receiver mode: The master has to wait on the event EV7 then to read\n    *    the data received from the slave (I2C_ReceiveData() function).\n    *\n    * 2) Master Transmitter mode: The master has to send data (I2C_SendData()\n    *    function) then to wait on event EV8 or EV8_2.\n    *    These two events are similar:\n    *     - EV8 means that the data has been written in the data register and is\n    *       being shifted out.\n    *     - EV8_2 means that the data has been physically shifted out and output\n    *       on the bus.\n    *     In most cases, using EV8 is sufficient for the application.\n    *     Using EV8_2 leads to a slower communication but ensures more reliable test.\n    *     EV8_2 is also more suitable than EV8 for testing on the last data transmission\n    *     (before Stop condition generation).\n    *\n    *  @note In case the user software does not guarantee that this event EV7 is\n    *  managed before the current byte end of transfer, then user may check on EV7\n    *  and BTF flag at the same time (ie. (I2C_EVENT_MASTER_BYTE_RECEIVED | I2C_FLAG_BTF)).\n    *  In this case the communication may be slower.\n    *\n    */\n  /* Master RECEIVER mode -----------------------------*/\n  /* --EV7 */\n  I2C_EVENT_MASTER_BYTE_RECEIVED             = (uint16_t)0x0340,  /*!< BUSY, MSL and RXNE flags */\n\n  /* Master TRANSMITTER mode --------------------------*/\n  /* --EV8 */\n  I2C_EVENT_MASTER_BYTE_TRANSMITTING         = (uint16_t)0x0780,  /*!< TRA, BUSY, MSL, TXE flags */\n  /* --EV8_2 */\n\n  I2C_EVENT_MASTER_BYTE_TRANSMITTED          = (uint16_t)0x0784,  /*!< EV8_2: TRA, BUSY, MSL, TXE and BTF flags */\n\n\n  /*========================================\n\n                       I2C Slave Events (Events grouped in order of communication)\n                                                          ==========================================*/\n\n  /**\n    * @brief  Communication start events\n    *\n    * Wait on one of these events at the start of the communication. It means that\n    * the I2C peripheral detected a Start condition on the bus (generated by master\n    * device) followed by the peripheral address.\n    * The peripheral generates an ACK condition on the bus (if the acknowledge\n    * feature is enabled through function I2C_AcknowledgeConfig()) and the events\n    * listed above are set :\n    *\n    * 1) In normal case (only one address managed by the slave), when the address\n    *   sent by the master matches the own address of the peripheral (configured by\n    *   I2C_OwnAddress1 field) the I2C_EVENT_SLAVE_XXX_ADDRESS_MATCHED event is set\n    *   (where XXX could be TRANSMITTER or RECEIVER).\n    *\n    * 2) In case the address sent by the master is General Call (address 0x00) and \n    *   if the General Call is enabled for the peripheral (using function I2C_GeneralCallCmd()) \n    *   the following event is set I2C_EVENT_SLAVE_GENERALCALLADDRESS_MATCHED.  \n    * \n    */\n\n  /* --EV1  (all the events below are variants of EV1) */\n  /* 1) Case of One Single Address managed by the slave */\n  I2C_EVENT_SLAVE_RECEIVER_ADDRESS_MATCHED    = (uint16_t)0x0202,  /*!< BUSY and ADDR flags */\n  I2C_EVENT_SLAVE_TRANSMITTER_ADDRESS_MATCHED = (uint16_t)0x0682,  /*!< TRA, BUSY, TXE and ADDR flags */\n\n  /* 2) Case of General Call enabled for the slave */\n  I2C_EVENT_SLAVE_GENERALCALLADDRESS_MATCHED  = (uint16_t)0x1200,  /*!< EV2: GENCALL and BUSY flags */\n\n  /**\n    * @brief  Communication events\n    *\n    * Wait on one of these events when EV1 has already been checked :\n    *\n    * - Slave RECEIVER mode:\n    *     - EV2: When the application is expecting a data byte to be received.\n    *     - EV4: When the application is expecting the end of the communication:\n    *       master sends a stop condition and data transmission is stopped.\n    *\n    * - Slave Transmitter mode:\n    *    - EV3: When a byte has been transmitted by the slave and the application\n    *      is expecting the end of the byte transmission.\n    *      The two events I2C_EVENT_SLAVE_BYTE_TRANSMITTED and I2C_EVENT_SLAVE_BYTE_TRANSMITTING\n    *      are similar. The second one can optionally be used when the user software\n    *      doesn't guarantee the EV3 is managed before the current byte end of transfer.\n    *    - EV3_2: When the master sends a NACK in order to tell slave that data transmission\n    *      shall end (before sending the STOP condition).\n    *      In this case slave has to stop sending data bytes and expect a Stop\n    *      condition on the bus.\n    *\n    *  @note In case the  user software does not guarantee that the event EV2 is\n    *  managed before the current byte end of transfer, then user may check on EV2\n    *  and BTF flag at the same time (ie. (I2C_EVENT_SLAVE_BYTE_RECEIVED | I2C_FLAG_BTF)).\n    *  In this case the communication may be slower.\n    *\n    */\n  /* Slave RECEIVER mode --------------------------*/\n  /* --EV2 */\n  I2C_EVENT_SLAVE_BYTE_RECEIVED              = (uint16_t)0x0240,  /*!< BUSY and RXNE flags */\n  /* --EV4  */\n  I2C_EVENT_SLAVE_STOP_DETECTED              = (uint16_t)0x0010,  /*!< STOPF flag */\n\n  /* Slave TRANSMITTER mode -----------------------*/\n  /* --EV3 */\n  I2C_EVENT_SLAVE_BYTE_TRANSMITTED           = (uint16_t)0x0684,  /*!< TRA, BUSY, TXE and BTF flags */\n  I2C_EVENT_SLAVE_BYTE_TRANSMITTING          = (uint16_t)0x0680,  /*!< TRA, BUSY and TXE flags */\n  /* --EV3_2 */\n  I2C_EVENT_SLAVE_ACK_FAILURE                = (uint16_t)0x0004  /*!< AF flag */\n} I2C_Event_TypeDef;\n\n/**\n  * @}\n  */\n\n/* Exported constants --------------------------------------------------------*/\n/** @addtogroup I2C_Exported_Constants\n  * @{\n  */\n#define I2C_MAX_STANDARD_FREQ ((uint32_t)100000)\n#define I2C_MAX_FAST_FREQ     ((uint32_t)400000)\n#if defined(STM8S208) || defined(STM8S207) || defined(STM8S007) \n #define I2C_MAX_INPUT_FREQ     ((uint8_t)24)\n#else\n #define I2C_MAX_INPUT_FREQ     ((uint8_t)16)\n#endif\n\n/**\n  * @}\n  */\n\n/* Exported macros -----------------------------------------------------------*/\n/* Private macros ------------------------------------------------------------*/\n\n/** @addtogroup I2C_Private_Macros\n  * @{\n  */\n\n/**\n  * @brief  Macro used by the assert function to check the different functions parameters.\n  */\n\n/**\n  * @brief   Macro used by the assert function to check the different I2C duty cycles.\n  */\n#define IS_I2C_DUTYCYCLE_OK(DUTY) \\\n  (((DUTY) == I2C_DUTYCYCLE_2) || \\\n   ((DUTY) == I2C_DUTYCYCLE_16_9))\n\n/**\n  * @brief   Macro used by the assert function to check the different acknowledgement configuration\n  */\n#define IS_I2C_ACK_OK(ACK) \\\n  (((ACK) == I2C_ACK_NONE) || \\\n   ((ACK) == I2C_ACK_CURR) || \\\n   ((ACK) == I2C_ACK_NEXT))\n\n/**\n  * @brief   Macro used by the assert function to check the different I2C addressing modes.\n  */\n#define IS_I2C_ADDMODE_OK(ADDMODE) \\\n  (((ADDMODE) == I2C_ADDMODE_7BIT) || \\\n   ((ADDMODE) == I2C_ADDMODE_10BIT))\n\n/**\n  * @brief   Macro used by the assert function to check the different I2C interrupt types.\n  */\n#define IS_I2C_INTERRUPT_OK(IT) \\\n  (((IT) == I2C_IT_ERR)     || \\\n   ((IT) == I2C_IT_EVT)     || \\\n   ((IT) == I2C_IT_BUF)     || \\\n   ((IT) == (I2C_IT_ERR | I2C_IT_EVT)) || \\\n   ((IT) == (I2C_IT_ERR | I2C_IT_BUF)) || \\\n   ((IT) == (I2C_IT_EVT | I2C_IT_BUF)) || \\\n   ((IT) == (I2C_IT_EVT | I2C_IT_BUF | I2C_IT_ERR)))\n/**\n  * @brief   Macro used by the assert function to check the different I2C communcation direction.\n  */\n#define IS_I2C_DIRECTION_OK(DIR) \\\n  (((DIR) == I2C_DIRECTION_TX) || \\\n   ((DIR) == I2C_DIRECTION_RX))\n\n/**\n  * @brief   Macro used by the assert function to check the different I2C flags.\n  */\n#define IS_I2C_FLAG_OK(FLAG) \\\n  (((FLAG) == I2C_FLAG_TXEMPTY)         || \\\n   ((FLAG) == I2C_FLAG_RXNOTEMPTY)       || \\\n   ((FLAG) == I2C_FLAG_STOPDETECTION)      || \\\n   ((FLAG) == I2C_FLAG_HEADERSENT)       || \\\n   ((FLAG) == I2C_FLAG_TRANSFERFINISHED)   || \\\n   ((FLAG) == I2C_FLAG_ADDRESSSENTMATCHED)  || \\\n   ((FLAG) == I2C_FLAG_STARTDETECTION)    || \\\n   ((FLAG) == I2C_FLAG_WAKEUPFROMHALT)    || \\\n   ((FLAG) == I2C_FLAG_OVERRUNUNDERRUN)    || \\\n   ((FLAG) == I2C_FLAG_ACKNOWLEDGEFAILURE)  || \\\n   ((FLAG) == I2C_FLAG_ARBITRATIONLOSS)    || \\\n   ((FLAG) == I2C_FLAG_BUSERROR)       || \\\n   ((FLAG) == I2C_FLAG_GENERALCALL)      || \\\n   ((FLAG) == I2C_FLAG_TRANSMITTERRECEIVER) || \\\n   ((FLAG) == I2C_FLAG_BUSBUSY) || \\\n   ((FLAG) == I2C_FLAG_MASTERSLAVE))\n/**\n  * @brief   Macro used by the assert function to check the I2C flags to clear.\n  */\n\n#define IS_I2C_CLEAR_FLAG_OK(FLAG) ((((uint16_t)(FLAG) & (uint16_t)0xFD00) == 0x00) \\\n                                     && ((uint16_t)(FLAG) != 0x00))\n\n/**\n  * @brief   Macro used by the assert function to check the different I2C possible pending bits.\n  */\n#define IS_I2C_ITPENDINGBIT_OK(ITPENDINGBIT) \\\n   (((ITPENDINGBIT) == I2C_ITPENDINGBIT_TXEMPTY)   \t\t\t\t\t|| \\\n    ((ITPENDINGBIT) == I2C_ITPENDINGBIT_RXNOTEMPTY) \t\t\t\t|| \\\n    ((ITPENDINGBIT) == I2C_ITPENDINGBIT_STOPDETECTION) \t\t\t|| \\\n    ((ITPENDINGBIT) == I2C_ITPENDINGBIT_HEADERSENT) \t\t\t\t|| \\\n    ((ITPENDINGBIT) == I2C_ITPENDINGBIT_TRANSFERFINISHED) \t|| \\\n    ((ITPENDINGBIT) == I2C_ITPENDINGBIT_ADDRESSSENTMATCHED) || \\\n    ((ITPENDINGBIT) == I2C_ITPENDINGBIT_STARTDETECTION) \t\t|| \\\n    ((ITPENDINGBIT) == I2C_ITPENDINGBIT_WAKEUPFROMHALT)\t\t \t|| \\\n    ((ITPENDINGBIT) == I2C_ITPENDINGBIT_OVERRUNUNDERRUN) \t\t|| \\\n    ((ITPENDINGBIT) == I2C_ITPENDINGBIT_ACKNOWLEDGEFAILURE) || \\\n    ((ITPENDINGBIT) == I2C_ITPENDINGBIT_ARBITRATIONLOSS) \t\t|| \\\n    ((ITPENDINGBIT) == I2C_ITPENDINGBIT_BUSERROR))\n    \n/**\n  * @brief  Macro used by the assert function to check the different I2C possible\n  *   pending bits to clear by writing 0.\n  */\n#define IS_I2C_CLEAR_ITPENDINGBIT_OK(ITPENDINGBIT) \\\n   (((ITPENDINGBIT) == I2C_ITPENDINGBIT_WAKEUPFROMHALT)     || \\\n    ((ITPENDINGBIT) == I2C_ITPENDINGBIT_OVERRUNUNDERRUN)    || \\\n    ((ITPENDINGBIT) == I2C_ITPENDINGBIT_ACKNOWLEDGEFAILURE) || \\\n    ((ITPENDINGBIT) == I2C_ITPENDINGBIT_ARBITRATIONLOSS)    || \\\n    ((ITPENDINGBIT) == I2C_ITPENDINGBIT_BUSERROR))\n   \n/**\n  * @brief   Macro used by the assert function to check the different I2C possible events.\n  */\n#define IS_I2C_EVENT_OK(EVENT) (((EVENT) == I2C_EVENT_SLAVE_TRANSMITTER_ADDRESS_MATCHED) || \\\n                             ((EVENT) == I2C_EVENT_SLAVE_RECEIVER_ADDRESS_MATCHED) || \\\n                             ((EVENT) == I2C_EVENT_SLAVE_GENERALCALLADDRESS_MATCHED) || \\\n                             ((EVENT) == I2C_EVENT_SLAVE_BYTE_RECEIVED) || \\\n                             ((EVENT) == (I2C_EVENT_SLAVE_BYTE_RECEIVED | (uint16_t)I2C_FLAG_GENERALCALL)) || \\\n                             ((EVENT) == I2C_EVENT_SLAVE_BYTE_TRANSMITTED) || \\\n                             ((EVENT) == (I2C_EVENT_SLAVE_BYTE_TRANSMITTED | (uint16_t)I2C_FLAG_GENERALCALL)) || \\\n                             ((EVENT) == I2C_EVENT_SLAVE_ACK_FAILURE) || \\\n                             ((EVENT) == I2C_EVENT_SLAVE_STOP_DETECTED) || \\\n                             ((EVENT) == I2C_EVENT_MASTER_MODE_SELECT) || \\\n                             ((EVENT) == I2C_EVENT_MASTER_TRANSMITTER_MODE_SELECTED) || \\\n                             ((EVENT) == I2C_EVENT_MASTER_RECEIVER_MODE_SELECTED) || \\\n                             ((EVENT) == I2C_EVENT_MASTER_BYTE_RECEIVED) || \\\n                             ((EVENT) == I2C_EVENT_MASTER_BYTE_TRANSMITTED) || \\\n                             ((EVENT) == I2C_EVENT_MASTER_BYTE_TRANSMITTING) || \\\n                             ((EVENT) == I2C_EVENT_MASTER_MODE_ADDRESS10))\n\n/**\n  * @brief   Macro used by the assert function to check the different I2C possible own address.\n  */\n#define IS_I2C_OWN_ADDRESS_OK(ADDRESS) \\\n  ((ADDRESS) <= (uint16_t)0x03FF)\n\n/* The address must be even */\n#define IS_I2C_ADDRESS_OK(ADD) \\\n  (((ADD) & (uint8_t)0x01) == (uint8_t)0x00)\n\n/**\n  * @brief   Macro used by the assert function to check that I2C Input clock frequency must be between 1MHz and 50MHz.\n  */\n#define IS_I2C_INPUT_CLOCK_FREQ_OK(FREQ) \\\n  (((FREQ) >= (uint8_t)1) && ((FREQ) <= I2C_MAX_INPUT_FREQ))\n\n\n/**\n  * @brief   Macro used by the assert function to check that I2C Output clock frequency must be between 1Hz and 400kHz.\n  */\n#define IS_I2C_OUTPUT_CLOCK_FREQ_OK(FREQ) \\\n  (((FREQ) >= (uint8_t)1) && ((FREQ) <= I2C_MAX_FAST_FREQ))\n\n/**\n  * @}\n  */\n\n/* Exported functions ------------------------------------------------------- */\n/** @addtogroup I2C_Exported_Functions\n  * @{\n  */\n\nvoid I2C_DeInit(void);\nvoid I2C_Init(uint32_t OutputClockFrequencyHz, uint16_t OwnAddress, \n              I2C_DutyCycle_TypeDef I2C_DutyCycle, I2C_Ack_TypeDef Ack, \n              I2C_AddMode_TypeDef AddMode, uint8_t InputClockFrequencyMHz );\nvoid I2C_Cmd(FunctionalState NewState);\nvoid I2C_GeneralCallCmd(FunctionalState NewState);\nvoid I2C_GenerateSTART(FunctionalState NewState);\nvoid I2C_GenerateSTOP(FunctionalState NewState);\nvoid I2C_SoftwareResetCmd(FunctionalState NewState);\nvoid I2C_StretchClockCmd(FunctionalState NewState);\nvoid I2C_AcknowledgeConfig(I2C_Ack_TypeDef Ack);\nvoid I2C_FastModeDutyCycleConfig(I2C_DutyCycle_TypeDef I2C_DutyCycle);\nvoid I2C_ITConfig(I2C_IT_TypeDef I2C_IT, FunctionalState NewState);\nuint8_t I2C_ReceiveData(void);\nvoid I2C_Send7bitAddress(uint8_t Address, I2C_Direction_TypeDef Direction);\nvoid I2C_SendData(uint8_t Data);\n/**\n * @brief\n ****************************************************************************************\n *\n *                         I2C State Monitoring Functions\n *\n ****************************************************************************************\n * This I2C driver provides three different ways for I2C state monitoring\n *  depending on the application requirements and constraints:\n *\n *\n * 1) Basic state monitoring:\n *    Using I2C_CheckEvent() function:\n *    It compares the status registers (SR1, SR2 and SR3) content to a given event\n *    (can be the combination of one or more flags).\n *    It returns SUCCESS if the current status includes the given flags\n *    and returns ERROR if one or more flags are missing in the current status.\n *    - When to use:\n *      - This function is suitable for most applications as well as for startup\n *      activity since the events are fully described in the product reference manual\n *      (RM0016).\n *      - It is also suitable for users who need to define their own events.\n *    - Limitations:\n *      - If an error occurs (ie. error flags are set besides to the monitored flags),\n *        the I2C_CheckEvent() function may return SUCCESS despite the communication\n *        hold or corrupted real state.\n *        In this case, it is advised to use error interrupts to monitor the error\n *        events and handle them in the interrupt IRQ handler.\n *\n *        @note\n *        For error management, it is advised to use the following functions:\n *          - I2C_ITConfig() to configure and enable the error interrupts (I2C_IT_ERR).\n *          - I2C_IRQHandler() which is called when the I2C interrupts occur.\n *          - I2C_GetFlagStatus() or I2C_GetITStatus() to be called into the\n *           I2Cx_IRQHandler() function in order to determine which error occurred.\n *          - I2C_ClearFlag() or I2C_ClearITPendingBit() and/or I2C_SoftwareResetCmd()\n *            and/or I2C_GenerateStop() in order to clear the error flag and\n *            source and return to correct communication status.\n *\n *\n *  2) Advanced state monitoring:\n *     Using the function I2C_GetLastEvent() which returns the image of both SR1\n *     & SR3 status registers in a single word (uint16_t) (Status Register 3 value\n *     is shifted left by 8 bits and concatenated to Status Register 1).\n *     - When to use:\n *       - This function is suitable for the same applications above but it allows to\n *         overcome the limitations of I2C_GetFlagStatus() function (see below).\n *         The returned value could be compared to events already defined in the\n *         library (stm8s_i2c.h) or to custom values defined by user.\n *       - This function is suitable when multiple flags are monitored at the same time.\n *       - At the opposite of I2C_CheckEvent() function, this function allows user to\n *         choose when an event is accepted (when all events flags are set and no\n *         other flags are set or just when the needed flags are set like\n *         I2C_CheckEvent() function).\n *     - Limitations:\n *       - User may need to define his own events.\n *       - Same remark concerning the error management is applicable for this\n *         function if user decides to check only regular communication flags (and\n *         ignores error flags).\n *\n *\n *  3) Flag-based state monitoring:\n *     Using the function I2C_GetFlagStatus() which simply returns the status of\n *     one single flag (ie. I2C_FLAG_RXNE ...).\n *     - When to use:\n *        - This function could be used for specific applications or in debug phase.\n *        - It is suitable when only one flag checking is needed (most I2C events\n *          are monitored through multiple flags).\n *     - Limitations:\n *        - When calling this function, the Status register is accessed. Some flags are\n *          cleared when the status register is accessed. So checking the status\n *          of one Flag, may clear other ones.\n *        - Function may need to be called twice or more in order to monitor one\n *          single event.\n *\n */\n\n/**\n *\n *  1) Basic state monitoring\n *******************************************************************************\n */\nErrorStatus I2C_CheckEvent(I2C_Event_TypeDef I2C_Event);\n/**\n *\n *  2) Advanced state monitoring\n *******************************************************************************\n */\nI2C_Event_TypeDef I2C_GetLastEvent(void);\n/**\n *\n *  3) Flag-based state monitoring\n *******************************************************************************\n */\nFlagStatus I2C_GetFlagStatus(I2C_Flag_TypeDef I2C_Flag);\n/**\n *\n *******************************************************************************\n */\nvoid I2C_ClearFlag(I2C_Flag_TypeDef I2C_FLAG);\nITStatus I2C_GetITStatus(I2C_ITPendingBit_TypeDef I2C_ITPendingBit);\nvoid I2C_ClearITPendingBit(I2C_ITPendingBit_TypeDef I2C_ITPendingBit);\n\n\n/**\n  * @}\n  */\n\n#endif /* __STM8S_I2C_H */\n\n\n/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\n"
  },
  {
    "path": "src/firmware/tsdz2/stm8s/stm8s_itc.h",
    "content": "/**\n  ******************************************************************************\n  * @file    stm8s_itc.h\n  * @author  MCD Application Team\n  * @version V2.3.0\n  * @date    16-June-2017\n  * @brief   This file contains all functions prototype and macros for the ITC peripheral.\n   ******************************************************************************\n  * @attention\n  *\n  * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>\n  *\n  * Licensed under MCD-ST Liberty SW License Agreement V2, (the \"License\");\n  * You may not use this file except in compliance with the License.\n  * You may obtain a copy of the License at:\n  *\n  *        http://www.st.com/software_license_agreement_liberty_v2\n  *\n  * Unless required by applicable law or agreed to in writing, software \n  * distributed under the License is distributed on an \"AS IS\" BASIS, \n  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  * See the License for the specific language governing permissions and\n  * limitations under the License.\n  *\n  ******************************************************************************\n  */\n\n/* Define to prevent recursive inclusion -------------------------------------*/\n#ifndef __STM8S_ITC_H\n#define __STM8S_ITC_H\n\n/* Includes ------------------------------------------------------------------*/\n#include \"stm8s.h\"\n\n/* Exported types ------------------------------------------------------------*/\n\n/** @addtogroup ITC_Exported_Types\n  * @{\n  */\n\n/**\n  * @brief  ITC Interrupt Lines selection\n  */\ntypedef enum {\n  ITC_IRQ_TLI            = (uint8_t)0,   /*!< Software interrupt */\n  ITC_IRQ_AWU            = (uint8_t)1,   /*!< Auto wake up from halt interrupt */\n  ITC_IRQ_CLK            = (uint8_t)2,   /*!< Clock controller interrupt */\n  ITC_IRQ_PORTA          = (uint8_t)3,   /*!< Port A external interrupts */\n  ITC_IRQ_PORTB          = (uint8_t)4,   /*!< Port B external interrupts */\n  ITC_IRQ_PORTC          = (uint8_t)5,   /*!< Port C external interrupts */\n  ITC_IRQ_PORTD          = (uint8_t)6,   /*!< Port D external interrupts */\n  ITC_IRQ_PORTE          = (uint8_t)7,   /*!< Port E external interrupts */\n  \n#if defined(STM8S208) || defined(STM8AF52Ax)\n  ITC_IRQ_CAN_RX         = (uint8_t)8,   /*!< beCAN RX interrupt */\n  ITC_IRQ_CAN_TX         = (uint8_t)9,   /*!< beCAN TX/ER/SC interrupt */\n#endif /*STM8S208 or STM8AF52Ax */\n\n#if defined(STM8S903) || defined(STM8AF622x) \n  ITC_IRQ_PORTF          = (uint8_t)8,   /*!< Port F external interrupts */\n#endif /*STM8S903 or STM8AF622x */\n\n  ITC_IRQ_SPI            = (uint8_t)10,  /*!< SPI interrupt */\n  ITC_IRQ_TIM1_OVF       = (uint8_t)11,  /*!< TIM1 update/overflow/underflow/trigger/\n                                         break interrupt*/\n  ITC_IRQ_TIM1_CAPCOM    = (uint8_t)12,  /*!< TIM1 capture/compare interrupt */\n  \n#if defined(STM8S903) || defined(STM8AF622x)\n  ITC_IRQ_TIM5_OVFTRI    = (uint8_t)13,  /*!< TIM5 update/overflow/underflow/trigger/\n                                         interrupt */\n  ITC_IRQ_TIM5_CAPCOM    = (uint8_t)14,  /*!< TIM5 capture/compare interrupt */\n#else  \n  ITC_IRQ_TIM2_OVF       = (uint8_t)13,  /*!< TIM2 update /overflow interrupt */\n  ITC_IRQ_TIM2_CAPCOM    = (uint8_t)14,  /*!< TIM2 capture/compare interrupt */\n#endif /*STM8S903 or STM8AF622x */\n\n  ITC_IRQ_TIM3_OVF       = (uint8_t)15,  /*!< TIM3 update /overflow interrupt*/\n  ITC_IRQ_TIM3_CAPCOM    = (uint8_t)16,  /*!< TIM3 update /overflow interrupt */\n\n#if defined(STM8S208) ||defined(STM8S207) || defined (STM8S007) || defined(STM8S103) || \\\n    defined(STM8S003) || defined(STM8S001) ||defined(STM8S903) || defined (STM8AF52Ax) || defined (STM8AF62Ax) \n  ITC_IRQ_UART1_TX       = (uint8_t)17,  /*!< UART1 TX interrupt */\n  ITC_IRQ_UART1_RX       = (uint8_t)18,  /*!< UART1 RX interrupt */\n#endif /*STM8S208 or STM8S207 or STM8S007 or STM8S103 or STM8S003 or STM8S001 or STM8S903 or STM8AF52Ax or STM8AF62Ax */ \n#if defined(STM8AF622x)\n  ITC_IRQ_UART4_TX       = (uint8_t)17,  /*!< UART4 TX interrupt */\n  ITC_IRQ_UART4_RX       = (uint8_t)18,  /*!< UART4 RX interrupt */\n#endif /*STM8AF622x */\n  \n  ITC_IRQ_I2C            = (uint8_t)19,  /*!< I2C interrupt */\n  \n#if defined(STM8S105) || defined(STM8S005) || defined(STM8AF626x)\n  ITC_IRQ_UART2_TX       = (uint8_t)20,  /*!< USART2 TX interrupt */\n  ITC_IRQ_UART2_RX       = (uint8_t)21,  /*!< USART2 RX interrupt */\n#endif /*STM8S105 or STM8AF626x */\n\n#if defined(STM8S208) || defined(STM8S207) || defined(STM8S007) || defined(STM8AF52Ax) || defined(STM8AF62Ax)\n  ITC_IRQ_UART3_TX       = (uint8_t)20,  /*!< USART3 TX interrupt */\n  ITC_IRQ_UART3_RX       = (uint8_t)21,  /*!< USART3 RX interrupt */\n  ITC_IRQ_ADC2           = (uint8_t)22,  /*!< ADC2 interrupt */\n#endif /*STM8S208 or STM8S207 or STM8AF52Ax or STM8AF62Ax */\n\n#if defined(STM8S105) || defined(STM8S005) || defined(STM8S103) || defined(STM8S003) || defined(STM8S001) || defined(STM8S903) || defined(STM8AF626x) || defined(STM8AF622x)  \n  ITC_IRQ_ADC1           = (uint8_t)22,  /*!< ADC1 interrupt */\n#endif /*STM8S105 or STM8S005 or STM8S003 or STM8S103 or STM8S001 or STM8S903 or STM8AF626x or STM8AF622x */\n\n#if defined(STM8S903) || defined(STM8AF622x)\n  ITC_IRQ_TIM6_OVFTRI    = (uint8_t)23,  /*!< TIM6 update/overflow/underflow/trigger/\n                                         interrupt */\n#else\n  ITC_IRQ_TIM4_OVF       = (uint8_t)23,  /*!< TIM4 update /overflow interrupt */\n#endif /*STM8S903 or STM8AF622x */\n\n  ITC_IRQ_EEPROM_EEC     = (uint8_t)24  /*!< Flash interrupt */\n} ITC_Irq_TypeDef;\n\n/**\n  * @brief  ITC Priority Levels selection\n  */\ntypedef enum {\n  ITC_PRIORITYLEVEL_0 = (uint8_t)0x02, /*!< Software priority level 0 (cannot be written) */\n  ITC_PRIORITYLEVEL_1 = (uint8_t)0x01, /*!< Software priority level 1 */\n  ITC_PRIORITYLEVEL_2 = (uint8_t)0x00, /*!< Software priority level 2 */\n  ITC_PRIORITYLEVEL_3 = (uint8_t)0x03  /*!< Software priority level 3 */\n} ITC_PriorityLevel_TypeDef;\n\n/**\n  * @}\n  */\n\n/* Exported constants --------------------------------------------------------*/\n\n/** @addtogroup ITC_Exported_Constants\n  * @{\n  */\n#define CPU_SOFT_INT_DISABLED ((uint8_t)0x28) /*!< Mask for I1 and I0 bits in CPU_CC register */\n\n/**\n  * @}\n  */\n\n/* Private macros ------------------------------------------------------------*/\n\n/**\n  * @brief  Macros used by the assert function in order to check the different functions parameters.\n  * @addtogroup ITC_Private_Macros\n  * @{\n  */\n\n/* Used by assert function */\n#define IS_ITC_IRQ_OK(IRQ) ((IRQ) <= (uint8_t)24)\n\n/* Used by assert function */\n#define IS_ITC_PRIORITY_OK(PriorityValue) \\\n  (((PriorityValue) == ITC_PRIORITYLEVEL_0) || \\\n   ((PriorityValue) == ITC_PRIORITYLEVEL_1) || \\\n   ((PriorityValue) == ITC_PRIORITYLEVEL_2) || \\\n   ((PriorityValue) == ITC_PRIORITYLEVEL_3))\n\n/* Used by assert function */\n#define IS_ITC_INTERRUPTS_DISABLED (ITC_GetSoftIntStatus() == CPU_SOFT_INT_DISABLED)\n\n/**\n  * @}\n  */\n\n/* Exported functions ------------------------------------------------------- */\n\n/** @addtogroup ITC_Exported_Functions\n  * @{\n  */\n\nuint8_t ITC_GetCPUCC(void);\nvoid ITC_DeInit(void);\nuint8_t ITC_GetSoftIntStatus(void);\nvoid ITC_SetSoftwarePriority(ITC_Irq_TypeDef IrqNum, ITC_PriorityLevel_TypeDef PriorityValue);\nITC_PriorityLevel_TypeDef ITC_GetSoftwarePriority(ITC_Irq_TypeDef IrqNum);\n\n/**\n  * @}\n  */\n\n#endif /* __STM8S_ITC_H */\n\n\n/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\n"
  },
  {
    "path": "src/firmware/tsdz2/stm8s/stm8s_iwdg.h",
    "content": "/**\n  ******************************************************************************\n  * @file    stm8s_iwdg.h\n  * @author  MCD Application Team\n  * @version V2.3.0\n  * @date    16-June-2017\n  * @brief   This file contains all functions prototypes and macros for the IWDG peripheral.\n   ******************************************************************************\n  * @attention\n  *\n  * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>\n  *\n  * Licensed under MCD-ST Liberty SW License Agreement V2, (the \"License\");\n  * You may not use this file except in compliance with the License.\n  * You may obtain a copy of the License at:\n  *\n  *        http://www.st.com/software_license_agreement_liberty_v2\n  *\n  * Unless required by applicable law or agreed to in writing, software \n  * distributed under the License is distributed on an \"AS IS\" BASIS, \n  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  * See the License for the specific language governing permissions and\n  * limitations under the License.\n  *\n  ******************************************************************************\n  */\n\n/* Define to prevent recursive inclusion -------------------------------------*/\n#ifndef __STM8S_IWDG_H\n#define __STM8S_IWDG_H\n\n/* Includes ------------------------------------------------------------------*/\n#include \"stm8s.h\"\n\n/** @addtogroup STM8S_StdPeriph_Driver\n  * @{\n  */\n\n/** @addtogroup IWDG_Private_Define\n  * @{\n  */\n\n/**\n  * @brief  Define used to prevent watchdog reset\n  */\n#define IWDG_KEY_REFRESH    ((uint8_t)0xAA)  /*!<  This value written in the Key register prevent the watchdog reset */\n\n/**\n  * @brief  Define used to start the watchdog counter down\n  */\n#define IWDG_KEY_ENABLE     ((uint8_t)0xCC)  /*!<  This value written in the Key register start the watchdog counting down*/\n\n/**\n * @}\n */\n\n/** @addtogroup IWDG_Private_Macros\n  * @{\n  */\n\n/**\n  * @brief  Macro used by the assert function in order to check the different\n  * values of the prescaler.\n  */\n#define IS_IWDG_PRESCALER_OK(VALUE) (((VALUE) == IWDG_Prescaler_4   ) || \\\n                                     ((VALUE) == IWDG_Prescaler_8   ) || \\\n                                     ((VALUE) == IWDG_Prescaler_16  ) || \\\n                                     ((VALUE) == IWDG_Prescaler_32  ) || \\\n                                     ((VALUE) == IWDG_Prescaler_64  ) || \\\n                                     ((VALUE) == IWDG_Prescaler_128 ) || \\\n                                     ((VALUE) == IWDG_Prescaler_256))\n\n/**\n  * @brief  Macro used by the assert function in order to check the different\n  * values of the counter register.\n  */\n#define IS_IWDG_WRITEACCESS_MODE_OK(MODE) (((MODE) == IWDG_WriteAccess_Enable) || ((MODE) == IWDG_WriteAccess_Disable))\n\n/**\n  * @}\n  */\n\n/** @addtogroup IWDG_Exported_Types\n  * @{\n  */\n\n/** IWDG write  access enumeration */\ntypedef enum\n{\n  IWDG_WriteAccess_Enable  = (uint8_t)0x55, /*!< Code 0x55 in Key register, allow write access to Prescaler and Reload registers */\n  IWDG_WriteAccess_Disable = (uint8_t)0x00  /*!< Code 0x00 in Key register, not allow write access to Prescaler and Reload registers */\n} IWDG_WriteAccess_TypeDef;\n\n/** IWDG prescaler enumaration */\ntypedef enum\n{\n  IWDG_Prescaler_4   = (uint8_t)0x00, /*!< Used to set prescaler register to 4 */\n  IWDG_Prescaler_8   = (uint8_t)0x01, /*!< Used to set prescaler register to 8 */\n  IWDG_Prescaler_16  = (uint8_t)0x02, /*!< Used to set prescaler register to 16 */\n  IWDG_Prescaler_32  = (uint8_t)0x03, /*!< Used to set prescaler register to 32 */\n  IWDG_Prescaler_64  = (uint8_t)0x04, /*!< Used to set prescaler register to 64 */\n  IWDG_Prescaler_128 = (uint8_t)0x05, /*!< Used to set prescaler register to 128 */\n  IWDG_Prescaler_256 = (uint8_t)0x06  /*!< Used to set prescaler register to 256 */\n} IWDG_Prescaler_TypeDef;\n\n/**\n  * @}\n  */\n\n/** @addtogroup IWDG_Exported_Functions\n  * @{\n  */\n\nvoid IWDG_WriteAccessCmd(IWDG_WriteAccess_TypeDef IWDG_WriteAccess);\nvoid IWDG_SetPrescaler(IWDG_Prescaler_TypeDef IWDG_Prescaler);\nvoid IWDG_SetReload(uint8_t IWDG_Reload);\nvoid IWDG_ReloadCounter(void);\nvoid IWDG_Enable(void);\n\n/**\n  * @}\n  */\n\n#endif /* __STM8S_IWDG_H */\n\n/**\n  * @}\n  */\n\n\n/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\n"
  },
  {
    "path": "src/firmware/tsdz2/stm8s/stm8s_rst.h",
    "content": "/**\n  ******************************************************************************\n  * @file    stm8s_rst.h\n  * @author  MCD Application Team\n  * @version V2.3.0\n  * @date    16-June-2017\n  * @brief   This file contains all functions prototype and macros for the RST peripheral.\n   ******************************************************************************\n  * @attention\n  *\n  * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>\n  *\n  * Licensed under MCD-ST Liberty SW License Agreement V2, (the \"License\");\n  * You may not use this file except in compliance with the License.\n  * You may obtain a copy of the License at:\n  *\n  *        http://www.st.com/software_license_agreement_liberty_v2\n  *\n  * Unless required by applicable law or agreed to in writing, software \n  * distributed under the License is distributed on an \"AS IS\" BASIS, \n  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  * See the License for the specific language governing permissions and\n  * limitations under the License.\n  *\n  ******************************************************************************\n  */\n/* Define to prevent recursive inclusion -------------------------------------*/\n#ifndef __STM8S_RST_H\n#define __STM8S_RST_H\n\n/* Includes ------------------------------------------------------------------*/\n#include \"stm8s.h\"\n\n/** @addtogroup STM8S_StdPeriph_Driver\n  * @{\n  */\n\n/** @addtogroup RST_Exported_Types\n  * @{\n  */\ntypedef enum {\n  RST_FLAG_EMCF    = (uint8_t)0x10, /*!< EMC reset flag */\n  RST_FLAG_SWIMF   = (uint8_t)0x08, /*!< SWIM reset flag */\n  RST_FLAG_ILLOPF  = (uint8_t)0x04, /*!< Illigal opcode reset flag */\n  RST_FLAG_IWDGF   = (uint8_t)0x02, /*!< Independent watchdog reset flag */\n  RST_FLAG_WWDGF   = (uint8_t)0x01  /*!< Window watchdog reset flag */\n}RST_Flag_TypeDef;\n\n/**\n  * @}\n  */\n\n/* Exported constants --------------------------------------------------------*/\n/* Exported macros -----------------------------------------------------------*/\n\n/** @addtogroup RST_Private_Macros\n  * @{\n  */\n\n/**\n  * @brief  Macro used by the assert function to check the different functions parameters.\n  */\n/**\n  * @brief  Macro used by the assert function to check the different RST flags.\n  */\n#define IS_RST_FLAG_OK(FLAG) (((FLAG) == RST_FLAG_EMCF) || \\\n                              ((FLAG) == RST_FLAG_SWIMF)  ||\\\n                              ((FLAG) == RST_FLAG_ILLOPF) ||\\\n                              ((FLAG) == RST_FLAG_IWDGF)  ||\\\n                              ((FLAG) == RST_FLAG_WWDGF))\n\n/**\n  * @}\n  */\n\n/** @addtogroup RST_Exported_functions\n  * @{\n  */\nFlagStatus RST_GetFlagStatus(RST_Flag_TypeDef RST_Flag);\nvoid RST_ClearFlag(RST_Flag_TypeDef RST_Flag);\n\n/**\n  * @}\n  */\n\n#endif /* __STM8S_RST_H */\n\n/**\n  * @}\n  */\n\n/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\n"
  },
  {
    "path": "src/firmware/tsdz2/stm8s/stm8s_spi.h",
    "content": "/**\n  ******************************************************************************\n  * @file    stm8s_spi.h\n  * @author  MCD Application Team\n  * @version V2.3.0\n  * @date    16-June-2017\n  * @brief   This file contains all functions prototype and macros for the SPI peripheral.\n   ******************************************************************************\n  * @attention\n  *\n  * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>\n  *\n  * Licensed under MCD-ST Liberty SW License Agreement V2, (the \"License\");\n  * You may not use this file except in compliance with the License.\n  * You may obtain a copy of the License at:\n  *\n  *        http://www.st.com/software_license_agreement_liberty_v2\n  *\n  * Unless required by applicable law or agreed to in writing, software \n  * distributed under the License is distributed on an \"AS IS\" BASIS, \n  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  * See the License for the specific language governing permissions and\n  * limitations under the License.\n  *\n  ******************************************************************************\n  */\n\n/* Define to prevent recursive inclusion -------------------------------------*/\n#ifndef __STM8S_SPI_H\n#define __STM8S_SPI_H\n\n/* Includes ------------------------------------------------------------------*/\n#include \"stm8s.h\"\n\n/** @addtogroup STM8S_StdPeriph_Driver\n  * @{\n  */\n\n/** @addtogroup SPI_Exported_Types\n  * @{\n  */\n\n/**\n  * @brief  SPI data direction mode\n  * Warning: element values correspond to BDM, BDOE, RXONLY bits position\n  */\ntypedef enum {\n  SPI_DATADIRECTION_2LINES_FULLDUPLEX = (uint8_t)0x00, /*!< 2-line uni-directional data mode enable */\n  SPI_DATADIRECTION_2LINES_RXONLY     = (uint8_t)0x04, /*!< Receiver only in 2 line uni-directional data mode */\n  SPI_DATADIRECTION_1LINE_RX          = (uint8_t)0x80, /*!< Receiver only in 1 line bi-directional data mode */\n  SPI_DATADIRECTION_1LINE_TX          = (uint8_t)0xC0  /*!< Transmit only in 1 line bi-directional data mode */\n} SPI_DataDirection_TypeDef;\n\n/**\n  * @brief  SPI Slave Select management\n  * Warning: element values correspond to LSBFIRST bit position\n  */\ntypedef enum\n{\n  SPI_NSS_SOFT  = (uint8_t)0x02, /*!< Software slave management disabled */\n  SPI_NSS_HARD  = (uint8_t)0x00  /*!< Software slave management enabled */\n} SPI_NSS_TypeDef;\n\n\n/**\n  * @brief  SPI direction transmit/receive\n  */\n\ntypedef enum {\n  SPI_DIRECTION_RX = (uint8_t)0x00, /*!< Selects Rx receive direction in bi-directional mode */\n  SPI_DIRECTION_TX = (uint8_t)0x01  /*!< Selects Tx transmission direction in bi-directional mode */\n} SPI_Direction_TypeDef;\n\n/**\n  * @brief  SPI master/slave mode\n  * Warning: element values correspond to MSTR bit position\n  */\ntypedef enum {\n  SPI_MODE_MASTER = (uint8_t)0x04, /*!< SPI Master configuration */\n  SPI_MODE_SLAVE  = (uint8_t)0x00  /*!< SPI Slave configuration */\n} SPI_Mode_TypeDef;\n\n/**\n  * @brief  SPI BaudRate Prescaler\n  * Warning: element values correspond to BR bits position\n  */\ntypedef enum {\n  SPI_BAUDRATEPRESCALER_2   = (uint8_t)0x00, /*!< SPI frequency = frequency(CPU)/2 */\n  SPI_BAUDRATEPRESCALER_4   = (uint8_t)0x08, /*!< SPI frequency = frequency(CPU)/4 */\n  SPI_BAUDRATEPRESCALER_8   = (uint8_t)0x10, /*!< SPI frequency = frequency(CPU)/8 */\n  SPI_BAUDRATEPRESCALER_16  = (uint8_t)0x18, /*!< SPI frequency = frequency(CPU)/16 */\n  SPI_BAUDRATEPRESCALER_32  = (uint8_t)0x20, /*!< SPI frequency = frequency(CPU)/32 */\n  SPI_BAUDRATEPRESCALER_64  = (uint8_t)0x28, /*!< SPI frequency = frequency(CPU)/64 */\n  SPI_BAUDRATEPRESCALER_128 = (uint8_t)0x30, /*!< SPI frequency = frequency(CPU)/128 */\n  SPI_BAUDRATEPRESCALER_256 = (uint8_t)0x38  /*!< SPI frequency = frequency(CPU)/256 */\n} SPI_BaudRatePrescaler_TypeDef;\n\n/**\n  * @brief  SPI Clock Polarity\n  * Warning: element values correspond to CPOL bit position\n  */\ntypedef enum {\n  SPI_CLOCKPOLARITY_LOW  = (uint8_t)0x00, /*!< Clock to 0 when idle */\n  SPI_CLOCKPOLARITY_HIGH = (uint8_t)0x02  /*!< Clock to 1 when idle */\n} SPI_ClockPolarity_TypeDef;\n\n/**\n  * @brief  SPI Clock Phase\n  * Warning: element values correspond to CPHA bit position\n  */\ntypedef enum {\n  SPI_CLOCKPHASE_1EDGE = (uint8_t)0x00, /*!< The first clock transition is the first data capture edge */\n  SPI_CLOCKPHASE_2EDGE = (uint8_t)0x01  /*!< The second clock transition is the first data capture edge */\n} SPI_ClockPhase_TypeDef;\n\n/**\n  * @brief  SPI Frame Format: MSB or LSB transmitted first\n  * Warning: element values correspond to LSBFIRST bit position\n  */\ntypedef enum {\n  SPI_FIRSTBIT_MSB = (uint8_t)0x00, /*!< MSB bit will be transmitted first */\n  SPI_FIRSTBIT_LSB = (uint8_t)0x80  /*!< LSB bit will be transmitted first */\n} SPI_FirstBit_TypeDef;\n\n/**\n  * @brief  SPI CRC Transmit/Receive\n  */\ntypedef enum {\n  SPI_CRC_RX = (uint8_t)0x00, /*!< Select Tx CRC register */\n  SPI_CRC_TX = (uint8_t)0x01  /*!< Select Rx CRC register */\n} SPI_CRC_TypeDef;\n\n/**\n  * @brief  SPI flags definition - Warning : FLAG value = mapping position register\n  */\ntypedef enum {\n  SPI_FLAG_BSY    = (uint8_t)0x80, /*!< Busy flag */\n  SPI_FLAG_OVR    = (uint8_t)0x40, /*!< Overrun flag */\n  SPI_FLAG_MODF   = (uint8_t)0x20, /*!< Mode fault */\n  SPI_FLAG_CRCERR = (uint8_t)0x10, /*!< CRC error flag */\n  SPI_FLAG_WKUP   = (uint8_t)0x08, /*!< Wake-up flag */\n  SPI_FLAG_TXE    = (uint8_t)0x02, /*!< Transmit buffer empty */\n  SPI_FLAG_RXNE   = (uint8_t)0x01  /*!< Receive buffer empty */\n} SPI_Flag_TypeDef;\n\n/**\n  * @brief  SPI_IT possible values\n  * Elements values convention: 0xYX\n  *   X: Position of the corresponding Interrupt\n  *   Y: ITPENDINGBIT position\n  */\ntypedef enum\n{\n  SPI_IT_WKUP   = (uint8_t)0x34,  /*!< Wake-up interrupt*/\n  SPI_IT_OVR   = (uint8_t)0x65,  /*!< Overrun interrupt*/\n  SPI_IT_MODF   = (uint8_t)0x55,  /*!< Mode fault interrupt*/\n  SPI_IT_CRCERR = (uint8_t)0x45,  /*!< CRC error interrupt*/\n  SPI_IT_TXE    = (uint8_t)0x17,  /*!< Transmit buffer empty interrupt*/\n  SPI_IT_RXNE   = (uint8_t)0x06,   /*!< Receive buffer not empty interrupt*/\n  SPI_IT_ERR    = (uint8_t)0x05   /*!< Error interrupt*/\n} SPI_IT_TypeDef;\n\n/**\n  * @}\n  */\n\n/* Private define ------------------------------------------------------------*/\n\n/** @addtogroup SPI_Private_Macros\n  * @brief  Macros used by the assert_param function to check the different functions parameters.\n  * @{\n  */\n\n/**\n  * @brief  Macro used by the assert_param function in order to check the data direction mode values\n  */\n#define IS_SPI_DATA_DIRECTION_OK(MODE) (((MODE) == SPI_DATADIRECTION_2LINES_FULLDUPLEX) || \\\n                                        ((MODE) == SPI_DATADIRECTION_2LINES_RXONLY) || \\\n                                        ((MODE) == SPI_DATADIRECTION_1LINE_RX) || \\\n                                        ((MODE) == SPI_DATADIRECTION_1LINE_TX))\n\n/**\n  * @brief  Macro used by the assert_param function in order to check the mode \n  *         half duplex data direction values\n  */\n#define IS_SPI_DIRECTION_OK(DIRECTION) (((DIRECTION) == SPI_DIRECTION_RX) || \\\n                                        ((DIRECTION) == SPI_DIRECTION_TX))\n\n/**\n  * @brief  Macro used by the assert_param function in order to check the NSS \n  *         management values\n  */\n#define IS_SPI_SLAVEMANAGEMENT_OK(NSS) (((NSS) == SPI_NSS_SOFT) || \\\n                                        ((NSS) == SPI_NSS_HARD))\n\n\n/**\n  * @brief  Macro used by the assert_param function in order to check the different\n  *         sensitivity values for the CRC polynomial\n  */\n#define IS_SPI_CRC_POLYNOMIAL_OK(POLYNOMIAL) ((POLYNOMIAL) > (uint8_t)0x00)\n\n/**\n  * @brief  Macro used by the assert_param function in order to check the SPI Mode values\n  */\n#define IS_SPI_MODE_OK(MODE) (((MODE) == SPI_MODE_MASTER) || \\\n                              ((MODE) == SPI_MODE_SLAVE))\n\n/**\n  * @brief  Macro used by the assert_param function in order to check the baudrate values\n  */\n#define IS_SPI_BAUDRATE_PRESCALER_OK(PRESCALER) (((PRESCALER) == SPI_BAUDRATEPRESCALER_2) || \\\n    ((PRESCALER) == SPI_BAUDRATEPRESCALER_4) || \\\n    ((PRESCALER) == SPI_BAUDRATEPRESCALER_8) || \\\n    ((PRESCALER) == SPI_BAUDRATEPRESCALER_16) || \\\n    ((PRESCALER) == SPI_BAUDRATEPRESCALER_32) || \\\n    ((PRESCALER) == SPI_BAUDRATEPRESCALER_64) || \\\n    ((PRESCALER) == SPI_BAUDRATEPRESCALER_128) || \\\n    ((PRESCALER) == SPI_BAUDRATEPRESCALER_256))\n\n/**\n  * @brief  Macro used by the assert_param function in order to check the polarity values\n  */\n#define IS_SPI_POLARITY_OK(CLKPOL) (((CLKPOL) == SPI_CLOCKPOLARITY_LOW) || \\\n                                    ((CLKPOL) == SPI_CLOCKPOLARITY_HIGH))\n\n/**\n  * @brief  Macro used by the assert_param function in order to check the phase values\n  */\n#define IS_SPI_PHASE_OK(CLKPHA) (((CLKPHA) == SPI_CLOCKPHASE_1EDGE) || \\\n                                 ((CLKPHA) == SPI_CLOCKPHASE_2EDGE))\n\n/**\n  * @brief  Macro used by the assert_param function in order to check the first \n  *         bit to be transmited values\n  */\n#define IS_SPI_FIRSTBIT_OK(BIT) (((BIT) == SPI_FIRSTBIT_MSB) || \\\n                                 ((BIT) == SPI_FIRSTBIT_LSB))\n\n/**\n  * @brief  Macro used by the assert_param function in order to check the CRC \n  *         Transmit/Receive\n  */\n#define IS_SPI_CRC_OK(CRC) (((CRC) == SPI_CRC_TX) || \\\n                            ((CRC) == SPI_CRC_RX))\n\n/**\n  * @brief  Macro used by the assert_param function in order to check the \n  *         different flags values\n  */\n#define IS_SPI_FLAGS_OK(FLAG) (((FLAG) == SPI_FLAG_OVR) || \\\n                               ((FLAG) == SPI_FLAG_MODF) || \\\n                               ((FLAG) == SPI_FLAG_CRCERR) || \\\n                               ((FLAG) == SPI_FLAG_WKUP) || \\\n                               ((FLAG) == SPI_FLAG_TXE) || \\\n                               ((FLAG) == SPI_FLAG_RXNE) || \\\n                               ((FLAG) == SPI_FLAG_BSY))\n\n/**\n  * @brief  Macro used by the assert_param function in order to check the \n  *         different sensitivity values for the flag that can be cleared \n  *         by writing 0\n  */\n#define IS_SPI_CLEAR_FLAGS_OK(FLAG) (((FLAG) == SPI_FLAG_CRCERR) || \\\n                                     ((FLAG) == SPI_FLAG_WKUP))\n\n/**\n  * @brief  Macro used by the assert_param function in order to check the \n  *        different sensitivity values for the Interrupts\n  */\n#define IS_SPI_CONFIG_IT_OK(Interrupt) (((Interrupt) == SPI_IT_TXE)  || \\\n                                        ((Interrupt) == SPI_IT_RXNE)  || \\\n                                        ((Interrupt) == SPI_IT_ERR) || \\\n                                        ((Interrupt) == SPI_IT_WKUP))\n\n/**\n  * @brief  Macro used by the assert_param function in order to check the \n  *         different sensitivity values for the pending bit\n  */\n#define IS_SPI_GET_IT_OK(ITPendingBit) (((ITPendingBit) == SPI_IT_OVR)  || \\\n                                        ((ITPendingBit) == SPI_IT_MODF) || \\\n                                        ((ITPendingBit) == SPI_IT_CRCERR) || \\\n                                        ((ITPendingBit) == SPI_IT_WKUP) || \\\n                                        ((ITPendingBit) == SPI_IT_TXE)  || \\\n                                        ((ITPendingBit) == SPI_IT_RXNE))\n\n/**\n  * @brief  Macro used by the assert_param function in order to check the \n  *         different sensitivity values for the pending bit that can be cleared\n  *         by writing 0\n  */\n#define IS_SPI_CLEAR_IT_OK(ITPendingBit) (((ITPendingBit) == SPI_IT_CRCERR) || \\\n    ((ITPendingBit) == SPI_IT_WKUP))\n\n/**\n  * @}\n  */\n\n/** @addtogroup SPI_Exported_Functions\n  * @{\n  */\nvoid SPI_DeInit(void);\nvoid SPI_Init(SPI_FirstBit_TypeDef FirstBit, \n              SPI_BaudRatePrescaler_TypeDef BaudRatePrescaler, \n              SPI_Mode_TypeDef Mode, SPI_ClockPolarity_TypeDef ClockPolarity, \n              SPI_ClockPhase_TypeDef ClockPhase, \n              SPI_DataDirection_TypeDef Data_Direction, \n              SPI_NSS_TypeDef Slave_Management, uint8_t CRCPolynomial);\nvoid SPI_Cmd(FunctionalState NewState);\nvoid SPI_ITConfig(SPI_IT_TypeDef SPI_IT, FunctionalState NewState);\nvoid SPI_SendData(uint8_t Data);\nuint8_t SPI_ReceiveData(void);\nvoid SPI_NSSInternalSoftwareCmd(FunctionalState NewState);\nvoid SPI_TransmitCRC(void);\nvoid SPI_CalculateCRCCmd(FunctionalState NewState);\nuint8_t SPI_GetCRC(SPI_CRC_TypeDef SPI_CRC);\nvoid SPI_ResetCRC(void);\nuint8_t SPI_GetCRCPolynomial(void);\nvoid SPI_BiDirectionalLineConfig(SPI_Direction_TypeDef SPI_Direction);\nFlagStatus SPI_GetFlagStatus(SPI_Flag_TypeDef SPI_FLAG);\nvoid SPI_ClearFlag(SPI_Flag_TypeDef SPI_FLAG);\nITStatus SPI_GetITStatus(SPI_IT_TypeDef SPI_IT);\nvoid SPI_ClearITPendingBit(SPI_IT_TypeDef SPI_IT);\n\n/**\n  * @}\n  */\n\n#endif /* __STM8S_SPI_H */\n\n/**\n  * @}\n  */\n  \n\n/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\n"
  },
  {
    "path": "src/firmware/tsdz2/stm8s/stm8s_tim1.h",
    "content": "/**\n  ******************************************************************************\n  * @file    stm8s_tim1.h\n  * @author  MCD Application Team\n  * @version V2.3.0\n  * @date    16-June-2017\n  * @brief   This file contains all functions prototype and macros for the TIM1 peripheral.\n   ******************************************************************************\n  * @attention\n  *\n  * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>\n  *\n  * Licensed under MCD-ST Liberty SW License Agreement V2, (the \"License\");\n  * You may not use this file except in compliance with the License.\n  * You may obtain a copy of the License at:\n  *\n  *        http://www.st.com/software_license_agreement_liberty_v2\n  *\n  * Unless required by applicable law or agreed to in writing, software \n  * distributed under the License is distributed on an \"AS IS\" BASIS, \n  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  * See the License for the specific language governing permissions and\n  * limitations under the License.\n  *\n  ******************************************************************************\n  */\n\n/* Define to prevent recursive inclusion -------------------------------------*/\n#ifndef __STM8S_TIM1_H\n#define __STM8S_TIM1_H\n\n/* Includes ------------------------------------------------------------------*/\n#include \"stm8s.h\"\n\n/** @addtogroup STM8S_StdPeriph_Driver\n  * @{\n  */\n  \n/** @addtogroup TIM1_Exported_Types\n * @{\n */\n\n/** TIM1 Output Compare and PWM modes */\n\ntypedef enum\n{\n  TIM1_OCMODE_TIMING     = ((uint8_t)0x00),\n  TIM1_OCMODE_ACTIVE     = ((uint8_t)0x10),\n  TIM1_OCMODE_INACTIVE   = ((uint8_t)0x20),\n  TIM1_OCMODE_TOGGLE     = ((uint8_t)0x30),\n  TIM1_OCMODE_PWM1       = ((uint8_t)0x60),\n  TIM1_OCMODE_PWM2       = ((uint8_t)0x70)\n}TIM1_OCMode_TypeDef;\n\n#define IS_TIM1_OC_MODE_OK(MODE) (((MODE) ==  TIM1_OCMODE_TIMING) || \\\n                                  ((MODE) == TIM1_OCMODE_ACTIVE) || \\\n                                  ((MODE) == TIM1_OCMODE_INACTIVE) || \\\n                                  ((MODE) == TIM1_OCMODE_TOGGLE)|| \\\n                                  ((MODE) == TIM1_OCMODE_PWM1) || \\\n                                  ((MODE) == TIM1_OCMODE_PWM2))\n\n#define IS_TIM1_OCM_OK(MODE)(((MODE) ==  TIM1_OCMODE_TIMING) || \\\n                             ((MODE) == TIM1_OCMODE_ACTIVE) || \\\n                             ((MODE) == TIM1_OCMODE_INACTIVE) || \\\n                             ((MODE) == TIM1_OCMODE_TOGGLE)|| \\\n                             ((MODE) == TIM1_OCMODE_PWM1) || \\\n                             ((MODE) == TIM1_OCMODE_PWM2) || \\\n                             ((MODE) == (uint8_t)TIM1_FORCEDACTION_ACTIVE) || \\\n                             ((MODE) == (uint8_t)TIM1_FORCEDACTION_INACTIVE))\n\n/** TIM1 One Pulse Mode */\ntypedef enum\n{\n  TIM1_OPMODE_SINGLE                 = ((uint8_t)0x01),\n  TIM1_OPMODE_REPETITIVE             = ((uint8_t)0x00)\n}TIM1_OPMode_TypeDef;\n\n#define IS_TIM1_OPM_MODE_OK(MODE) (((MODE) == TIM1_OPMODE_SINGLE) || \\\n                                   ((MODE) == TIM1_OPMODE_REPETITIVE))\n\n/** TIM1 Channel */\n\ntypedef enum\n{\n  TIM1_CHANNEL_1                     = ((uint8_t)0x00),\n  TIM1_CHANNEL_2                     = ((uint8_t)0x01),\n  TIM1_CHANNEL_3                     = ((uint8_t)0x02),\n  TIM1_CHANNEL_4                     = ((uint8_t)0x03)\n}TIM1_Channel_TypeDef;\n\n\n#define IS_TIM1_CHANNEL_OK(CHANNEL) (((CHANNEL) == TIM1_CHANNEL_1) || \\\n                                     ((CHANNEL) == TIM1_CHANNEL_2) || \\\n                                     ((CHANNEL) == TIM1_CHANNEL_3) || \\\n                                     ((CHANNEL) == TIM1_CHANNEL_4))\n\n#define IS_TIM1_PWMI_CHANNEL_OK(CHANNEL) (((CHANNEL) == TIM1_CHANNEL_1) || \\\n    ((CHANNEL) == TIM1_CHANNEL_2))\n\n#define IS_TIM1_COMPLEMENTARY_CHANNEL_OK(CHANNEL) (((CHANNEL) == TIM1_CHANNEL_1) || \\\n    ((CHANNEL) == TIM1_CHANNEL_2) || \\\n    ((CHANNEL) == TIM1_CHANNEL_3))\n\n\n/** TIM1 Counter Mode */\ntypedef enum\n{\n  TIM1_COUNTERMODE_UP                = ((uint8_t)0x00),\n  TIM1_COUNTERMODE_DOWN              = ((uint8_t)0x10),\n  TIM1_COUNTERMODE_CENTERALIGNED1    = ((uint8_t)0x20),\n  TIM1_COUNTERMODE_CENTERALIGNED2    = ((uint8_t)0x40),\n  TIM1_COUNTERMODE_CENTERALIGNED3    = ((uint8_t)0x60)\n}TIM1_CounterMode_TypeDef;\n\n#define IS_TIM1_COUNTER_MODE_OK(MODE) (((MODE) == TIM1_COUNTERMODE_UP) || \\\n                                       ((MODE) == TIM1_COUNTERMODE_DOWN) || \\\n                                       ((MODE) == TIM1_COUNTERMODE_CENTERALIGNED1) || \\\n                                       ((MODE) == TIM1_COUNTERMODE_CENTERALIGNED2) || \\\n                                       ((MODE) == TIM1_COUNTERMODE_CENTERALIGNED3))\n\n/** TIM1 Output Compare Polarity */\ntypedef enum\n{\n  TIM1_OCPOLARITY_HIGH               = ((uint8_t)0x00),\n  TIM1_OCPOLARITY_LOW                = ((uint8_t)0x22)\n}TIM1_OCPolarity_TypeDef;\n\n#define IS_TIM1_OC_POLARITY_OK(POLARITY) (((POLARITY) == TIM1_OCPOLARITY_HIGH) || \\\n    ((POLARITY) == TIM1_OCPOLARITY_LOW))\n\n/** TIM1 Output Compare N Polarity */\ntypedef enum\n{\n  TIM1_OCNPOLARITY_HIGH              = ((uint8_t)0x00),\n  TIM1_OCNPOLARITY_LOW               = ((uint8_t)0x88)\n}TIM1_OCNPolarity_TypeDef;\n\n#define IS_TIM1_OCN_POLARITY_OK(POLARITY) (((POLARITY) == TIM1_OCNPOLARITY_HIGH) || \\\n    ((POLARITY) == TIM1_OCNPOLARITY_LOW))\n\n/** TIM1 Output Compare states */\ntypedef enum\n{\n  TIM1_OUTPUTSTATE_DISABLE           = ((uint8_t)0x00),\n  TIM1_OUTPUTSTATE_ENABLE            = ((uint8_t)0x11)\n}TIM1_OutputState_TypeDef;\n\n#define IS_TIM1_OUTPUT_STATE_OK(STATE) (((STATE) == TIM1_OUTPUTSTATE_DISABLE) || \\\n                                        ((STATE) == TIM1_OUTPUTSTATE_ENABLE))\n\n/** TIM1 Output Compare N States */\ntypedef enum\n{\n  TIM1_OUTPUTNSTATE_DISABLE = ((uint8_t)0x00),\n  TIM1_OUTPUTNSTATE_ENABLE  = ((uint8_t)0x44)\n} TIM1_OutputNState_TypeDef;\n\n#define IS_TIM1_OUTPUTN_STATE_OK(STATE) (((STATE) == TIM1_OUTPUTNSTATE_DISABLE) ||\\\n    ((STATE) == TIM1_OUTPUTNSTATE_ENABLE))\n\n/** TIM1 Break Input enable/disable */\ntypedef enum\n{\n  TIM1_BREAK_ENABLE                  = ((uint8_t)0x10),\n  TIM1_BREAK_DISABLE                 = ((uint8_t)0x00)\n}TIM1_BreakState_TypeDef;\n#define IS_TIM1_BREAK_STATE_OK(STATE) (((STATE) == TIM1_BREAK_ENABLE) || \\\n                                       ((STATE) == TIM1_BREAK_DISABLE))\n\n/** TIM1 Break Polarity */\ntypedef enum\n{\n  TIM1_BREAKPOLARITY_LOW             = ((uint8_t)0x00),\n  TIM1_BREAKPOLARITY_HIGH            = ((uint8_t)0x20)\n}TIM1_BreakPolarity_TypeDef;\n#define IS_TIM1_BREAK_POLARITY_OK(POLARITY) (((POLARITY) == TIM1_BREAKPOLARITY_LOW) || \\\n    ((POLARITY) == TIM1_BREAKPOLARITY_HIGH))\n\n/** TIM1 AOE Bit Set/Reset */\ntypedef enum\n{\n  TIM1_AUTOMATICOUTPUT_ENABLE        = ((uint8_t)0x40),\n  TIM1_AUTOMATICOUTPUT_DISABLE       = ((uint8_t)0x00)\n}TIM1_AutomaticOutput_TypeDef;\n\n#define IS_TIM1_AUTOMATIC_OUTPUT_STATE_OK(STATE) (((STATE) == TIM1_AUTOMATICOUTPUT_ENABLE) || \\\n    ((STATE) == TIM1_AUTOMATICOUTPUT_DISABLE))\n\n/** TIM1 Lock levels */\ntypedef enum\n{\n  TIM1_LOCKLEVEL_OFF                 = ((uint8_t)0x00),\n  TIM1_LOCKLEVEL_1                   = ((uint8_t)0x01),\n  TIM1_LOCKLEVEL_2                   = ((uint8_t)0x02),\n  TIM1_LOCKLEVEL_3                   = ((uint8_t)0x03)\n}TIM1_LockLevel_TypeDef;\n\n#define IS_TIM1_LOCK_LEVEL_OK(LEVEL) (((LEVEL) == TIM1_LOCKLEVEL_OFF) || \\\n                                      ((LEVEL) == TIM1_LOCKLEVEL_1) || \\\n                                      ((LEVEL) == TIM1_LOCKLEVEL_2) || \\\n                                      ((LEVEL) == TIM1_LOCKLEVEL_3))\n\n/** TIM1 OSSI: Off-State Selection for Idle mode states */\ntypedef enum\n{\n  TIM1_OSSISTATE_ENABLE              = ((uint8_t)0x04),\n  TIM1_OSSISTATE_DISABLE             = ((uint8_t)0x00)\n}TIM1_OSSIState_TypeDef;\n\n#define IS_TIM1_OSSI_STATE_OK(STATE) (((STATE) == TIM1_OSSISTATE_ENABLE) || \\\n                                      ((STATE) == TIM1_OSSISTATE_DISABLE))\n\n/** TIM1 Output Compare Idle State */\ntypedef enum\n{\n  TIM1_OCIDLESTATE_SET               = ((uint8_t)0x55),\n  TIM1_OCIDLESTATE_RESET             = ((uint8_t)0x00)\n}TIM1_OCIdleState_TypeDef;\n\n#define IS_TIM1_OCIDLE_STATE_OK(STATE) (((STATE) == TIM1_OCIDLESTATE_SET) || \\\n                                        ((STATE) == TIM1_OCIDLESTATE_RESET))\n\n/** TIM1 Output Compare N Idle State */\ntypedef enum\n{\n  TIM1_OCNIDLESTATE_SET             = ((uint8_t)0x2A),\n  TIM1_OCNIDLESTATE_RESET           = ((uint8_t)0x00)\n}TIM1_OCNIdleState_TypeDef;\n\n#define IS_TIM1_OCNIDLE_STATE_OK(STATE) (((STATE) == TIM1_OCNIDLESTATE_SET) || \\\n    ((STATE) == TIM1_OCNIDLESTATE_RESET))\n\n/** TIM1 Input Capture Polarity */\ntypedef enum\n{\n  TIM1_ICPOLARITY_RISING            = ((uint8_t)0x00),\n  TIM1_ICPOLARITY_FALLING           = ((uint8_t)0x01)\n}TIM1_ICPolarity_TypeDef;\n\n#define IS_TIM1_IC_POLARITY_OK(POLARITY) (((POLARITY) == TIM1_ICPOLARITY_RISING) || \\\n    ((POLARITY) == TIM1_ICPOLARITY_FALLING))\n\n/** TIM1 Input Capture Selection */\ntypedef enum\n{\n  TIM1_ICSELECTION_DIRECTTI          = ((uint8_t)0x01),\n  TIM1_ICSELECTION_INDIRECTTI        = ((uint8_t)0x02),\n  TIM1_ICSELECTION_TRGI              = ((uint8_t)0x03)\n}TIM1_ICSelection_TypeDef;\n\n#define IS_TIM1_IC_SELECTION_OK(SELECTION) (((SELECTION) == TIM1_ICSELECTION_DIRECTTI) || \\\n    ((SELECTION) == TIM1_ICSELECTION_INDIRECTTI) || \\\n    ((SELECTION) == TIM1_ICSELECTION_TRGI))\n\n/** TIM1 Input Capture Prescaler */\ntypedef enum\n{\n  TIM1_ICPSC_DIV1                    = ((uint8_t)0x00),\n  TIM1_ICPSC_DIV2                    = ((uint8_t)0x04),\n  TIM1_ICPSC_DIV4                    = ((uint8_t)0x08),\n  TIM1_ICPSC_DIV8                    = ((uint8_t)0x0C)\n}TIM1_ICPSC_TypeDef;\n\n#define IS_TIM1_IC_PRESCALER_OK(PRESCALER) (((PRESCALER) == TIM1_ICPSC_DIV1) || \\\n    ((PRESCALER) == TIM1_ICPSC_DIV2) || \\\n    ((PRESCALER) == TIM1_ICPSC_DIV4) || \\\n    ((PRESCALER) == TIM1_ICPSC_DIV8))\n\n/** TIM1 Input Capture Filer Value */\n\n#define IS_TIM1_IC_FILTER_OK(ICFILTER) ((ICFILTER) <= 0x0F)\n\n/** TIM1 External Trigger Filer Value */\n#define IS_TIM1_EXT_TRG_FILTER_OK(FILTER) ((FILTER) <= 0x0F)\n\n/** TIM1 interrupt sources */\ntypedef enum\n{\n  TIM1_IT_UPDATE                     = ((uint8_t)0x01),\n  TIM1_IT_CC1                        = ((uint8_t)0x02),\n  TIM1_IT_CC2                        = ((uint8_t)0x04),\n  TIM1_IT_CC3                        = ((uint8_t)0x08),\n  TIM1_IT_CC4                        = ((uint8_t)0x10),\n  TIM1_IT_COM                        = ((uint8_t)0x20),\n  TIM1_IT_TRIGGER                    = ((uint8_t)0x40),\n  TIM1_IT_BREAK                      = ((uint8_t)0x80)\n}TIM1_IT_TypeDef;\n\n#define IS_TIM1_IT_OK(IT) ((IT) != 0x00)\n\n#define IS_TIM1_GET_IT_OK(IT) (((IT) == TIM1_IT_UPDATE) || \\\n                               ((IT) == TIM1_IT_CC1) || \\\n                               ((IT) == TIM1_IT_CC2) || \\\n                               ((IT) == TIM1_IT_CC3) || \\\n                               ((IT) == TIM1_IT_CC4) || \\\n                               ((IT) == TIM1_IT_COM) || \\\n                               ((IT) == TIM1_IT_TRIGGER) || \\\n                               ((IT) == TIM1_IT_BREAK))\n\n\n/** TIM1 External Trigger Prescaler */\ntypedef enum\n{\n  TIM1_EXTTRGPSC_OFF                 = ((uint8_t)0x00),\n  TIM1_EXTTRGPSC_DIV2                = ((uint8_t)0x10),\n  TIM1_EXTTRGPSC_DIV4                = ((uint8_t)0x20),\n  TIM1_EXTTRGPSC_DIV8                = ((uint8_t)0x30)\n}TIM1_ExtTRGPSC_TypeDef;\n\n#define IS_TIM1_EXT_PRESCALER_OK(PRESCALER) (((PRESCALER) == TIM1_EXTTRGPSC_OFF) || \\\n    ((PRESCALER) == TIM1_EXTTRGPSC_DIV2) || \\\n    ((PRESCALER) == TIM1_EXTTRGPSC_DIV4) || \\\n    ((PRESCALER) == TIM1_EXTTRGPSC_DIV8))\n\n/** TIM1 Internal Trigger Selection */\ntypedef enum\n{\n  TIM1_TS_TIM6                       = ((uint8_t)0x00),  /*!< TRIG Input source =  TIM6 TRIG Output  */\n  TIM1_TS_TIM5                       = ((uint8_t)0x30),  /*!< TRIG Input source =  TIM5 TRIG Output  */\n  TIM1_TS_TI1F_ED                    = ((uint8_t)0x40),\n  TIM1_TS_TI1FP1                     = ((uint8_t)0x50),\n  TIM1_TS_TI2FP2                     = ((uint8_t)0x60),\n  TIM1_TS_ETRF                       = ((uint8_t)0x70)\n}TIM1_TS_TypeDef;\n\n#define IS_TIM1_TRIGGER_SELECTION_OK(SELECTION) (((SELECTION) == TIM1_TS_TI1F_ED) || \\\n    ((SELECTION) == TIM1_TS_TI1FP1) || \\\n    ((SELECTION) == TIM1_TS_TI2FP2) || \\\n    ((SELECTION) == TIM1_TS_ETRF) || \\\n    ((SELECTION) == TIM1_TS_TIM5) || \\\n    ((SELECTION) == TIM1_TS_TIM6))\n\n\n#define IS_TIM1_TIX_TRIGGER_SELECTION_OK(SELECTION) (((SELECTION) == TIM1_TS_TI1F_ED) || \\\n    ((SELECTION) == TIM1_TS_TI1FP1) || \\\n    ((SELECTION) == TIM1_TS_TI2FP2))\n\n/** TIM1 TIx External Clock Source */\ntypedef enum\n{\n  TIM1_TIXEXTERNALCLK1SOURCE_TI1ED   = ((uint8_t)0x40),\n  TIM1_TIXEXTERNALCLK1SOURCE_TI1     = ((uint8_t)0x50),\n  TIM1_TIXEXTERNALCLK1SOURCE_TI2     = ((uint8_t)0x60)\n}TIM1_TIxExternalCLK1Source_TypeDef;\n\n#define IS_TIM1_TIXCLK_SOURCE_OK(SOURCE)  (((SOURCE) == TIM1_TIXEXTERNALCLK1SOURCE_TI1ED) || \\\n    ((SOURCE) == TIM1_TIXEXTERNALCLK1SOURCE_TI2) || \\\n    ((SOURCE) == TIM1_TIXEXTERNALCLK1SOURCE_TI1))\n\n/** TIM1 External Trigger Polarity */\ntypedef enum\n{\n  TIM1_EXTTRGPOLARITY_INVERTED       = ((uint8_t)0x80),\n  TIM1_EXTTRGPOLARITY_NONINVERTED    = ((uint8_t)0x00)\n}TIM1_ExtTRGPolarity_TypeDef;\n\n#define IS_TIM1_EXT_POLARITY_OK(POLARITY) (((POLARITY) == TIM1_EXTTRGPOLARITY_INVERTED) || \\\n    ((POLARITY) == TIM1_EXTTRGPOLARITY_NONINVERTED))\n\n/** TIM1 Prescaler Reload Mode */\ntypedef enum\n{\n  TIM1_PSCRELOADMODE_UPDATE          = ((uint8_t)0x00),\n  TIM1_PSCRELOADMODE_IMMEDIATE       = ((uint8_t)0x01)\n}TIM1_PSCReloadMode_TypeDef;\n\n#define IS_TIM1_PRESCALER_RELOAD_OK(RELOAD) (((RELOAD) == TIM1_PSCRELOADMODE_UPDATE) || \\\n    ((RELOAD) == TIM1_PSCRELOADMODE_IMMEDIATE))\n\n/** TIM1 Encoder Mode */\ntypedef enum\n{\n  TIM1_ENCODERMODE_TI1               = ((uint8_t)0x01),\n  TIM1_ENCODERMODE_TI2               = ((uint8_t)0x02),\n  TIM1_ENCODERMODE_TI12              = ((uint8_t)0x03)\n}TIM1_EncoderMode_TypeDef;\n\n#define IS_TIM1_ENCODER_MODE_OK(MODE) (((MODE) == TIM1_ENCODERMODE_TI1) || \\\n                                       ((MODE) == TIM1_ENCODERMODE_TI2) || \\\n                                       ((MODE) == TIM1_ENCODERMODE_TI12))\n\n/** TIM1 Event Source */\ntypedef enum\n{\n  TIM1_EVENTSOURCE_UPDATE            = ((uint8_t)0x01),\n  TIM1_EVENTSOURCE_CC1               = ((uint8_t)0x02),\n  TIM1_EVENTSOURCE_CC2               = ((uint8_t)0x04),\n  TIM1_EVENTSOURCE_CC3               = ((uint8_t)0x08),\n  TIM1_EVENTSOURCE_CC4               = ((uint8_t)0x10),\n  TIM1_EVENTSOURCE_COM               = ((uint8_t)0x20),\n  TIM1_EVENTSOURCE_TRIGGER           = ((uint8_t)0x40),\n  TIM1_EVENTSOURCE_BREAK             = ((uint8_t)0x80)\n}TIM1_EventSource_TypeDef;\n\n#define IS_TIM1_EVENT_SOURCE_OK(SOURCE) ((SOURCE) != 0x00)\n\n/** TIM1 Update Source */\ntypedef enum\n{\n  TIM1_UPDATESOURCE_GLOBAL           = ((uint8_t)0x00),\n  TIM1_UPDATESOURCE_REGULAR          = ((uint8_t)0x01)\n}TIM1_UpdateSource_TypeDef;\n\n#define IS_TIM1_UPDATE_SOURCE_OK(SOURCE) (((SOURCE) == TIM1_UPDATESOURCE_GLOBAL) || \\\n    ((SOURCE) == TIM1_UPDATESOURCE_REGULAR))\n\n/** TIM1 Trigger Output Source */\ntypedef enum\n{\n  TIM1_TRGOSOURCE_RESET              = ((uint8_t)0x00),\n  TIM1_TRGOSOURCE_ENABLE             = ((uint8_t)0x10),\n  TIM1_TRGOSOURCE_UPDATE             = ((uint8_t)0x20),\n  TIM1_TRGOSource_OC1                = ((uint8_t)0x30),\n  TIM1_TRGOSOURCE_OC1REF             = ((uint8_t)0x40),\n  TIM1_TRGOSOURCE_OC2REF             = ((uint8_t)0x50),\n  TIM1_TRGOSOURCE_OC3REF             = ((uint8_t)0x60)\n}TIM1_TRGOSource_TypeDef;\n\n#define IS_TIM1_TRGO_SOURCE_OK(SOURCE) (((SOURCE) == TIM1_TRGOSOURCE_RESET) || \\\n                                        ((SOURCE) == TIM1_TRGOSOURCE_ENABLE) || \\\n                                        ((SOURCE) == TIM1_TRGOSOURCE_UPDATE) || \\\n                                        ((SOURCE) == TIM1_TRGOSource_OC1)  || \\\n                                        ((SOURCE) == TIM1_TRGOSOURCE_OC1REF) || \\\n                                        ((SOURCE) == TIM1_TRGOSOURCE_OC2REF) || \\\n                                        ((SOURCE) == TIM1_TRGOSOURCE_OC3REF))\n\n/** TIM1 Slave Mode */\ntypedef enum\n{\n  TIM1_SLAVEMODE_RESET               = ((uint8_t)0x04),\n  TIM1_SLAVEMODE_GATED               = ((uint8_t)0x05),\n  TIM1_SLAVEMODE_TRIGGER             = ((uint8_t)0x06),\n  TIM1_SLAVEMODE_EXTERNAL1           = ((uint8_t)0x07)\n}TIM1_SlaveMode_TypeDef;\n\n#define IS_TIM1_SLAVE_MODE_OK(MODE) (((MODE) == TIM1_SLAVEMODE_RESET) || \\\n                                     ((MODE) == TIM1_SLAVEMODE_GATED) || \\\n                                     ((MODE) == TIM1_SLAVEMODE_TRIGGER) || \\\n                                     ((MODE) == TIM1_SLAVEMODE_EXTERNAL1))\n\n/** TIM1 Flags */\ntypedef enum\n{\n  TIM1_FLAG_UPDATE                   = ((uint16_t)0x0001),\n  TIM1_FLAG_CC1                      = ((uint16_t)0x0002),\n  TIM1_FLAG_CC2                      = ((uint16_t)0x0004),\n  TIM1_FLAG_CC3                      = ((uint16_t)0x0008),\n  TIM1_FLAG_CC4                      = ((uint16_t)0x0010),\n  TIM1_FLAG_COM                      = ((uint16_t)0x0020),\n  TIM1_FLAG_TRIGGER                  = ((uint16_t)0x0040),\n  TIM1_FLAG_BREAK                    = ((uint16_t)0x0080),\n  TIM1_FLAG_CC1OF                    = ((uint16_t)0x0200),\n  TIM1_FLAG_CC2OF                    = ((uint16_t)0x0400),\n  TIM1_FLAG_CC3OF                    = ((uint16_t)0x0800),\n  TIM1_FLAG_CC4OF                    = ((uint16_t)0x1000)\n}TIM1_FLAG_TypeDef;\n\n#define IS_TIM1_GET_FLAG_OK(FLAG) (((FLAG) == TIM1_FLAG_UPDATE) || \\\n                                   ((FLAG) == TIM1_FLAG_CC1) || \\\n                                   ((FLAG) == TIM1_FLAG_CC2) || \\\n                                   ((FLAG) == TIM1_FLAG_CC3) || \\\n                                   ((FLAG) == TIM1_FLAG_CC4) || \\\n                                   ((FLAG) == TIM1_FLAG_COM) || \\\n                                   ((FLAG) == TIM1_FLAG_TRIGGER) || \\\n                                   ((FLAG) == TIM1_FLAG_BREAK) || \\\n                                   ((FLAG) == TIM1_FLAG_CC1OF) || \\\n                                   ((FLAG) == TIM1_FLAG_CC2OF) || \\\n                                   ((FLAG) == TIM1_FLAG_CC3OF) || \\\n                                   ((FLAG) == TIM1_FLAG_CC4OF))\n\n#define IS_TIM1_CLEAR_FLAG_OK(FLAG) ((((uint16_t)(FLAG) & (uint16_t)0xE100) == 0x0000) && ((FLAG) != 0x0000))\n\n/** TIM1 Forced Action */\ntypedef enum\n{\n  TIM1_FORCEDACTION_ACTIVE           = ((uint8_t)0x50),\n  TIM1_FORCEDACTION_INACTIVE         = ((uint8_t)0x40)\n}TIM1_ForcedAction_TypeDef;\n\n#define IS_TIM1_FORCED_ACTION_OK(ACTION) (((ACTION) == TIM1_FORCEDACTION_ACTIVE) || \\\n    ((ACTION) == TIM1_FORCEDACTION_INACTIVE))\n/**\n  * @}\n  */\n\n/* Exported macro ------------------------------------------------------------*/\n\n/* Exported functions --------------------------------------------------------*/\n\n/** @addtogroup TIM1_Exported_Functions\n  * @{\n  */\n\nvoid TIM1_DeInit(void);\nvoid TIM1_TimeBaseInit(uint16_t TIM1_Prescaler, \n                       TIM1_CounterMode_TypeDef TIM1_CounterMode,\n                       uint16_t TIM1_Period, uint8_t TIM1_RepetitionCounter);\nvoid TIM1_OC1Init(TIM1_OCMode_TypeDef TIM1_OCMode, \n                  TIM1_OutputState_TypeDef TIM1_OutputState, \n                  TIM1_OutputNState_TypeDef TIM1_OutputNState, \n                  uint16_t TIM1_Pulse, TIM1_OCPolarity_TypeDef TIM1_OCPolarity, \n                  TIM1_OCNPolarity_TypeDef TIM1_OCNPolarity, \n                  TIM1_OCIdleState_TypeDef TIM1_OCIdleState, \n                  TIM1_OCNIdleState_TypeDef TIM1_OCNIdleState);\nvoid TIM1_OC2Init(TIM1_OCMode_TypeDef TIM1_OCMode, \n                  TIM1_OutputState_TypeDef TIM1_OutputState, \n                  TIM1_OutputNState_TypeDef TIM1_OutputNState, \n                  uint16_t TIM1_Pulse, TIM1_OCPolarity_TypeDef TIM1_OCPolarity, \n                  TIM1_OCNPolarity_TypeDef TIM1_OCNPolarity, \n                  TIM1_OCIdleState_TypeDef TIM1_OCIdleState, \n                  TIM1_OCNIdleState_TypeDef TIM1_OCNIdleState);\nvoid TIM1_OC3Init(TIM1_OCMode_TypeDef TIM1_OCMode, \n                  TIM1_OutputState_TypeDef TIM1_OutputState, \n                  TIM1_OutputNState_TypeDef TIM1_OutputNState, \n                  uint16_t TIM1_Pulse, TIM1_OCPolarity_TypeDef TIM1_OCPolarity, \n                  TIM1_OCNPolarity_TypeDef TIM1_OCNPolarity, \n                  TIM1_OCIdleState_TypeDef TIM1_OCIdleState, \n                  TIM1_OCNIdleState_TypeDef TIM1_OCNIdleState);\nvoid TIM1_OC4Init(TIM1_OCMode_TypeDef TIM1_OCMode, \n                  TIM1_OutputState_TypeDef TIM1_OutputState, uint16_t TIM1_Pulse,\n                  TIM1_OCPolarity_TypeDef TIM1_OCPolarity, \n                  TIM1_OCIdleState_TypeDef TIM1_OCIdleState);\nvoid TIM1_BDTRConfig(TIM1_OSSIState_TypeDef TIM1_OSSIState, \n                     TIM1_LockLevel_TypeDef TIM1_LockLevel, uint8_t TIM1_DeadTime,\n                     TIM1_BreakState_TypeDef TIM1_Break, \n                     TIM1_BreakPolarity_TypeDef TIM1_BreakPolarity, \n                     TIM1_AutomaticOutput_TypeDef TIM1_AutomaticOutput);\nvoid TIM1_ICInit(TIM1_Channel_TypeDef TIM1_Channel, \n                 TIM1_ICPolarity_TypeDef TIM1_ICPolarity, \n                 TIM1_ICSelection_TypeDef TIM1_ICSelection, \n                 TIM1_ICPSC_TypeDef TIM1_ICPrescaler, uint8_t TIM1_ICFilter);\nvoid TIM1_PWMIConfig(TIM1_Channel_TypeDef TIM1_Channel, \n                     TIM1_ICPolarity_TypeDef TIM1_ICPolarity, \n                     TIM1_ICSelection_TypeDef TIM1_ICSelection, \n                     TIM1_ICPSC_TypeDef TIM1_ICPrescaler, uint8_t TIM1_ICFilter);\nvoid TIM1_Cmd(FunctionalState NewState);\nvoid TIM1_CtrlPWMOutputs(FunctionalState NewState);\nvoid TIM1_ITConfig(TIM1_IT_TypeDef TIM1_IT, FunctionalState NewState);\nvoid TIM1_InternalClockConfig(void);\nvoid TIM1_ETRClockMode1Config(TIM1_ExtTRGPSC_TypeDef TIM1_ExtTRGPrescaler, \n                              TIM1_ExtTRGPolarity_TypeDef TIM1_ExtTRGPolarity, \n                              uint8_t ExtTRGFilter);\nvoid TIM1_ETRClockMode2Config(TIM1_ExtTRGPSC_TypeDef TIM1_ExtTRGPrescaler, \n                              TIM1_ExtTRGPolarity_TypeDef TIM1_ExtTRGPolarity, \n                              uint8_t ExtTRGFilter);\nvoid TIM1_ETRConfig(TIM1_ExtTRGPSC_TypeDef TIM1_ExtTRGPrescaler, \n                    TIM1_ExtTRGPolarity_TypeDef TIM1_ExtTRGPolarity, \n                    uint8_t ExtTRGFilter);\nvoid TIM1_TIxExternalClockConfig(TIM1_TIxExternalCLK1Source_TypeDef TIM1_TIxExternalCLKSource, \n                                 TIM1_ICPolarity_TypeDef TIM1_ICPolarity, \n                                 uint8_t ICFilter);\nvoid TIM1_SelectInputTrigger(TIM1_TS_TypeDef TIM1_InputTriggerSource);\nvoid TIM1_UpdateDisableConfig(FunctionalState NewState);\nvoid TIM1_UpdateRequestConfig(TIM1_UpdateSource_TypeDef TIM1_UpdateSource);\nvoid TIM1_SelectHallSensor(FunctionalState NewState);\nvoid TIM1_SelectOnePulseMode(TIM1_OPMode_TypeDef TIM1_OPMode);\nvoid TIM1_SelectOutputTrigger(TIM1_TRGOSource_TypeDef TIM1_TRGOSource);\nvoid TIM1_SelectSlaveMode(TIM1_SlaveMode_TypeDef TIM1_SlaveMode);\nvoid TIM1_SelectMasterSlaveMode(FunctionalState NewState);\nvoid TIM1_EncoderInterfaceConfig(TIM1_EncoderMode_TypeDef TIM1_EncoderMode, \n                                 TIM1_ICPolarity_TypeDef TIM1_IC1Polarity, \n                                 TIM1_ICPolarity_TypeDef TIM1_IC2Polarity);\nvoid TIM1_PrescalerConfig(uint16_t Prescaler, TIM1_PSCReloadMode_TypeDef TIM1_PSCReloadMode);\nvoid TIM1_CounterModeConfig(TIM1_CounterMode_TypeDef TIM1_CounterMode);\nvoid TIM1_ForcedOC1Config(TIM1_ForcedAction_TypeDef TIM1_ForcedAction);\nvoid TIM1_ForcedOC2Config(TIM1_ForcedAction_TypeDef TIM1_ForcedAction);\nvoid TIM1_ForcedOC3Config(TIM1_ForcedAction_TypeDef TIM1_ForcedAction);\nvoid TIM1_ForcedOC4Config(TIM1_ForcedAction_TypeDef TIM1_ForcedAction);\nvoid TIM1_ARRPreloadConfig(FunctionalState NewState);\nvoid TIM1_SelectCOM(FunctionalState NewState);\nvoid TIM1_CCPreloadControl(FunctionalState NewState);\nvoid TIM1_OC1PreloadConfig(FunctionalState NewState);\nvoid TIM1_OC2PreloadConfig(FunctionalState NewState);\nvoid TIM1_OC3PreloadConfig(FunctionalState NewState);\nvoid TIM1_OC4PreloadConfig(FunctionalState NewState);\nvoid TIM1_OC1FastConfig(FunctionalState NewState);\nvoid TIM1_OC2FastConfig(FunctionalState NewState);\nvoid TIM1_OC3FastConfig(FunctionalState NewState);\nvoid TIM1_OC4FastConfig(FunctionalState NewState);\nvoid TIM1_GenerateEvent(TIM1_EventSource_TypeDef TIM1_EventSource);\nvoid TIM1_OC1PolarityConfig(TIM1_OCPolarity_TypeDef TIM1_OCPolarity);\nvoid TIM1_OC1NPolarityConfig(TIM1_OCNPolarity_TypeDef TIM1_OCNPolarity);\nvoid TIM1_OC2PolarityConfig(TIM1_OCPolarity_TypeDef TIM1_OCPolarity);\nvoid TIM1_OC2NPolarityConfig(TIM1_OCNPolarity_TypeDef TIM1_OCNPolarity);\nvoid TIM1_OC3PolarityConfig(TIM1_OCPolarity_TypeDef TIM1_OCPolarity);\nvoid TIM1_OC3NPolarityConfig(TIM1_OCNPolarity_TypeDef TIM1_OCNPolarity);\nvoid TIM1_OC4PolarityConfig(TIM1_OCPolarity_TypeDef TIM1_OCPolarity);\nvoid TIM1_CCxCmd(TIM1_Channel_TypeDef TIM1_Channel, FunctionalState NewState);\nvoid TIM1_CCxNCmd(TIM1_Channel_TypeDef TIM1_Channel, FunctionalState NewState);\nvoid TIM1_SelectOCxM(TIM1_Channel_TypeDef TIM1_Channel, TIM1_OCMode_TypeDef TIM1_OCMode);\nvoid TIM1_SetCounter(uint16_t Counter);\nvoid TIM1_SetAutoreload(uint16_t Autoreload);\nvoid TIM1_SetCompare1(uint16_t Compare1);\nvoid TIM1_SetCompare2(uint16_t Compare2);\nvoid TIM1_SetCompare3(uint16_t Compare3);\nvoid TIM1_SetCompare4(uint16_t Compare4);\nvoid TIM1_SetIC1Prescaler(TIM1_ICPSC_TypeDef TIM1_IC1Prescaler);\nvoid TIM1_SetIC2Prescaler(TIM1_ICPSC_TypeDef TIM1_IC2Prescaler);\nvoid TIM1_SetIC3Prescaler(TIM1_ICPSC_TypeDef TIM1_IC3Prescaler);\nvoid TIM1_SetIC4Prescaler(TIM1_ICPSC_TypeDef TIM1_IC4Prescaler);\nuint16_t TIM1_GetCapture1(void);\nuint16_t TIM1_GetCapture2(void);\nuint16_t TIM1_GetCapture3(void);\nuint16_t TIM1_GetCapture4(void);\nuint16_t TIM1_GetCounter(void);\nuint16_t TIM1_GetPrescaler(void);\nFlagStatus TIM1_GetFlagStatus(TIM1_FLAG_TypeDef TIM1_FLAG);\nvoid TIM1_ClearFlag(TIM1_FLAG_TypeDef TIM1_FLAG);\nITStatus TIM1_GetITStatus(TIM1_IT_TypeDef TIM1_IT);\nvoid TIM1_ClearITPendingBit(TIM1_IT_TypeDef TIM1_IT);\n\n/**\n  * @}\n  */\n\n#endif /* __STM8S_TIM1_H */\n\n/**\n  * @}\n  */\n\n\n/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/"
  },
  {
    "path": "src/firmware/tsdz2/stm8s/stm8s_tim2.h",
    "content": "/**\n  ******************************************************************************\n  * @file    stm8s_tim2.h\n  * @author  MCD Application Team\n  * @version V2.3.0\n  * @date    16-June-2017\n  * @brief   This file contains all functions prototype and macros for the TIM2 peripheral.\n   ******************************************************************************\n  * @attention\n  *\n  * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>\n  *\n  * Licensed under MCD-ST Liberty SW License Agreement V2, (the \"License\");\n  * You may not use this file except in compliance with the License.\n  * You may obtain a copy of the License at:\n  *\n  *        http://www.st.com/software_license_agreement_liberty_v2\n  *\n  * Unless required by applicable law or agreed to in writing, software \n  * distributed under the License is distributed on an \"AS IS\" BASIS, \n  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  * See the License for the specific language governing permissions and\n  * limitations under the License.\n  *\n  ******************************************************************************\n  */\n\n/* Define to prevent recursive inclusion -------------------------------------*/\n#ifndef __STM8S_TIM2_H\n#define __STM8S_TIM2_H\n\n/* Includes ------------------------------------------------------------------*/\n#include \"stm8s.h\"\n\n/** @addtogroup STM8S_StdPeriph_Driver\n  * @{\n  */\n\n/* Exported types ------------------------------------------------------------*/\n\n\n/** TIM2 Forced Action */\ntypedef enum\n{\n  TIM2_FORCEDACTION_ACTIVE           = ((uint8_t)0x50),\n  TIM2_FORCEDACTION_INACTIVE         = ((uint8_t)0x40)\n}TIM2_ForcedAction_TypeDef;\n\n#define IS_TIM2_FORCED_ACTION_OK(ACTION) (((ACTION) == TIM2_FORCEDACTION_ACTIVE) || \\\n    ((ACTION) == TIM2_FORCEDACTION_INACTIVE))\n\n/** TIM2 Prescaler */\ntypedef enum\n{\n  TIM2_PRESCALER_1  = ((uint8_t)0x00),\n  TIM2_PRESCALER_2    = ((uint8_t)0x01),\n  TIM2_PRESCALER_4    = ((uint8_t)0x02),\n  TIM2_PRESCALER_8     = ((uint8_t)0x03),\n  TIM2_PRESCALER_16   = ((uint8_t)0x04),\n  TIM2_PRESCALER_32     = ((uint8_t)0x05),\n  TIM2_PRESCALER_64    = ((uint8_t)0x06),\n  TIM2_PRESCALER_128   = ((uint8_t)0x07),\n  TIM2_PRESCALER_256   = ((uint8_t)0x08),\n  TIM2_PRESCALER_512   = ((uint8_t)0x09),\n  TIM2_PRESCALER_1024  = ((uint8_t)0x0A),\n  TIM2_PRESCALER_2048 = ((uint8_t)0x0B),\n  TIM2_PRESCALER_4096   = ((uint8_t)0x0C),\n  TIM2_PRESCALER_8192 = ((uint8_t)0x0D),\n  TIM2_PRESCALER_16384 = ((uint8_t)0x0E),\n  TIM2_PRESCALER_32768 = ((uint8_t)0x0F)\n}TIM2_Prescaler_TypeDef;\n\n#define IS_TIM2_PRESCALER_OK(PRESCALER) (((PRESCALER) == TIM2_PRESCALER_1  ) || \\\n    ((PRESCALER) == TIM2_PRESCALER_2    ) || \\\n    ((PRESCALER) == TIM2_PRESCALER_4    ) || \\\n    ((PRESCALER) == TIM2_PRESCALER_8  ) || \\\n    ((PRESCALER) == TIM2_PRESCALER_16   ) || \\\n    ((PRESCALER) == TIM2_PRESCALER_32     ) || \\\n    ((PRESCALER) == TIM2_PRESCALER_64    ) || \\\n    ((PRESCALER) == TIM2_PRESCALER_128   ) || \\\n    ((PRESCALER) == TIM2_PRESCALER_256   ) || \\\n    ((PRESCALER) == TIM2_PRESCALER_512   ) || \\\n    ((PRESCALER) == TIM2_PRESCALER_1024  ) || \\\n    ((PRESCALER) == TIM2_PRESCALER_2048 ) || \\\n    ((PRESCALER) == TIM2_PRESCALER_4096 ) || \\\n    ((PRESCALER) == TIM2_PRESCALER_8192 ) || \\\n    ((PRESCALER) == TIM2_PRESCALER_16384 ) || \\\n    ((PRESCALER) == TIM2_PRESCALER_32768 ))\n\n/** TIM2 Output Compare and PWM modes */\ntypedef enum\n{\n  TIM2_OCMODE_TIMING     = ((uint8_t)0x00),\n  TIM2_OCMODE_ACTIVE     = ((uint8_t)0x10),\n  TIM2_OCMODE_INACTIVE   = ((uint8_t)0x20),\n  TIM2_OCMODE_TOGGLE     = ((uint8_t)0x30),\n  TIM2_OCMODE_PWM1       = ((uint8_t)0x60),\n  TIM2_OCMODE_PWM2       = ((uint8_t)0x70)\n}TIM2_OCMode_TypeDef;\n\n#define IS_TIM2_OC_MODE_OK(MODE) (((MODE) ==  TIM2_OCMODE_TIMING) || \\\n                                  ((MODE) == TIM2_OCMODE_ACTIVE) || \\\n                                  ((MODE) == TIM2_OCMODE_INACTIVE) || \\\n                                  ((MODE) == TIM2_OCMODE_TOGGLE)|| \\\n                                  ((MODE) == TIM2_OCMODE_PWM1) || \\\n                                  ((MODE) == TIM2_OCMODE_PWM2))\n\n#define IS_TIM2_OCM_OK(MODE)(((MODE) ==  TIM2_OCMODE_TIMING) || \\\n                             ((MODE) == TIM2_OCMODE_ACTIVE) || \\\n                             ((MODE) == TIM2_OCMODE_INACTIVE) || \\\n                             ((MODE) == TIM2_OCMODE_TOGGLE)|| \\\n                             ((MODE) == TIM2_OCMODE_PWM1) || \\\n                             ((MODE) == TIM2_OCMODE_PWM2) || \\\n                             ((MODE) == (uint8_t)TIM2_FORCEDACTION_ACTIVE) || \\\n                             ((MODE) == (uint8_t)TIM2_FORCEDACTION_INACTIVE))\n\n/** TIM2 One Pulse Mode */\ntypedef enum\n{\n  TIM2_OPMODE_SINGLE                 = ((uint8_t)0x01),\n  TIM2_OPMODE_REPETITIVE             = ((uint8_t)0x00)\n}TIM2_OPMode_TypeDef;\n\n#define IS_TIM2_OPM_MODE_OK(MODE) (((MODE) == TIM2_OPMODE_SINGLE) || \\\n                                   ((MODE) == TIM2_OPMODE_REPETITIVE))\n\n/** TIM2 Channel */\ntypedef enum\n{\n  TIM2_CHANNEL_1                     = ((uint8_t)0x00),\n  TIM2_CHANNEL_2                     = ((uint8_t)0x01),\n  TIM2_CHANNEL_3                     = ((uint8_t)0x02)\n}TIM2_Channel_TypeDef;\n\n#define IS_TIM2_CHANNEL_OK(CHANNEL) (((CHANNEL) == TIM2_CHANNEL_1) || \\\n                                     ((CHANNEL) == TIM2_CHANNEL_2) || \\\n                                     ((CHANNEL) == TIM2_CHANNEL_3))\n\n#define IS_TIM2_PWMI_CHANNEL_OK(CHANNEL) (((CHANNEL) == TIM2_CHANNEL_1) || \\\n    ((CHANNEL) == TIM2_CHANNEL_2))\n\n/** TIM2 Output Compare Polarity */\ntypedef enum\n{\n  TIM2_OCPOLARITY_HIGH               = ((uint8_t)0x00),\n  TIM2_OCPOLARITY_LOW                = ((uint8_t)0x22)\n}TIM2_OCPolarity_TypeDef;\n\n#define IS_TIM2_OC_POLARITY_OK(POLARITY) (((POLARITY) == TIM2_OCPOLARITY_HIGH) || \\\n    ((POLARITY) == TIM2_OCPOLARITY_LOW))\n\n/** TIM2 Output Compare states */\ntypedef enum\n{\n  TIM2_OUTPUTSTATE_DISABLE           = ((uint8_t)0x00),\n  TIM2_OUTPUTSTATE_ENABLE            = ((uint8_t)0x11)\n}TIM2_OutputState_TypeDef;\n\n#define IS_TIM2_OUTPUT_STATE_OK(STATE) (((STATE) == TIM2_OUTPUTSTATE_DISABLE) || \\\n                                        ((STATE) == TIM2_OUTPUTSTATE_ENABLE))\n\n/** TIM2 Input Capture Polarity */\ntypedef enum\n{\n  TIM2_ICPOLARITY_RISING            = ((uint8_t)0x00),\n  TIM2_ICPOLARITY_FALLING           = ((uint8_t)0x44)\n}TIM2_ICPolarity_TypeDef;\n\n#define IS_TIM2_IC_POLARITY_OK(POLARITY) (((POLARITY) == TIM2_ICPOLARITY_RISING) || \\\n    ((POLARITY) == TIM2_ICPOLARITY_FALLING))\n\n/** TIM2 Input Capture Selection */\ntypedef enum\n{\n  TIM2_ICSELECTION_DIRECTTI          = ((uint8_t)0x01),\n  TIM2_ICSELECTION_INDIRECTTI        = ((uint8_t)0x02),\n  TIM2_ICSELECTION_TRGI              = ((uint8_t)0x03)\n}TIM2_ICSelection_TypeDef;\n\n#define IS_TIM2_IC_SELECTION_OK(SELECTION) (((SELECTION) == TIM2_ICSELECTION_DIRECTTI) || \\\n    ((SELECTION) == TIM2_ICSELECTION_INDIRECTTI) || \\\n    ((SELECTION) == TIM2_ICSELECTION_TRGI))\n\n#define IS_TIM2_IC_SELECTION1_OK(SELECTION) (((SELECTION) == TIM2_ICSELECTION_DIRECTTI) || \\\n    ((SELECTION) == TIM2_ICSELECTION_TRGI))\n\n/** TIM2 Input Capture Prescaler */\ntypedef enum\n{\n  TIM2_ICPSC_DIV1                    = ((uint8_t)0x00),\n  TIM2_ICPSC_DIV2                    = ((uint8_t)0x04),\n  TIM2_ICPSC_DIV4                    = ((uint8_t)0x08),\n  TIM2_ICPSC_DIV8                    = ((uint8_t)0x0C)\n}TIM2_ICPSC_TypeDef;\n\n#define IS_TIM2_IC_PRESCALER_OK(PRESCALER) (((PRESCALER) == TIM2_ICPSC_DIV1) || \\\n    ((PRESCALER) == TIM2_ICPSC_DIV2) || \\\n    ((PRESCALER) == TIM2_ICPSC_DIV4) || \\\n    ((PRESCALER) == TIM2_ICPSC_DIV8))\n\n/** TIM2 Input Capture Filer Value */\n#define IS_TIM2_IC_FILTER_OK(ICFILTER) ((ICFILTER) <= 0x0F)\n\n/** TIM2 interrupt sources */\ntypedef enum\n{\n  TIM2_IT_UPDATE                     = ((uint8_t)0x01),\n  TIM2_IT_CC1                        = ((uint8_t)0x02),\n  TIM2_IT_CC2                        = ((uint8_t)0x04),\n  TIM2_IT_CC3                        = ((uint8_t)0x08)\n}TIM2_IT_TypeDef;\n\n#define IS_TIM2_IT_OK(IT) (((IT) != 0x00) && ((IT) <= 0x0F))\n\n#define IS_TIM2_GET_IT_OK(IT) (((IT) == TIM2_IT_UPDATE) || \\\n                               ((IT) == TIM2_IT_CC1) || \\\n                               ((IT) == TIM2_IT_CC2) || \\\n                               ((IT) == TIM2_IT_CC3))\n\n/** TIM2 Prescaler Reload Mode */\ntypedef enum\n{\n  TIM2_PSCRELOADMODE_UPDATE          = ((uint8_t)0x00),\n  TIM2_PSCRELOADMODE_IMMEDIATE       = ((uint8_t)0x01)\n}TIM2_PSCReloadMode_TypeDef;\n\n#define IS_TIM2_PRESCALER_RELOAD_OK(RELOAD) (((RELOAD) == TIM2_PSCRELOADMODE_UPDATE) || \\\n    ((RELOAD) == TIM2_PSCRELOADMODE_IMMEDIATE))\n\n/** TIM2 Event Source */\ntypedef enum\n{\n  TIM2_EVENTSOURCE_UPDATE            = ((uint8_t)0x01),\n  TIM2_EVENTSOURCE_CC1               = ((uint8_t)0x02),\n  TIM2_EVENTSOURCE_CC2               = ((uint8_t)0x04),\n  TIM2_EVENTSOURCE_CC3               = ((uint8_t)0x08)\n}TIM2_EventSource_TypeDef;\n\n#define IS_TIM2_EVENT_SOURCE_OK(SOURCE) (((SOURCE) != 0x00))\n\n/** TIM2 Update Source */\ntypedef enum\n{\n  TIM2_UPDATESOURCE_GLOBAL           = ((uint8_t)0x00),\n  TIM2_UPDATESOURCE_REGULAR          = ((uint8_t)0x01)\n}TIM2_UpdateSource_TypeDef;\n\n#define IS_TIM2_UPDATE_SOURCE_OK(SOURCE) (((SOURCE) == TIM2_UPDATESOURCE_GLOBAL) || \\\n    ((SOURCE) == TIM2_UPDATESOURCE_REGULAR))\n\n/** TIM2 Flags */\ntypedef enum\n{\n  TIM2_FLAG_UPDATE                   = ((uint16_t)0x0001),\n  TIM2_FLAG_CC1                      = ((uint16_t)0x0002),\n  TIM2_FLAG_CC2                      = ((uint16_t)0x0004),\n  TIM2_FLAG_CC3                      = ((uint16_t)0x0008),\n  TIM2_FLAG_CC1OF                    = ((uint16_t)0x0200),\n  TIM2_FLAG_CC2OF                    = ((uint16_t)0x0400),\n  TIM2_FLAG_CC3OF                    = ((uint16_t)0x0800)\n}TIM2_FLAG_TypeDef;\n\n#define IS_TIM2_GET_FLAG_OK(FLAG) (((FLAG) == TIM2_FLAG_UPDATE) || \\\n                                   ((FLAG) == TIM2_FLAG_CC1) || \\\n                                   ((FLAG) == TIM2_FLAG_CC2) || \\\n                                   ((FLAG) == TIM2_FLAG_CC3) || \\\n                                   ((FLAG) == TIM2_FLAG_CC1OF) || \\\n                                   ((FLAG) == TIM2_FLAG_CC2OF) || \\\n                                   ((FLAG) == TIM2_FLAG_CC3OF))\n\n#define IS_TIM2_CLEAR_FLAG_OK(FLAG) ((((uint16_t)(FLAG) & 0xF1F0) == 0x0000) && ((uint16_t)(FLAG) != 0x0000))\n                                    \n/**\n  * @}\n  */\n\n/* Exported macro ------------------------------------------------------------*/\n\n/* Exported functions --------------------------------------------------------*/\n\n/** @addtogroup TIM2_Exported_Functions\n  * @{\n  */\n\nvoid TIM2_DeInit(void);\nvoid TIM2_TimeBaseInit(TIM2_Prescaler_TypeDef TIM2_Prescaler, uint16_t TIM2_Period);\nvoid TIM2_OC1Init(TIM2_OCMode_TypeDef TIM2_OCMode, TIM2_OutputState_TypeDef TIM2_OutputState, uint16_t TIM2_Pulse, TIM2_OCPolarity_TypeDef TIM2_OCPolarity);\nvoid TIM2_OC2Init(TIM2_OCMode_TypeDef TIM2_OCMode, TIM2_OutputState_TypeDef TIM2_OutputState, uint16_t TIM2_Pulse, TIM2_OCPolarity_TypeDef TIM2_OCPolarity);\nvoid TIM2_OC3Init(TIM2_OCMode_TypeDef TIM2_OCMode, TIM2_OutputState_TypeDef TIM2_OutputState, uint16_t TIM2_Pulse, TIM2_OCPolarity_TypeDef TIM2_OCPolarity);\nvoid TIM2_ICInit(TIM2_Channel_TypeDef TIM2_Channel, TIM2_ICPolarity_TypeDef TIM2_ICPolarity, TIM2_ICSelection_TypeDef TIM2_ICSelection,  TIM2_ICPSC_TypeDef TIM2_ICPrescaler, uint8_t TIM2_ICFilter);\nvoid TIM2_PWMIConfig(TIM2_Channel_TypeDef TIM2_Channel, TIM2_ICPolarity_TypeDef TIM2_ICPolarity, TIM2_ICSelection_TypeDef TIM2_ICSelection,  TIM2_ICPSC_TypeDef TIM2_ICPrescaler, uint8_t TIM2_ICFilter);\nvoid TIM2_Cmd(FunctionalState NewState);\nvoid TIM2_ITConfig(TIM2_IT_TypeDef TIM2_IT, FunctionalState NewState);\nvoid TIM2_InternalClockConfig(void);\nvoid TIM2_UpdateDisableConfig(FunctionalState NewState);\nvoid TIM2_UpdateRequestConfig(TIM2_UpdateSource_TypeDef TIM2_UpdateSource);\nvoid TIM2_SelectOnePulseMode(TIM2_OPMode_TypeDef TIM2_OPMode);\nvoid TIM2_PrescalerConfig(TIM2_Prescaler_TypeDef Prescaler, TIM2_PSCReloadMode_TypeDef TIM2_PSCReloadMode);\nvoid TIM2_ForcedOC1Config(TIM2_ForcedAction_TypeDef TIM2_ForcedAction);\nvoid TIM2_ForcedOC2Config(TIM2_ForcedAction_TypeDef TIM2_ForcedAction);\nvoid TIM2_ForcedOC3Config(TIM2_ForcedAction_TypeDef TIM2_ForcedAction);\nvoid TIM2_ARRPreloadConfig(FunctionalState NewState);\nvoid TIM2_CCPreloadControl(FunctionalState NewState);\nvoid TIM2_OC1PreloadConfig(FunctionalState NewState);\nvoid TIM2_OC2PreloadConfig(FunctionalState NewState);\nvoid TIM2_OC3PreloadConfig(FunctionalState NewState);\nvoid TIM2_GenerateEvent(TIM2_EventSource_TypeDef TIM2_EventSource);\nvoid TIM2_OC1PolarityConfig(TIM2_OCPolarity_TypeDef TIM2_OCPolarity);\nvoid TIM2_OC2PolarityConfig(TIM2_OCPolarity_TypeDef TIM2_OCPolarity);\nvoid TIM2_OC3PolarityConfig(TIM2_OCPolarity_TypeDef TIM2_OCPolarity);\nvoid TIM2_CCxCmd(TIM2_Channel_TypeDef TIM2_Channel, FunctionalState NewState);\nvoid TIM2_SelectOCxM(TIM2_Channel_TypeDef TIM2_Channel, TIM2_OCMode_TypeDef TIM2_OCMode);\nvoid TIM2_SetCounter(uint16_t Counter);\nvoid TIM2_SetAutoreload(uint16_t Autoreload);\nvoid TIM2_SetCompare1(uint16_t Compare1);\nvoid TIM2_SetCompare2(uint16_t Compare2);\nvoid TIM2_SetCompare3(uint16_t Compare3);\nvoid TIM2_SetIC1Prescaler(TIM2_ICPSC_TypeDef TIM2_IC1Prescaler);\nvoid TIM2_SetIC2Prescaler(TIM2_ICPSC_TypeDef TIM2_IC2Prescaler);\nvoid TIM2_SetIC3Prescaler(TIM2_ICPSC_TypeDef TIM2_IC3Prescaler);\nuint16_t TIM2_GetCapture1(void);\nuint16_t TIM2_GetCapture2(void);\nuint16_t TIM2_GetCapture3(void);\nuint16_t TIM2_GetCounter(void);\nTIM2_Prescaler_TypeDef TIM2_GetPrescaler(void);\nFlagStatus TIM2_GetFlagStatus(TIM2_FLAG_TypeDef TIM2_FLAG);\nvoid TIM2_ClearFlag(TIM2_FLAG_TypeDef TIM2_FLAG);\nITStatus TIM2_GetITStatus(TIM2_IT_TypeDef TIM2_IT);\nvoid TIM2_ClearITPendingBit(TIM2_IT_TypeDef TIM2_IT);\n\n/**\n  * @}\n  */\n\n#endif /* __STM8S_TIM2_H */\n\n/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\n"
  },
  {
    "path": "src/firmware/tsdz2/stm8s/stm8s_tim3.h",
    "content": "/**\n  ******************************************************************************\n  * @file    stm8s_tim3.h\n  * @author  MCD Application Team\n  * @version V2.3.0\n  * @date    16-June-2017\n  * @brief  This file contains all functions prototype and macros for the TIM3 peripheral.\n   ******************************************************************************\n  * @attention\n  *\n  * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>\n  *\n  * Licensed under MCD-ST Liberty SW License Agreement V2, (the \"License\");\n  * You may not use this file except in compliance with the License.\n  * You may obtain a copy of the License at:\n  *\n  *        http://www.st.com/software_license_agreement_liberty_v2\n  *\n  * Unless required by applicable law or agreed to in writing, software \n  * distributed under the License is distributed on an \"AS IS\" BASIS, \n  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  * See the License for the specific language governing permissions and\n  * limitations under the License.\n  *\n  ******************************************************************************\n  */\n\n/* Define to prevent recursive inclusion -------------------------------------*/\n#ifndef __STM8S_TIM3_H\n#define __STM8S_TIM3_H\n\n/* Includes ------------------------------------------------------------------*/\n#include \"stm8s.h\"\n\n/** @addtogroup STM8S_StdPeriph_Driver\n  * @{\n  */\n\n/* Exported types ------------------------------------------------------------*/\n\n/** @addtogroup TIM3_Exported_Types\n  * @{\n  */\n\n/** TIM3 Forced Action */\ntypedef enum\n{\n  TIM3_FORCEDACTION_ACTIVE           = ((uint8_t)0x50),\n  TIM3_FORCEDACTION_INACTIVE         = ((uint8_t)0x40)\n} TIM3_ForcedAction_TypeDef;\n\n#define IS_TIM3_FORCED_ACTION_OK(ACTION) (((ACTION) == TIM3_FORCEDACTION_ACTIVE) || \\\n    ((ACTION) == TIM3_FORCEDACTION_INACTIVE))\n\n/** TIM3 Prescaler */\ntypedef enum\n{\n  TIM3_PRESCALER_1  = ((uint8_t)0x00),\n  TIM3_PRESCALER_2    = ((uint8_t)0x01),\n  TIM3_PRESCALER_4    = ((uint8_t)0x02),\n  TIM3_PRESCALER_8     = ((uint8_t)0x03),\n  TIM3_PRESCALER_16   = ((uint8_t)0x04),\n  TIM3_PRESCALER_32     = ((uint8_t)0x05),\n  TIM3_PRESCALER_64    = ((uint8_t)0x06),\n  TIM3_PRESCALER_128   = ((uint8_t)0x07),\n  TIM3_PRESCALER_256   = ((uint8_t)0x08),\n  TIM3_PRESCALER_512   = ((uint8_t)0x09),\n  TIM3_PRESCALER_1024  = ((uint8_t)0x0A),\n  TIM3_PRESCALER_2048 = ((uint8_t)0x0B),\n  TIM3_PRESCALER_4096   = ((uint8_t)0x0C),\n  TIM3_PRESCALER_8192 = ((uint8_t)0x0D),\n  TIM3_PRESCALER_16384 = ((uint8_t)0x0E),\n  TIM3_PRESCALER_32768 = ((uint8_t)0x0F)\n} TIM3_Prescaler_TypeDef;\n\n#define IS_TIM3_PRESCALER_OK(PRESCALER) (((PRESCALER) == TIM3_PRESCALER_1  ) || \\\n    ((PRESCALER) == TIM3_PRESCALER_2    ) || \\\n    ((PRESCALER) == TIM3_PRESCALER_4    ) || \\\n    ((PRESCALER) == TIM3_PRESCALER_8  ) || \\\n    ((PRESCALER) == TIM3_PRESCALER_16   ) || \\\n    ((PRESCALER) == TIM3_PRESCALER_32     ) || \\\n    ((PRESCALER) == TIM3_PRESCALER_64    ) || \\\n    ((PRESCALER) == TIM3_PRESCALER_128   ) || \\\n    ((PRESCALER) == TIM3_PRESCALER_256   ) || \\\n    ((PRESCALER) == TIM3_PRESCALER_512   ) || \\\n    ((PRESCALER) == TIM3_PRESCALER_1024  ) || \\\n    ((PRESCALER) == TIM3_PRESCALER_2048 ) || \\\n    ((PRESCALER) == TIM3_PRESCALER_4096 ) || \\\n    ((PRESCALER) == TIM3_PRESCALER_8192 ) || \\\n    ((PRESCALER) == TIM3_PRESCALER_16384 ) || \\\n    ((PRESCALER) == TIM3_PRESCALER_32768 ))\n\n/** TIM3 Output Compare and PWM modes */\ntypedef enum\n{\n  TIM3_OCMODE_TIMING     = ((uint8_t)0x00),\n  TIM3_OCMODE_ACTIVE     = ((uint8_t)0x10),\n  TIM3_OCMODE_INACTIVE   = ((uint8_t)0x20),\n  TIM3_OCMODE_TOGGLE     = ((uint8_t)0x30),\n  TIM3_OCMODE_PWM1       = ((uint8_t)0x60),\n  TIM3_OCMODE_PWM2       = ((uint8_t)0x70)\n} TIM3_OCMode_TypeDef;\n\n#define IS_TIM3_OC_MODE_OK(MODE) (((MODE) ==  TIM3_OCMODE_TIMING) || \\\n                                  ((MODE) == TIM3_OCMODE_ACTIVE) || \\\n                                  ((MODE) == TIM3_OCMODE_INACTIVE) || \\\n                                  ((MODE) == TIM3_OCMODE_TOGGLE)|| \\\n                                  ((MODE) == TIM3_OCMODE_PWM1) || \\\n                                  ((MODE) == TIM3_OCMODE_PWM2))\n\n#define IS_TIM3_OCM_OK(MODE)(((MODE) ==  TIM3_OCMODE_TIMING) || \\\n                             ((MODE) == TIM3_OCMODE_ACTIVE) || \\\n                             ((MODE) == TIM3_OCMODE_INACTIVE) || \\\n                             ((MODE) == TIM3_OCMODE_TOGGLE)|| \\\n                             ((MODE) == TIM3_OCMODE_PWM1) || \\\n                             ((MODE) == TIM3_OCMODE_PWM2) || \\\n                             ((MODE) == (uint8_t)TIM3_FORCEDACTION_ACTIVE) || \\\n                             ((MODE) == (uint8_t)TIM3_FORCEDACTION_INACTIVE))\n\n/** TIM3 One Pulse Mode */\ntypedef enum\n{\n  TIM3_OPMODE_SINGLE                 = ((uint8_t)0x01),\n  TIM3_OPMODE_REPETITIVE             = ((uint8_t)0x00)\n} TIM3_OPMode_TypeDef;\n\n#define IS_TIM3_OPM_MODE_OK(MODE) (((MODE) == TIM3_OPMODE_SINGLE) || \\\n                                   ((MODE) == TIM3_OPMODE_REPETITIVE))\n\n/** TIM3 Channel */\n\ntypedef enum\n{\n  TIM3_CHANNEL_1                     = ((uint8_t)0x00),\n  TIM3_CHANNEL_2                     = ((uint8_t)0x01)\n} TIM3_Channel_TypeDef;\n\n#define IS_TIM3_CHANNEL_OK(CHANNEL) (((CHANNEL) == TIM3_CHANNEL_1) || \\\n                                     ((CHANNEL) == TIM3_CHANNEL_2))\n\n#define IS_TIM3_PWMI_CHANNEL_OK(CHANNEL) (((CHANNEL) == TIM3_CHANNEL_1) || \\\n    ((CHANNEL) == TIM3_CHANNEL_2))\n\n/** TIM3 Output Compare Polarity */\ntypedef enum\n{\n  TIM3_OCPOLARITY_HIGH               = ((uint8_t)0x00),\n  TIM3_OCPOLARITY_LOW                = ((uint8_t)0x22)\n} TIM3_OCPolarity_TypeDef;\n\n#define IS_TIM3_OC_POLARITY_OK(POLARITY) (((POLARITY) == TIM3_OCPOLARITY_HIGH) || \\\n    ((POLARITY) == TIM3_OCPOLARITY_LOW))\n\n/** TIM3 Output Compare states */\ntypedef enum\n{\n  TIM3_OUTPUTSTATE_DISABLE           = ((uint8_t)0x00),\n  TIM3_OUTPUTSTATE_ENABLE            = ((uint8_t)0x11)\n} TIM3_OutputState_TypeDef;\n\n#define IS_TIM3_OUTPUT_STATE_OK(STATE) (((STATE) == TIM3_OUTPUTSTATE_DISABLE) || \\\n                                        ((STATE) == TIM3_OUTPUTSTATE_ENABLE))\n\n/** TIM3 Input Capture Polarity */\ntypedef enum\n{\n  TIM3_ICPOLARITY_RISING            = ((uint8_t)0x00),\n  TIM3_ICPOLARITY_FALLING           = ((uint8_t)0x44)\n} TIM3_ICPolarity_TypeDef;\n\n#define IS_TIM3_IC_POLARITY_OK(POLARITY) (((POLARITY) == TIM3_ICPOLARITY_RISING) || \\\n    ((POLARITY) == TIM3_ICPOLARITY_FALLING))\n\n/** TIM3 Input Capture Selection */\ntypedef enum\n{\n  TIM3_ICSELECTION_DIRECTTI          = ((uint8_t)0x01),\n  TIM3_ICSELECTION_INDIRECTTI        = ((uint8_t)0x02),\n  TIM3_ICSELECTION_TRGI              = ((uint8_t)0x03)\n} TIM3_ICSelection_TypeDef;\n\n#define IS_TIM3_IC_SELECTION_OK(SELECTION) (((SELECTION) == TIM3_ICSELECTION_DIRECTTI) || \\\n    ((SELECTION) == TIM3_ICSELECTION_INDIRECTTI) || \\\n    ((SELECTION) == TIM3_ICSELECTION_TRGI))\n\n/** TIM3 Input Capture Prescaler */\ntypedef enum\n{\n  TIM3_ICPSC_DIV1                    = ((uint8_t)0x00),\n  TIM3_ICPSC_DIV2                    = ((uint8_t)0x04),\n  TIM3_ICPSC_DIV4                    = ((uint8_t)0x08),\n  TIM3_ICPSC_DIV8                    = ((uint8_t)0x0C)\n} TIM3_ICPSC_TypeDef;\n\n#define IS_TIM3_IC_PRESCALER_OK(PRESCALER) (((PRESCALER) == TIM3_ICPSC_DIV1) || \\\n    ((PRESCALER) == TIM3_ICPSC_DIV2) || \\\n    ((PRESCALER) == TIM3_ICPSC_DIV4) || \\\n    ((PRESCALER) == TIM3_ICPSC_DIV8))\n\n/** TIM3 Input Capture Filer Value */\n#define IS_TIM3_IC_FILTER_OK(ICFILTER) ((ICFILTER) <= 0x0F)\n\n/** TIM3 interrupt sources */\ntypedef enum\n{\n  TIM3_IT_UPDATE                     = ((uint8_t)0x01),\n  TIM3_IT_CC1                        = ((uint8_t)0x02),\n  TIM3_IT_CC2                        = ((uint8_t)0x04)\n} TIM3_IT_TypeDef;\n\n#define IS_TIM3_IT_OK(IT) (((IT) != 0x00) && ((IT) <= 0x07))\n\n#define IS_TIM3_GET_IT_OK(IT) (((IT) == TIM3_IT_UPDATE) || \\\n                               ((IT) == TIM3_IT_CC1) || \\\n                               ((IT) == TIM3_IT_CC2))\n\n/** TIM3 Prescaler Reload Mode */\ntypedef enum\n{\n  TIM3_PSCRELOADMODE_UPDATE          = ((uint8_t)0x00),\n  TIM3_PSCRELOADMODE_IMMEDIATE       = ((uint8_t)0x01)\n} TIM3_PSCReloadMode_TypeDef;\n\n#define IS_TIM3_PRESCALER_RELOAD_OK(RELOAD) (((RELOAD) == TIM3_PSCRELOADMODE_UPDATE) || \\\n    ((RELOAD) == TIM3_PSCRELOADMODE_IMMEDIATE))\n\n/** TIM3 Event Source */\ntypedef enum\n{\n  TIM3_EVENTSOURCE_UPDATE            = ((uint8_t)0x01),\n  TIM3_EVENTSOURCE_CC1               = ((uint8_t)0x02),\n  TIM3_EVENTSOURCE_CC2               = ((uint8_t)0x04)\n} TIM3_EventSource_TypeDef;\n\n#define IS_TIM3_EVENT_SOURCE_OK(SOURCE) (((SOURCE) != 0x00))\n\n/** TIM3 Update Source */\ntypedef enum\n{\n  TIM3_UPDATESOURCE_GLOBAL           = ((uint8_t)0x00),\n  TIM3_UPDATESOURCE_REGULAR          = ((uint8_t)0x01)\n} TIM3_UpdateSource_TypeDef;\n\n#define IS_TIM3_UPDATE_SOURCE_OK(SOURCE) (((SOURCE) == TIM3_UPDATESOURCE_GLOBAL) || \\\n    ((SOURCE) == TIM3_UPDATESOURCE_REGULAR))\n\n/** TIM3 Flags */\ntypedef enum\n{\n  TIM3_FLAG_UPDATE                   = ((uint16_t)0x0001),\n  TIM3_FLAG_CC1                      = ((uint16_t)0x0002),\n  TIM3_FLAG_CC2                      = ((uint16_t)0x0004),\n  TIM3_FLAG_CC1OF                    = ((uint16_t)0x0200),\n  TIM3_FLAG_CC2OF                    = ((uint16_t)0x0400)\n} TIM3_FLAG_TypeDef;\n\n#define IS_TIM3_GET_FLAG_OK(FLAG) (((FLAG) == TIM3_FLAG_UPDATE) || \\\n                                   ((FLAG) == TIM3_FLAG_CC1) || \\\n                                   ((FLAG) == TIM3_FLAG_CC2) || \\\n                                   ((FLAG) == TIM3_FLAG_CC1OF) || \\\n                                   ((FLAG) == TIM3_FLAG_CC2OF) )\n\n#define IS_TIM3_CLEAR_FLAG_OK(FLAG) ((((uint16_t)(FLAG) & 0xF9F8) == 0x0000) && ((uint16_t)(FLAG)!= 0x0000))\n\n/**\n  * @}\n  */\n\n/* Exported macro ------------------------------------------------------------*/\n\n/* Exported functions --------------------------------------------------------*/\n\n/** @addtogroup TIM3_Exported_Functions\n  * @{\n  */\n\nvoid TIM3_DeInit(void);\nvoid TIM3_TimeBaseInit(TIM3_Prescaler_TypeDef TIM3_Prescaler, uint16_t TIM3_Period);\nvoid TIM3_OC1Init(TIM3_OCMode_TypeDef TIM3_OCMode, TIM3_OutputState_TypeDef TIM3_OutputState, uint16_t TIM3_Pulse, TIM3_OCPolarity_TypeDef TIM3_OCPolarity);\nvoid TIM3_OC2Init(TIM3_OCMode_TypeDef TIM3_OCMode, TIM3_OutputState_TypeDef TIM3_OutputState, uint16_t TIM3_Pulse, TIM3_OCPolarity_TypeDef TIM3_OCPolarity);\nvoid TIM3_ICInit(TIM3_Channel_TypeDef TIM3_Channel, TIM3_ICPolarity_TypeDef TIM3_ICPolarity, TIM3_ICSelection_TypeDef TIM3_ICSelection,  TIM3_ICPSC_TypeDef TIM3_ICPrescaler, uint8_t TIM3_ICFilter);\nvoid TIM3_PWMIConfig(TIM3_Channel_TypeDef TIM3_Channel, TIM3_ICPolarity_TypeDef TIM3_ICPolarity, TIM3_ICSelection_TypeDef TIM3_ICSelection,  TIM3_ICPSC_TypeDef TIM3_ICPrescaler, uint8_t TIM3_ICFilter);\nvoid TIM3_Cmd(FunctionalState NewState);\nvoid TIM3_ITConfig(TIM3_IT_TypeDef TIM3_IT, FunctionalState NewState);\nvoid TIM3_InternalClockConfig(void);\nvoid TIM3_UpdateDisableConfig(FunctionalState NewState);\nvoid TIM3_UpdateRequestConfig(TIM3_UpdateSource_TypeDef TIM3_UpdateSource);\nvoid TIM3_SelectOnePulseMode(TIM3_OPMode_TypeDef TIM3_OPMode);\nvoid TIM3_PrescalerConfig(TIM3_Prescaler_TypeDef Prescaler, TIM3_PSCReloadMode_TypeDef TIM3_PSCReloadMode);\nvoid TIM3_ForcedOC1Config(TIM3_ForcedAction_TypeDef TIM3_ForcedAction);\nvoid TIM3_ForcedOC2Config(TIM3_ForcedAction_TypeDef TIM3_ForcedAction);\nvoid TIM3_ARRPreloadConfig(FunctionalState NewState);\nvoid TIM3_CCPreloadControl(FunctionalState NewState);\nvoid TIM3_OC1PreloadConfig(FunctionalState NewState);\nvoid TIM3_OC2PreloadConfig(FunctionalState NewState);\nvoid TIM3_GenerateEvent(TIM3_EventSource_TypeDef TIM3_EventSource);\nvoid TIM3_OC1PolarityConfig(TIM3_OCPolarity_TypeDef TIM3_OCPolarity);\nvoid TIM3_OC2PolarityConfig(TIM3_OCPolarity_TypeDef TIM3_OCPolarity);\nvoid TIM3_CCxCmd(TIM3_Channel_TypeDef TIM3_Channel, FunctionalState NewState);\nvoid TIM3_SelectOCxM(TIM3_Channel_TypeDef TIM3_Channel, TIM3_OCMode_TypeDef TIM3_OCMode);\nvoid TIM3_SetCounter(uint16_t Counter);\nvoid TIM3_SetAutoreload(uint16_t Autoreload);\nvoid TIM3_SetCompare1(uint16_t Compare1);\nvoid TIM3_SetCompare2(uint16_t Compare2);\nvoid TIM3_SetIC1Prescaler(TIM3_ICPSC_TypeDef TIM3_IC1Prescaler);\nvoid TIM3_SetIC2Prescaler(TIM3_ICPSC_TypeDef TIM3_IC2Prescaler);\nuint16_t TIM3_GetCapture1(void);\nuint16_t TIM3_GetCapture2(void);\nuint16_t TIM3_GetCounter(void);\nTIM3_Prescaler_TypeDef TIM3_GetPrescaler(void);\nFlagStatus TIM3_GetFlagStatus(TIM3_FLAG_TypeDef TIM3_FLAG);\nvoid TIM3_ClearFlag(TIM3_FLAG_TypeDef TIM3_FLAG);\nITStatus TIM3_GetITStatus(TIM3_IT_TypeDef TIM3_IT);\nvoid TIM3_ClearITPendingBit(TIM3_IT_TypeDef TIM3_IT);\n\n/**\n  * @}\n  */\n\n#endif /* __STM8S_TIM3_H */\n\n/**\n  * @}\n  */\n\n\n/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\n"
  },
  {
    "path": "src/firmware/tsdz2/stm8s/stm8s_tim4.h",
    "content": "/**\n  ******************************************************************************\n  * @file    stm8s_tim4.h\n  * @author  MCD Application Team\n  * @version V2.3.0\n  * @date    16-June-2017\n  * @brief   This file contains all functions prototype and macros for the TIM4 peripheral.\n   ******************************************************************************\n  * @attention\n  *\n  * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>\n  *\n  * Licensed under MCD-ST Liberty SW License Agreement V2, (the \"License\");\n  * You may not use this file except in compliance with the License.\n  * You may obtain a copy of the License at:\n  *\n  *        http://www.st.com/software_license_agreement_liberty_v2\n  *\n  * Unless required by applicable law or agreed to in writing, software \n  * distributed under the License is distributed on an \"AS IS\" BASIS, \n  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  * See the License for the specific language governing permissions and\n  * limitations under the License.\n  *\n  ******************************************************************************\n  */\n\n/* Define to prevent recursive inclusion -------------------------------------*/\n#ifndef __STM8S_TIM4_H\n#define __STM8S_TIM4_H\n\n/* Includes ------------------------------------------------------------------*/\n#include \"stm8s.h\"\n\n/** @addtogroup STM8S_StdPeriph_Driver\n  * @{\n  */\n\n/* Exported types ------------------------------------------------------------*/\n\n/** @addtogroup TIM4_Exported_Types\n  * @{\n  */\n\n\n\n/** TIM4 Prescaler */\ntypedef enum\n{\n  TIM4_PRESCALER_1  = ((uint8_t)0x00),\n  TIM4_PRESCALER_2    = ((uint8_t)0x01),\n  TIM4_PRESCALER_4    = ((uint8_t)0x02),\n  TIM4_PRESCALER_8     = ((uint8_t)0x03),\n  TIM4_PRESCALER_16   = ((uint8_t)0x04),\n  TIM4_PRESCALER_32     = ((uint8_t)0x05),\n  TIM4_PRESCALER_64    = ((uint8_t)0x06),\n  TIM4_PRESCALER_128   = ((uint8_t)0x07)\n} TIM4_Prescaler_TypeDef;\n\n#define IS_TIM4_PRESCALER_OK(PRESCALER) (((PRESCALER) == TIM4_PRESCALER_1  ) || \\\n    ((PRESCALER) == TIM4_PRESCALER_2    ) || \\\n    ((PRESCALER) == TIM4_PRESCALER_4    ) || \\\n    ((PRESCALER) == TIM4_PRESCALER_8  ) || \\\n    ((PRESCALER) == TIM4_PRESCALER_16   ) || \\\n    ((PRESCALER) == TIM4_PRESCALER_32     ) || \\\n    ((PRESCALER) == TIM4_PRESCALER_64    ) || \\\n    ((PRESCALER) == TIM4_PRESCALER_128   ) )\n\n/** TIM4 One Pulse Mode */\ntypedef enum\n{\n  TIM4_OPMODE_SINGLE                 = ((uint8_t)0x01),\n  TIM4_OPMODE_REPETITIVE             = ((uint8_t)0x00)\n} TIM4_OPMode_TypeDef;\n\n#define IS_TIM4_OPM_MODE_OK(MODE) (((MODE) == TIM4_OPMODE_SINGLE) || \\\n                                   ((MODE) == TIM4_OPMODE_REPETITIVE))\n\n/** TIM4 Prescaler Reload Mode */\ntypedef enum\n{\n  TIM4_PSCRELOADMODE_UPDATE          = ((uint8_t)0x00),\n  TIM4_PSCRELOADMODE_IMMEDIATE       = ((uint8_t)0x01)\n} TIM4_PSCReloadMode_TypeDef;\n\n#define IS_TIM4_PRESCALER_RELOAD_OK(RELOAD) (((RELOAD) == TIM4_PSCRELOADMODE_UPDATE) || \\\n    ((RELOAD) == TIM4_PSCRELOADMODE_IMMEDIATE))\n\n/** TIM4 Update Source */\ntypedef enum\n{\n  TIM4_UPDATESOURCE_GLOBAL           = ((uint8_t)0x00),\n  TIM4_UPDATESOURCE_REGULAR          = ((uint8_t)0x01)\n} TIM4_UpdateSource_TypeDef;\n\n#define IS_TIM4_UPDATE_SOURCE_OK(SOURCE) (((SOURCE) == TIM4_UPDATESOURCE_GLOBAL) || \\\n    ((SOURCE) == TIM4_UPDATESOURCE_REGULAR))\n\n/** TIM4 Event Source */\ntypedef enum\n{\n  TIM4_EVENTSOURCE_UPDATE            = ((uint8_t)0x01)\n}TIM4_EventSource_TypeDef;\n\n#define IS_TIM4_EVENT_SOURCE_OK(SOURCE) (((SOURCE) == 0x01))\n\n/** TIM4 Flags */\ntypedef enum\n{\n  TIM4_FLAG_UPDATE                   = ((uint8_t)0x01)\n}TIM4_FLAG_TypeDef;\n\n#define IS_TIM4_GET_FLAG_OK(FLAG) ((FLAG) == TIM4_FLAG_UPDATE)\n\n\n\n/** TIM4 interrupt sources */\ntypedef enum\n{\n  TIM4_IT_UPDATE                     = ((uint8_t)0x01)\n}TIM4_IT_TypeDef;\n\n#define IS_TIM4_IT_OK(IT) ((IT) == TIM4_IT_UPDATE)\n\n\n\n/**\n  * @}\n  */\n\n/* Exported macro ------------------------------------------------------------*/\n\n/* Exported functions --------------------------------------------------------*/\n\n/** @addtogroup TIM4_Exported_Functions\n  * @{\n  */\nvoid TIM4_DeInit(void);\nvoid TIM4_TimeBaseInit(TIM4_Prescaler_TypeDef TIM4_Prescaler, uint8_t TIM4_Period);\nvoid TIM4_Cmd(FunctionalState NewState);\nvoid TIM4_ITConfig(TIM4_IT_TypeDef TIM4_IT, FunctionalState NewState);\nvoid TIM4_UpdateDisableConfig(FunctionalState NewState);\nvoid TIM4_UpdateRequestConfig(TIM4_UpdateSource_TypeDef TIM4_UpdateSource);\nvoid TIM4_SelectOnePulseMode(TIM4_OPMode_TypeDef TIM4_OPMode);\nvoid TIM4_PrescalerConfig(TIM4_Prescaler_TypeDef Prescaler, TIM4_PSCReloadMode_TypeDef TIM4_PSCReloadMode);\nvoid TIM4_ARRPreloadConfig(FunctionalState NewState);\nvoid TIM4_GenerateEvent(TIM4_EventSource_TypeDef TIM4_EventSource);\nvoid TIM4_SetCounter(uint8_t Counter);\nvoid TIM4_SetAutoreload(uint8_t Autoreload);\nuint8_t TIM4_GetCounter(void);\nTIM4_Prescaler_TypeDef TIM4_GetPrescaler(void);\nFlagStatus TIM4_GetFlagStatus(TIM4_FLAG_TypeDef TIM4_FLAG);\nvoid TIM4_ClearFlag(TIM4_FLAG_TypeDef TIM4_FLAG);\nITStatus TIM4_GetITStatus(TIM4_IT_TypeDef TIM4_IT);\nvoid TIM4_ClearITPendingBit(TIM4_IT_TypeDef TIM4_IT);\n\n\n/**\n  * @}\n  */\n\n#endif /* __STM8S_TIM4_H */\n\n/**\n  * @}\n  */\n\n\n/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\n"
  },
  {
    "path": "src/firmware/tsdz2/stm8s/stm8s_tim5.h",
    "content": "/**\n  ******************************************************************************\n  * @file    stm8s_tim5.h\n  * @author  MCD Application Team\n  * @version V2.3.0\n  * @date    16-June-2017\n  * @brief   This file contains all functions prototype and macros for the TIM5 peripheral.\n   ******************************************************************************\n  * @attention\n  *\n  * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>\n  *\n  * Licensed under MCD-ST Liberty SW License Agreement V2, (the \"License\");\n  * You may not use this file except in compliance with the License.\n  * You may obtain a copy of the License at:\n  *\n  *        http://www.st.com/software_license_agreement_liberty_v2\n  *\n  * Unless required by applicable law or agreed to in writing, software \n  * distributed under the License is distributed on an \"AS IS\" BASIS, \n  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  * See the License for the specific language governing permissions and\n  * limitations under the License.\n  *\n  ******************************************************************************\n  */\n\n/* Define to prevent recursive inclusion -------------------------------------*/\n#ifndef __STM8S_TIM5_H\n#define __STM8S_TIM5_H\n\n/* Includes ------------------------------------------------------------------*/\n#include \"stm8s.h\"\n\n/** @addtogroup STM8S_StdPeriph_Driver\n  * @{\n  */\n\n/* Exported types ------------------------------------------------------------*/\n\n\n/** TIM5 Forced Action */\ntypedef enum\n{\n    TIM5_FORCEDACTION_ACTIVE           =((uint8_t)0x50),\n    TIM5_FORCEDACTION_INACTIVE         =((uint8_t)0x40)\n}TIM5_ForcedAction_TypeDef;\n\n#define IS_TIM5_FORCED_ACTION_OK(ACTION) (((ACTION) == TIM5_FORCEDACTION_ACTIVE) || \\\n                                       ((ACTION) == TIM5_FORCEDACTION_INACTIVE))\n\n/** TIM5 Prescaler */\ntypedef enum\n{\n    TIM5_PRESCALER_1     =((uint8_t)0x00),\n    TIM5_PRESCALER_2      =((uint8_t)0x01),\n    TIM5_PRESCALER_4      =((uint8_t)0x02),\n    TIM5_PRESCALER_8      =((uint8_t)0x03),\n    TIM5_PRESCALER_16     =((uint8_t)0x04),\n    TIM5_PRESCALER_32     =((uint8_t)0x05),\n    TIM5_PRESCALER_64     =((uint8_t)0x06),\n    TIM5_PRESCALER_128    =((uint8_t)0x07),\n    TIM5_PRESCALER_256    =((uint8_t)0x08),\n    TIM5_PRESCALER_512    =((uint8_t)0x09),\n    TIM5_PRESCALER_1024   =((uint8_t)0x0A),\n    TIM5_PRESCALER_2048   =((uint8_t)0x0B),\n    TIM5_PRESCALER_4096   =((uint8_t)0x0C),\n    TIM5_PRESCALER_8192   =((uint8_t)0x0D),\n    TIM5_PRESCALER_16384  =((uint8_t)0x0E),\n    TIM5_PRESCALER_32768  =((uint8_t)0x0F)\n}TIM5_Prescaler_TypeDef;\n\n#define IS_TIM5_PRESCALER_OK(PRESCALER) (((PRESCALER) == TIM5_PRESCALER_1) || \\\n                 ((PRESCALER) == TIM5_PRESCALER_2     ) || \\\n                 ((PRESCALER) == TIM5_PRESCALER_4     ) || \\\n                 ((PRESCALER) == TIM5_PRESCALER_8    ) || \\\n                 ((PRESCALER) == TIM5_PRESCALER_16    ) || \\\n                 ((PRESCALER) == TIM5_PRESCALER_32      ) || \\\n                 ((PRESCALER) == TIM5_PRESCALER_64     ) || \\\n                 ((PRESCALER) == TIM5_PRESCALER_128    ) || \\\n                 ((PRESCALER) == TIM5_PRESCALER_256    ) || \\\n                 ((PRESCALER) == TIM5_PRESCALER_512    ) || \\\n                 ((PRESCALER) == TIM5_PRESCALER_1024   ) || \\\n                 ((PRESCALER) == TIM5_PRESCALER_2048  ) || \\\n                 ((PRESCALER) == TIM5_PRESCALER_4096  ) || \\\n                 ((PRESCALER) == TIM5_PRESCALER_8192  ) || \\\n                 ((PRESCALER) == TIM5_PRESCALER_16384  ) || \\\n                 ((PRESCALER) == TIM5_PRESCALER_32768  ))\n\n/** TIM5 Output Compare and PWM modes */\ntypedef enum\n{\n    TIM5_OCMODE_TIMING     =((uint8_t)0x00),\n    TIM5_OCMODE_ACTIVE     =((uint8_t)0x10),\n    TIM5_OCMODE_INACTIVE   =((uint8_t)0x20),\n    TIM5_OCMODE_TOGGLE     =((uint8_t)0x30),\n    TIM5_OCMODE_PWM1       =((uint8_t)0x60),\n    TIM5_OCMODE_PWM2       =((uint8_t)0x70)\n}TIM5_OCMode_TypeDef;\n\n#define IS_TIM5_OC_MODE_OK(MODE) (((MODE) ==  TIM5_OCMODE_TIMING) || \\\n                                  ((MODE) == TIM5_OCMODE_ACTIVE) || \\\n                                  ((MODE) == TIM5_OCMODE_INACTIVE) || \\\n                                  ((MODE) == TIM5_OCMODE_TOGGLE)|| \\\n                                  ((MODE) == TIM5_OCMODE_PWM1) || \\\n                                  ((MODE) == TIM5_OCMODE_PWM2))\n\n#define IS_TIM5_OCM_OK(MODE)(((MODE) ==  TIM5_OCMODE_TIMING) || \\\n                             ((MODE) == TIM5_OCMODE_ACTIVE) || \\\n                             ((MODE) == TIM5_OCMODE_INACTIVE) || \\\n                             ((MODE) == TIM5_OCMODE_TOGGLE)|| \\\n                             ((MODE) == TIM5_OCMODE_PWM1) || \\\n                             ((MODE) == TIM5_OCMODE_PWM2) ||  \\\n                             ((MODE) == (uint8_t)TIM5_FORCEDACTION_ACTIVE) || \\\n                             ((MODE) == (uint8_t)TIM5_FORCEDACTION_INACTIVE))\n\n/** TIM5 One Pulse Mode */\ntypedef enum\n{\n    TIM5_OPMODE_SINGLE                 =((uint8_t)0x01),\n    TIM5_OPMODE_REPETITIVE             =((uint8_t)0x00)\n}TIM5_OPMode_TypeDef;\n\n#define IS_TIM5_OPM_MODE_OK(MODE) (((MODE) == TIM5_OPMODE_SINGLE) || \\\n                                   ((MODE) == TIM5_OPMODE_REPETITIVE))\n\n/** TIM5 Channel */\ntypedef enum\n{\n    TIM5_CHANNEL_1                     =((uint8_t)0x00),\n    TIM5_CHANNEL_2                     =((uint8_t)0x01),\n    TIM5_CHANNEL_3                     =((uint8_t)0x02)\n}TIM5_Channel_TypeDef;\n\n#define IS_TIM5_CHANNEL_OK(CHANNEL) (((CHANNEL) == TIM5_CHANNEL_1) || \\\n                                     ((CHANNEL) == TIM5_CHANNEL_2) || \\\n                                     ((CHANNEL) == TIM5_CHANNEL_3))\n\n#define IS_TIM5_PWMI_CHANNEL_OK(CHANNEL) (((CHANNEL) == TIM5_CHANNEL_1) || \\\n                                          ((CHANNEL) == TIM5_CHANNEL_2))\n\n/** TIM5 Output Compare Polarity */\ntypedef enum\n{\n    TIM5_OCPOLARITY_HIGH               =((uint8_t)0x00),\n    TIM5_OCPOLARITY_LOW                =((uint8_t)0x22)\n}TIM5_OCPolarity_TypeDef;\n\n#define IS_TIM5_OC_POLARITY_OK(POLARITY) (((POLARITY) == TIM5_OCPOLARITY_HIGH) || \\\n                                       ((POLARITY) == TIM5_OCPOLARITY_LOW))\n\n/** TIM5 Output Compare states */\ntypedef enum\n{\n    TIM5_OUTPUTSTATE_DISABLE           =((uint8_t)0x00),\n    TIM5_OUTPUTSTATE_ENABLE            =((uint8_t)0x11)\n}TIM5_OutputState_TypeDef;\n\n#define IS_TIM5_OUTPUT_STATE_OK(STATE) (((STATE) == TIM5_OUTPUTSTATE_DISABLE) || \\\n                                     ((STATE) == TIM5_OUTPUTSTATE_ENABLE))\n\n/** TIM5 Input Capture Polarity */\ntypedef enum\n{\n    TIM5_ICPOLARITY_RISING            =((uint8_t)0x00),\n    TIM5_ICPOLARITY_FALLING           =((uint8_t)0x44)\n}TIM5_ICPolarity_TypeDef;\n\n#define IS_TIM5_IC_POLARITY_OK(POLARITY) (((POLARITY) == TIM5_ICPOLARITY_RISING) || \\\n                                       ((POLARITY) == TIM5_ICPOLARITY_FALLING))\n\n/** TIM5 Input Capture Selection */\ntypedef enum\n{\n    TIM5_ICSELECTION_DIRECTTI          =((uint8_t)0x01),\n    TIM5_ICSELECTION_INDIRECTTI        =((uint8_t)0x02),\n    TIM5_ICSELECTION_TRGI              =((uint8_t)0x03)\n}TIM5_ICSelection_TypeDef;\n\n#define IS_TIM5_IC_SELECTION_OK(SELECTION) (((SELECTION) == TIM5_ICSELECTION_DIRECTTI) || \\\n                                           ((SELECTION) == TIM5_ICSELECTION_INDIRECTTI) || \\\n                                           ((SELECTION) == TIM5_ICSELECTION_TRGI))\n\n#define IS_TIM5_IC_SELECTION1_OK(SELECTION) (((SELECTION) == TIM5_ICSELECTION_DIRECTTI) || \\\n                                             ((SELECTION) == TIM5_ICSELECTION_TRGI))\n\n/** TIM5 Input Capture Prescaler */\ntypedef enum\n{\n    TIM5_ICPSC_DIV1                    =((uint8_t)0x00),\n    TIM5_ICPSC_DIV2                    =((uint8_t)0x04),\n    TIM5_ICPSC_DIV4                    =((uint8_t)0x08),\n    TIM5_ICPSC_DIV8                    =((uint8_t)0x0C)\n}TIM5_ICPSC_TypeDef;\n\n#define IS_TIM5_IC_PRESCALER_OK(PRESCALER) (((PRESCALER) == TIM5_ICPSC_DIV1) || \\\n                                         ((PRESCALER) == TIM5_ICPSC_DIV2) || \\\n                                         ((PRESCALER) == TIM5_ICPSC_DIV4) || \\\n                                         ((PRESCALER) == TIM5_ICPSC_DIV8))\n\n/** TIM5 Input Capture Filer Value */\n#define IS_TIM5_IC_FILTER_OK(ICFILTER) ((ICFILTER) <= 0x0F)\n\n/** TIM5 interrupt sources */\ntypedef enum\n{\n    TIM5_IT_UPDATE                     =((uint8_t)0x01),\n    TIM5_IT_CC1                        =((uint8_t)0x02),\n    TIM5_IT_CC2                        =((uint8_t)0x04),\n    TIM5_IT_CC3                        =((uint8_t)0x08),\n    TIM5_IT_TRIGGER                    = ((uint8_t)0x40)\n}TIM5_IT_TypeDef;\n\n#define IS_TIM5_IT_OK(IT) (((IT) != 0x00) && ((IT) <= 0x4F))\n\n#define IS_TIM5_GET_IT_OK(IT) (((IT) == TIM5_IT_UPDATE) || \\\n                            ((IT) == TIM5_IT_CC1) || \\\n                            ((IT) == TIM5_IT_CC2) || \\\n                            ((IT) == TIM5_IT_CC3) || \\\n                            ((IT) == TIM5_IT_TRIGGER))\n\n/** TIM5 Prescaler Reload Mode */\ntypedef enum\n{\n    TIM5_PSCRELOADMODE_UPDATE          =((uint8_t)0x00),\n    TIM5_PSCRELOADMODE_IMMEDIATE       =((uint8_t)0x01)\n}TIM5_PSCReloadMode_TypeDef;\n\n#define IS_TIM5_PRESCALER_RELOAD_OK(RELOAD) (((RELOAD) == TIM5_PSCRELOADMODE_UPDATE) || \\\n                                          ((RELOAD) == TIM5_PSCRELOADMODE_IMMEDIATE))\n\n/** TIM5 Event Source */\ntypedef enum\n{\n    TIM5_EVENTSOURCE_UPDATE            =((uint8_t)0x01),\n    TIM5_EVENTSOURCE_CC1               =((uint8_t)0x02),\n    TIM5_EVENTSOURCE_CC2               =((uint8_t)0x04),\n    TIM5_EVENTSOURCE_CC3               =((uint8_t)0x08),\n    TIM5_EVENTSOURCE_TRIGGER           = ((uint8_t)0x40)\n}TIM5_EventSource_TypeDef;\n\n#define IS_TIM5_EVENT_SOURCE_OK(SOURCE) (((SOURCE) != 0x00))\n\n/** TIM5 Update Source */\ntypedef enum\n{\n    TIM5_UPDATESOURCE_GLOBAL           =((uint8_t)0x00),\n    TIM5_UPDATESOURCE_REGULAR          =((uint8_t)0x01)\n}TIM5_UpdateSource_TypeDef;\n\n\n#define IS_TIM5_UPDATE_SOURCE_OK(SOURCE) (((SOURCE) == TIM5_UPDATESOURCE_GLOBAL) || \\\n                                       ((SOURCE) == TIM5_UPDATESOURCE_REGULAR))\n\n/**\n  * @brief  TIM5 Trigger Output Source\n  */\ntypedef enum\n{\n    TIM5_TRGOSOURCE_RESET   = ((uint8_t)0x00),   /*!< Trigger Output source = Reset*/\n    TIM5_TRGOSOURCE_ENABLE  = ((uint8_t)0x10),   /*!< Trigger Output source = TIM5 is enabled*/\n    TIM5_TRGOSOURCE_UPDATE  = ((uint8_t)0x20),   /*!< Trigger Output source = Update event*/\n    TIM5_TRGOSOURCE_OC1     = ((uint8_t)0x30),   /*!< Trigger Output source = output compare channel1  */\n    TIM5_TRGOSOURCE_OC1REF  = ((uint8_t)0x40),   /*!< Trigger Output source = output compare channel 1 reference */\n    TIM5_TRGOSOURCE_OC2REF  = ((uint8_t)0x50)    /*!< Trigger Output source = output compare channel 2 reference */\n}TIM5_TRGOSource_TypeDef;\n\n/**\n  * @brief  Macro TIM5 TRGO source\n  */\n#define IS_TIM5_TRGO_SOURCE_OK(SOURCE) \\\n   (((SOURCE) == TIM5_TRGOSOURCE_RESET)  || \\\n    ((SOURCE) == TIM5_TRGOSOURCE_ENABLE) || \\\n    ((SOURCE) == TIM5_TRGOSOURCE_UPDATE) || \\\n    ((SOURCE) == TIM5_TRGOSOURCE_OC1)    || \\\n    ((SOURCE) == TIM5_TRGOSOURCE_OC1REF) || \\\n    ((SOURCE) == TIM5_TRGOSOURCE_OC2REF))\n  \n/** TIM5 Flags */\ntypedef enum\n{\n    TIM5_FLAG_UPDATE                   =((uint16_t)0x0001),\n    TIM5_FLAG_CC1                      =((uint16_t)0x0002),\n    TIM5_FLAG_CC2                      =((uint16_t)0x0004),\n    TIM5_FLAG_CC3                      =((uint16_t)0x0008),\n    TIM5_FLAG_TRIGGER                  = ((uint16_t)0x0040),\n    TIM5_FLAG_CC1OF                    =((uint16_t)0x0200),\n    TIM5_FLAG_CC2OF                    =((uint16_t)0x0400),\n    TIM5_FLAG_CC3OF                    =((uint16_t)0x0800)\n}TIM5_FLAG_TypeDef;\n\n#define IS_TIM5_GET_FLAG_OK(FLAG) (((FLAG) == TIM5_FLAG_UPDATE) || \\\n                                ((FLAG) == TIM5_FLAG_CC1) || \\\n                                ((FLAG) == TIM5_FLAG_CC2) || \\\n                                ((FLAG) == TIM5_FLAG_CC3) || \\\n                                ((FLAG) == TIM5_FLAG_TRIGGER) || \\\n                                ((FLAG) == TIM5_FLAG_CC1OF) || \\\n                                ((FLAG) == TIM5_FLAG_CC2OF) || \\\n                                ((FLAG) == TIM5_FLAG_CC3OF))\n\n#define IS_TIM5_CLEAR_FLAG_OK(FLAG) ((((uint16_t)(FLAG) & 0xF1F0) == 0x0000) && ((uint16_t)(FLAG) != 0x0000))\n\n\n/**\n  * @brief  TIM5 Slave Mode\n  */\ntypedef enum\n{\n    TIM5_SLAVEMODE_RESET      = ((uint8_t)0x04),   /*!< Slave Mode Selection  = Reset*/\n    TIM5_SLAVEMODE_GATED      = ((uint8_t)0x05),   /*!< Slave Mode Selection  = Gated*/\n    TIM5_SLAVEMODE_TRIGGER    = ((uint8_t)0x06),   /*!< Slave Mode Selection  = Trigger*/\n    TIM5_SLAVEMODE_EXTERNAL1  = ((uint8_t)0x07)  /*!< Slave Mode Selection  = External 1*/\n}TIM5_SlaveMode_TypeDef;\n\n/**\n  * @brief  Macro TIM5 Slave mode\n  */\n#define IS_TIM5_SLAVE_MODE_OK(MODE) \\\n   (((MODE) == TIM5_SLAVEMODE_RESET)   || \\\n    ((MODE) == TIM5_SLAVEMODE_GATED)   || \\\n    ((MODE) == TIM5_SLAVEMODE_TRIGGER) || \\\n    ((MODE) == TIM5_SLAVEMODE_EXTERNAL1))\n    \n/**\n  * @brief  TIM5 Internal Trigger Selection\n  */\ntypedef enum\n{\n    TIM5_TS_TIM6  = ((uint8_t)0x00), /*!< TRIG Input source =  TIM6 TRIG Output  */\n    TIM5_TS_TIM1  = ((uint8_t)0x03) /*!< TRIG Input source =  TIM1 TRIG Output  */\n}TIM5_TS_TypeDef;\n\n/**\n  * @brief  Macro TIM5  Trigger Selection\n  */\n#define IS_TIM5_TRIGGER_SELECTION_OK(SELECTION) \\\n   (((SELECTION) == TIM5_TS_TIM6)  || \\\n    ((SELECTION) == TIM5_TS_TIM1)  )\n\n\n#define IS_TIM5_TIX_TRIGGER_SELECTION_OK(SELECTION) \\\n   (((SELECTION) == TIM5_TS_TI1F_ED) || \\\n    ((SELECTION) == TIM5_TS_TI1FP1)  || \\\n    ((SELECTION) == TIM5_TS_TI2FP2))\n\n\n/**\n  * @brief  TIM5 Encoder Mode\n  */\ntypedef enum\n{\n    TIM5_ENCODERMODE_TI1    = ((uint8_t)0x01),   /*!< Encoder mode 1*/\n    TIM5_ENCODERMODE_TI2    = ((uint8_t)0x02),   /*!< Encoder mode 2*/\n    TIM5_ENCODERMODE_TI12   = ((uint8_t)0x03)    /*!< Encoder mode 3*/\n}TIM5_EncoderMode_TypeDef;\n/**\n  * @brief  Macro TIM5 encoder mode\n  */\n#define IS_TIM5_ENCODER_MODE_OK(MODE) \\\n   (((MODE) == TIM5_ENCODERMODE_TI1) || \\\n    ((MODE) == TIM5_ENCODERMODE_TI2) || \\\n    ((MODE) == TIM5_ENCODERMODE_TI12))\n    \n/**\n  * @brief  TIM5 External Trigger Prescaler\n  */\ntypedef enum\n{\n    TIM5_EXTTRGPSC_OFF   = ((uint8_t)0x00),   /*!< No External Trigger prescaler  */\n    TIM5_EXTTRGPSC_DIV2  = ((uint8_t)0x10),   /*!< External Trigger prescaler = 2 (ETRP frequency divided by 2) */\n    TIM5_EXTTRGPSC_DIV4  = ((uint8_t)0x20),   /*!< External Trigger prescaler = 4 (ETRP frequency divided by 4) */\n    TIM5_EXTTRGPSC_DIV8  = ((uint8_t)0x30)    /*!< External Trigger prescaler = 8 (ETRP frequency divided by 8) */\n}TIM5_ExtTRGPSC_TypeDef;\n\n/**\n  * @brief  Macro TIM5 external trigger prescaler\n  */\n#define IS_TIM5_EXT_PRESCALER_OK(PRESCALER) \\\n   (((PRESCALER) == TIM5_EXTTRGPSC_OFF)  || \\\n    ((PRESCALER) == TIM5_EXTTRGPSC_DIV2) || \\\n    ((PRESCALER) == TIM5_EXTTRGPSC_DIV4) || \\\n    ((PRESCALER) == TIM5_EXTTRGPSC_DIV8))\n    \n/**\n  * @brief  TIM5 External Trigger Polarity\n  */\ntypedef enum\n{\n    TIM5_EXTTRGPOLARITY_INVERTED    = ((uint8_t)0x80),   /*!< External Trigger Polarity = inverted */\n    TIM5_EXTTRGPOLARITY_NONINVERTED  = ((uint8_t)0x00)    /*!< External Trigger Polarity = non inverted */\n}TIM5_ExtTRGPolarity_TypeDef;\n\n/**\n  * @brief  Macro TIM5  Trigger Polarity\n  */\n#define IS_TIM5_EXT_POLARITY_OK(POLARITY) \\\n   (((POLARITY) == TIM5_EXTTRGPOLARITY_INVERTED) || \\\n    ((POLARITY) == TIM5_EXTTRGPOLARITY_NONINVERTED))\n    \n/**\n  * @brief  Macro TIM5 External Trigger Filter\n  */\n#define IS_TIM5_EXT_FILTER_OK(EXTFILTER) ((EXTFILTER) <= 0x0F)\n/**\n  * @}\n  */\n\n/* Exported macro ------------------------------------------------------------*/\n\n/* Exported functions --------------------------------------------------------*/\n\n/** @addtogroup TIM5_Exported_Functions\n  * @{\n  */\n\nvoid TIM5_DeInit(void);\nvoid TIM5_TimeBaseInit(TIM5_Prescaler_TypeDef TIM5_Prescaler, uint16_t TIM5_Period);\nvoid TIM5_OC1Init(TIM5_OCMode_TypeDef TIM5_OCMode, TIM5_OutputState_TypeDef TIM5_OutputState,uint16_t TIM5_Pulse, TIM5_OCPolarity_TypeDef TIM5_OCPolarity);\nvoid TIM5_OC2Init(TIM5_OCMode_TypeDef TIM5_OCMode, TIM5_OutputState_TypeDef TIM5_OutputState,uint16_t TIM5_Pulse, TIM5_OCPolarity_TypeDef TIM5_OCPolarity);\nvoid TIM5_OC3Init(TIM5_OCMode_TypeDef TIM5_OCMode, TIM5_OutputState_TypeDef TIM5_OutputState,uint16_t TIM5_Pulse, TIM5_OCPolarity_TypeDef TIM5_OCPolarity);\nvoid TIM5_ICInit(TIM5_Channel_TypeDef TIM5_Channel, TIM5_ICPolarity_TypeDef TIM5_ICPolarity, TIM5_ICSelection_TypeDef TIM5_ICSelection,  TIM5_ICPSC_TypeDef TIM5_ICPrescaler, uint8_t TIM5_ICFilter);\nvoid TIM5_PWMIConfig(TIM5_Channel_TypeDef TIM5_Channel, TIM5_ICPolarity_TypeDef TIM5_ICPolarity, TIM5_ICSelection_TypeDef TIM5_ICSelection,  TIM5_ICPSC_TypeDef TIM5_ICPrescaler, uint8_t TIM5_ICFilter);\nvoid TIM5_Cmd(FunctionalState NewState);\nvoid TIM5_ITConfig(TIM5_IT_TypeDef TIM5_IT, FunctionalState NewState);\nvoid TIM5_InternalClockConfig(void);\nvoid TIM5_UpdateDisableConfig(FunctionalState NewState);\nvoid TIM5_UpdateRequestConfig(TIM5_UpdateSource_TypeDef TIM5_UpdateSource);\nvoid TIM5_SelectOnePulseMode(TIM5_OPMode_TypeDef TIM5_OPMode);\nvoid TIM5_PrescalerConfig(TIM5_Prescaler_TypeDef Prescaler, TIM5_PSCReloadMode_TypeDef TIM5_PSCReloadMode);\nvoid TIM5_SelectOutputTrigger(TIM5_TRGOSource_TypeDef TIM5_TRGOSource);\nvoid TIM5_ForcedOC1Config(TIM5_ForcedAction_TypeDef TIM5_ForcedAction);\nvoid TIM5_ForcedOC2Config(TIM5_ForcedAction_TypeDef TIM5_ForcedAction);\nvoid TIM5_ForcedOC3Config(TIM5_ForcedAction_TypeDef TIM5_ForcedAction);\nvoid TIM5_ARRPreloadConfig(FunctionalState NewState);\nvoid TIM5_CCPreloadControl(FunctionalState NewState);\nvoid TIM5_OC1PreloadConfig(FunctionalState NewState);\nvoid TIM5_OC2PreloadConfig(FunctionalState NewState);\nvoid TIM5_OC3PreloadConfig(FunctionalState NewState);\nvoid TIM5_GenerateEvent(TIM5_EventSource_TypeDef TIM5_EventSource);\nvoid TIM5_OC1PolarityConfig(TIM5_OCPolarity_TypeDef TIM5_OCPolarity);\nvoid TIM5_OC2PolarityConfig(TIM5_OCPolarity_TypeDef TIM5_OCPolarity);\nvoid TIM5_OC3PolarityConfig(TIM5_OCPolarity_TypeDef TIM5_OCPolarity);\nvoid TIM5_CCxCmd(TIM5_Channel_TypeDef TIM5_Channel, FunctionalState NewState);\nvoid TIM5_SelectOCxM(TIM5_Channel_TypeDef TIM5_Channel, TIM5_OCMode_TypeDef TIM5_OCMode);\nvoid TIM5_SetCounter(uint16_t Counter);\nvoid TIM5_SetAutoreload(uint16_t Autoreload);\nvoid TIM5_SetCompare1(uint16_t Compare1);\nvoid TIM5_SetCompare2(uint16_t Compare2);\nvoid TIM5_SetCompare3(uint16_t Compare3);\nvoid TIM5_SetIC1Prescaler(TIM5_ICPSC_TypeDef TIM5_IC1Prescaler);\nvoid TIM5_SetIC2Prescaler(TIM5_ICPSC_TypeDef TIM5_IC2Prescaler);\nvoid TIM5_SetIC3Prescaler(TIM5_ICPSC_TypeDef TIM5_IC3Prescaler);\nuint16_t TIM5_GetCapture1(void);\nuint16_t TIM5_GetCapture2(void);\nuint16_t TIM5_GetCapture3(void);\nuint16_t TIM5_GetCounter(void);\nTIM5_Prescaler_TypeDef TIM5_GetPrescaler(void);\nFlagStatus TIM5_GetFlagStatus(TIM5_FLAG_TypeDef TIM5_FLAG);\nvoid TIM5_ClearFlag(TIM5_FLAG_TypeDef TIM5_FLAG);\nITStatus TIM5_GetITStatus(TIM5_IT_TypeDef TIM5_IT);\nvoid TIM5_ClearITPendingBit(TIM5_IT_TypeDef TIM5_IT);\nvoid TIM5_SelectInputTrigger(TIM5_TS_TypeDef TIM5_InputTriggerSource);\nvoid TIM5_SelectSlaveMode(TIM5_SlaveMode_TypeDef TIM5_SlaveMode);\nvoid TIM5_EncoderInterfaceConfig(TIM5_EncoderMode_TypeDef TIM5_EncoderMode, TIM5_ICPolarity_TypeDef TIM5_IC1Polarity,TIM5_ICPolarity_TypeDef TIM5_IC2Polarity);\n\n\n/**\n  * @}\n  */\n\n#endif /* __STM8S_TIM5_H */\n\n/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\n"
  },
  {
    "path": "src/firmware/tsdz2/stm8s/stm8s_tim6.h",
    "content": "/**\n  ******************************************************************************\n  * @file    stm8s_tim6.h\n  * @author  MCD Application Team\n  * @version V2.3.0\n  * @date    16-June-2017\n  * @brief   This file contains all functions prototype and macros for the TIM6 peripheral.\n   ******************************************************************************\n  * @attention\n  *\n  * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>\n  *\n  * Licensed under MCD-ST Liberty SW License Agreement V2, (the \"License\");\n  * You may not use this file except in compliance with the License.\n  * You may obtain a copy of the License at:\n  *\n  *        http://www.st.com/software_license_agreement_liberty_v2\n  *\n  * Unless required by applicable law or agreed to in writing, software \n  * distributed under the License is distributed on an \"AS IS\" BASIS, \n  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  * See the License for the specific language governing permissions and\n  * limitations under the License.\n  *\n  ******************************************************************************\n  */\n\n/* Define to prevent recursive inclusion -------------------------------------*/\n#ifndef __STM8S_TIM6_H\n#define __STM8S_TIM6_H\n\n/* Includes ------------------------------------------------------------------*/\n#include \"stm8s.h\"\n\n/** @addtogroup STM8S_StdPeriph_Driver\n  * @{\n  */\n\n/* Exported variables ------------------------------------------------------- */\n/* Exported types ------------------------------------------------------------*/\n\n/** @addtogroup TIM6_Exported_Types\n  * @{\n  */\n\n\n/**\n  * @brief  TIM6 Prescaler\n  */\ntypedef enum\n{\n    TIM6_PRESCALER_1      = ((uint8_t)0x00),  /*!< Time base Prescaler = 1 (No effect)*/\n    TIM6_PRESCALER_2      = ((uint8_t)0x01),  /*!< Time base Prescaler = 2 */\n    TIM6_PRESCALER_4      = ((uint8_t)0x02),  /*!< Time base Prescaler = 4 */\n    TIM6_PRESCALER_8      = ((uint8_t)0x03),  /*!< Time base Prescaler = 8 */\n    TIM6_PRESCALER_16     = ((uint8_t)0x04),  /*!< Time base Prescaler = 16 */\n    TIM6_PRESCALER_32     = ((uint8_t)0x05),  /*!< Time base Prescaler = 32 */\n    TIM6_PRESCALER_64     = ((uint8_t)0x06),  /*!< Time base Prescaler = 64 */\n    TIM6_PRESCALER_128    = ((uint8_t)0x07)  /*!< Time base Prescaler = 128 */\n}TIM6_Prescaler_TypeDef;\n\n/**\n  * @brief  TIM6 One Pulse Mode\n  */\ntypedef enum\n{\n    TIM6_OPMODE_SINGLE      = ((uint8_t)0x01),  /*!< Single one Pulse mode (OPM Active) */\n    TIM6_OPMODE_REPETITIVE  = ((uint8_t)0x00)   /*!< Repetitive Pulse mode (OPM inactive) */\n}TIM6_OPMode_TypeDef;\n\n/**\n  * @brief  TIM6 Prescaler Reload Mode\n  */\ntypedef enum\n{\n    TIM6_PSCRELOADMODE_UPDATE      =((uint8_t)0x00),  /*!< Prescaler value is reloaded at every update*/\n    TIM6_PSCRELOADMODE_IMMEDIATE   =((uint8_t)0x01)    /*!< Prescaler value is reloaded immediately*/\n}TIM6_PSCReloadMode_TypeDef;\n\n/**\n  * @brief  TIM6 Update Source\n  */\ntypedef enum\n{\n    TIM6_UPDATESOURCE_GLOBAL   =((uint8_t)0x00),  /*!< Global Update request source */\n    TIM6_UPDATESOURCE_REGULAR  =((uint8_t)0x01)    /*!< Regular Update request source */\n}TIM6_UpdateSource_TypeDef;\n\n/**\n  * @brief  TIM6 Event Source\n  */\ntypedef enum\n{\n    TIM6_EVENTSOURCE_UPDATE    = ((uint8_t)0x01),    /*!< Update Event*/\n    TIM6_EVENTSOURCE_TRIGGER   = ((uint8_t)0x40)    /*!< Trigger Event*/\n}TIM6_EventSource_TypeDef;\n\n/**\n  * @brief  TIM6 Trigger Output Source\n  */\ntypedef enum\n{\n    TIM6_TRGOSOURCE_RESET    = ((uint8_t)0x00),    /*!< Trigger Output source = Reset*/\n    TIM6_TRGOSOURCE_ENABLE   = ((uint8_t)0x10),    /*!< Trigger Output source = TIM5 is enabled*/\n    TIM6_TRGOSOURCE_UPDATE   = ((uint8_t)0x20)    /*!< Trigger Output source = Update event*/\n}TIM6_TRGOSource_TypeDef;\n\n/**\n  * @brief  TIM6 Slave Mode\n  */\ntypedef enum\n{\n    TIM6_SLAVEMODE_DISABLE    = ((uint8_t)0x00),   /*!< Disable slave mode to clock the prescaler directly with the internal clock */\n    TIM6_SLAVEMODE_RESET      = ((uint8_t)0x04),   /*!< Slave Mode Selection  = Reset*/\n    TIM6_SLAVEMODE_GATED      = ((uint8_t)0x05),   /*!< Slave Mode Selection  = Gated*/\n    TIM6_SLAVEMODE_TRIGGER    = ((uint8_t)0x06),    /*!< Slave Mode Selection  = Trigger*/\n    TIM6_SLAVEMODE_EXTERNAL1  = ((uint8_t)0x07)    /*!< Slave Mode Selection  = External 1*/\n}TIM6_SlaveMode_TypeDef;\n\n/**\n  * @brief  TIM6 Flags\n  */\ntypedef enum\n{\n    TIM6_FLAG_UPDATE   = ((uint8_t)0x01),    /*!< Update Flag */\n    TIM6_FLAG_TRIGGER  = ((uint8_t)0x40)    /*!< Trigger Flag */\n}TIM6_FLAG_TypeDef;\n\n/**\n  * @brief  TIM6 interrupt sources\n  */\ntypedef enum\n{\n    TIM6_IT_UPDATE   = ((uint8_t)0x01),    /*!< Update Interrupt*/\n    TIM6_IT_TRIGGER  = ((uint8_t)0x40)    /*!< Trigger  Interrupt*/\n}TIM6_IT_TypeDef;\n\n/**\n  * @brief  TIM6 Internal Trigger Selection\n  */\ntypedef enum\n{\n    TIM6_TS_TIM1  = ((uint8_t)0x20),/*!< TRIG Input source =  TIM1 TRIG Output  */\n    TIM6_TS_TIM5  = ((uint8_t)0x30) /*!< TRIG Input source =  TIM5 TRIG Output  */\n}TIM6_TS_TypeDef;\n\n/**\n  * @}\n  */\n\n/* Exported constants --------------------------------------------------------*/\n/* Exported macros -----------------------------------------------------------*/\n/* Private macros ------------------------------------------------------------*/\n\n/** @addtogroup TIM6_Private_Macros\n  * @{\n  */\n\n/**\n  * @brief  Macro used by the assert function to check the different functions parameters.\n  */\n\n/**\n  * @brief  Macro TIM6 Prescaler\n  */\n#define IS_TIM6_PRESCALER_OK(PRESCALER)  \\\n   (((PRESCALER) == TIM6_PRESCALER_1)    || \\\n    ((PRESCALER) == TIM6_PRESCALER_2)    || \\\n    ((PRESCALER) == TIM6_PRESCALER_4)    || \\\n    ((PRESCALER) == TIM6_PRESCALER_8)    || \\\n    ((PRESCALER) == TIM6_PRESCALER_16)   || \\\n    ((PRESCALER) == TIM6_PRESCALER_32)   || \\\n    ((PRESCALER) == TIM6_PRESCALER_64)   || \\\n    ((PRESCALER) == TIM6_PRESCALER_128))\n/**\n  * @brief  Macro TIM6 One Pulse Mode\n  */\n#define IS_TIM6_OPM_MODE_OK(MODE)  \\\n   (((MODE) == TIM6_OPMODE_SINGLE) || \\\n    ((MODE) == TIM6_OPMODE_REPETITIVE))\n\n/**\n  * @brief  Macro TIM6 Prescaler reload\n  */\n#define IS_TIM6_PRESCALER_RELOAD_OK(RELOAD) \\\n   (((RELOAD) == TIM6_PSCRELOADMODE_UPDATE) || \\\n    ((RELOAD) == TIM6_PSCRELOADMODE_IMMEDIATE))\n/**\n  * @brief  Macro TIM6 Update source\n  */\n#define IS_TIM6_UPDATE_SOURCE_OK(SOURCE) \\\n   (((SOURCE) == TIM6_UPDATESOURCE_GLOBAL) || \\\n    ((SOURCE) == TIM6_UPDATESOURCE_REGULAR))\n/**\n  * @brief  Macro TIM6 Event source\n  */\n#define IS_TIM6_EVENT_SOURCE_OK(SOURCE) \\\n   ((((SOURCE) & (uint8_t)0xBE) == 0x00) && \\\n    ((SOURCE) != 0x00))\n\n/**\n  * @brief  Macro TIM6 TRGO source\n  */\n#define IS_TIM6_TRGO_SOURCE_OK(SOURCE) \\\n   (((SOURCE) == TIM6_TRGOSOURCE_RESET) || \\\n    ((SOURCE) == TIM6_TRGOSOURCE_ENABLE)|| \\\n    ((SOURCE) == TIM6_TRGOSOURCE_UPDATE))\n/**\n  * @brief  Macro TIM6 Slave mode\n  */\n#define IS_TIM6_SLAVE_MODE_OK(MODE) \\\n   (((MODE) == TIM6_SLAVEMODE_DISABLE) || \\\n    ((MODE) == TIM6_SLAVEMODE_RESET)   || \\\n    ((MODE) == TIM6_SLAVEMODE_GATED)   || \\\n    ((MODE) == TIM6_SLAVEMODE_TRIGGER) || \\\n    ((MODE) == TIM6_SLAVEMODE_EXTERNAL1))\n/**\n  * @brief  Macro TIM6 Flags\n  */\n#define IS_TIM6_GET_FLAG_OK(FLAG) \\\n   (((FLAG) == TIM6_FLAG_UPDATE) || \\\n    ((FLAG) == TIM6_FLAG_TRIGGER))\n\n#define IS_TIM6_CLEAR_FLAG_OK(FLAG) \\\n   ((((FLAG) & (uint8_t)0xBE) == 0x00) && ((FLAG) != 0x00))\n/**\n  * @brief  Macro TIM6 interrupts\n  */\n#define IS_TIM6_IT_OK(IT) \\\n   (((IT) != 0x00) && \\\n    (((IT) & (uint8_t)(~(uint8_t)(0x41)))== 0x00))\n\n#define IS_TIM6_GET_IT_OK(IT) \\\n   (((IT) == TIM6_IT_UPDATE) || \\\n    ((IT) == TIM6_IT_TRIGGER))\n/**\n  * @brief  Macro TIM6 Trigger selection\n  */\n#define IS_TIM6_TRIGGER_SELECTION_OK(SELECTION) \\\n   (((SELECTION) == TIM6_TS_TIM5) || \\\n    ((SELECTION) == TIM6_TS_TIM1))\n/**\n * @}\n */\n\n/* Exported functions --------------------------------------------------------*/\n\n/** @addtogroup TIM6_Exported_Functions\n  * @{\n  */\n\nvoid TIM6_DeInit(void);\nvoid TIM6_TimeBaseInit(TIM6_Prescaler_TypeDef TIM6_Prescaler, uint8_t TIM6_Period);\nvoid TIM6_Cmd(FunctionalState NewState);\nvoid TIM6_UpdateDisableConfig(FunctionalState NewState);\nvoid TIM6_UpdateRequestConfig(TIM6_UpdateSource_TypeDef TIM6_UpdateSource);\nvoid TIM6_SelectOnePulseMode(TIM6_OPMode_TypeDef TIM6_OPMode);\nvoid TIM6_PrescalerConfig(TIM6_Prescaler_TypeDef Prescaler, TIM6_PSCReloadMode_TypeDef TIM6_PSCReloadMode);\nvoid TIM6_ARRPreloadConfig(FunctionalState NewState);\nvoid TIM6_SetCounter(uint8_t Counter);\nvoid TIM6_SetAutoreload(uint8_t Autoreload);\nuint8_t TIM6_GetCounter(void);\nTIM6_Prescaler_TypeDef TIM6_GetPrescaler(void);\nvoid TIM6_ITConfig(TIM6_IT_TypeDef TIM6_IT, FunctionalState NewState);\nvoid TIM6_ClearFlag(TIM6_FLAG_TypeDef TIM6_FLAG);\nITStatus TIM6_GetITStatus(TIM6_IT_TypeDef TIM6_IT);\nvoid TIM6_GenerateEvent(TIM6_EventSource_TypeDef TIM6_EventSource);\nFlagStatus TIM6_GetFlagStatus(TIM6_FLAG_TypeDef TIM6_FLAG);\nvoid TIM6_ClearITPendingBit(TIM6_IT_TypeDef TIM6_IT);\nvoid TIM6_SelectOutputTrigger(TIM6_TRGOSource_TypeDef TIM6_TRGOSource);\nvoid TIM6_SelectMasterSlaveMode(FunctionalState NewState);\nvoid TIM6_SelectInputTrigger(TIM6_TS_TypeDef TIM6_InputTriggerSource);\nvoid TIM6_InternalClockConfig(void);\nvoid TIM6_SelectSlaveMode(TIM6_SlaveMode_TypeDef TIM6_SlaveMode);\n\n/**\n * @}\n */\n\n#endif /* __STM8S_TIM6_H */\n\n/**\n  * @}\n  */\n  \n\n/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\n"
  },
  {
    "path": "src/firmware/tsdz2/stm8s/stm8s_uart1.h",
    "content": "/**\n  ********************************************************************************\n  * @file    stm8s_uart1.h\n  * @author  MCD Application Team\n  * @version V2.3.0\n  * @date    16-June-2017\n  * @brief   This file contains all functions prototypes and macros for the UART1 peripheral.\n   ******************************************************************************\n  * @attention\n  *\n  * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>\n  *\n  * Licensed under MCD-ST Liberty SW License Agreement V2, (the \"License\");\n  * You may not use this file except in compliance with the License.\n  * You may obtain a copy of the License at:\n  *\n  *        http://www.st.com/software_license_agreement_liberty_v2\n  *\n  * Unless required by applicable law or agreed to in writing, software \n  * distributed under the License is distributed on an \"AS IS\" BASIS, \n  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  * See the License for the specific language governing permissions and\n  * limitations under the License.\n  *\n  ******************************************************************************\n  */\n\n/* Define to prevent recursive inclusion -------------------------------------*/\n#ifndef __STM8S_UART1_H\n#define __STM8S_UART1_H\n\n/* Includes ------------------------------------------------------------------*/\n#include \"stm8s.h\"\n\n/** @addtogroup STM8S_StdPeriph_Driver\n  * @{\n  */\n\n/* Exported types ------------------------------------------------------------*/\n\n/** @addtogroup UART1_Exported_Types\n  * @{\n  */\n\n\n/**\n  * @brief  UART1 Irda Modes\n  */\n\ntypedef enum { UART1_IRDAMODE_NORMAL    = (uint8_t)0x00, /**< 0x00 Irda Normal Mode   */\n               UART1_IRDAMODE_LOWPOWER  = (uint8_t)0x01  /**< 0x01 Irda Low Power Mode */\n             } UART1_IrDAMode_TypeDef;\n\n/**\n  * @brief  UART1 WakeUP Modes\n  */\ntypedef enum { UART1_WAKEUP_IDLELINE       = (uint8_t)0x00, /**< 0x01 Idle Line wake up                */\n               UART1_WAKEUP_ADDRESSMARK    = (uint8_t)0x08  /**< 0x02 Address Mark wake up          */\n             } UART1_WakeUp_TypeDef;\n\n/**\n  * @brief  UART1 LIN Break detection length possible values\n  */\ntypedef enum { UART1_LINBREAKDETECTIONLENGTH_10BITS = (uint8_t)0x00, /**< 0x01 10 bits Lin Break detection            */\n               UART1_LINBREAKDETECTIONLENGTH_11BITS = (uint8_t)0x01  /**< 0x02 11 bits Lin Break detection          */\n             } UART1_LINBreakDetectionLength_TypeDef;\n\n/**\n  * @brief  UART1 stop bits possible values\n  */\n\ntypedef enum { UART1_STOPBITS_1   = (uint8_t)0x00,    /**< One stop bit is  transmitted at the end of frame*/\n               UART1_STOPBITS_0_5 = (uint8_t)0x10,    /**< Half stop bits is transmitted at the end of frame*/\n               UART1_STOPBITS_2   = (uint8_t)0x20,    /**< Two stop bits are  transmitted at the end of frame*/\n               UART1_STOPBITS_1_5 = (uint8_t)0x30     /**< One and half stop bits*/\n             } UART1_StopBits_TypeDef;\n\n/**\n  * @brief  UART1 parity possible values\n  */\ntypedef enum { UART1_PARITY_NO     = (uint8_t)0x00,      /**< No Parity*/\n               UART1_PARITY_EVEN   = (uint8_t)0x04,      /**< Even Parity*/\n               UART1_PARITY_ODD    = (uint8_t)0x06       /**< Odd Parity*/\n             } UART1_Parity_TypeDef;\n\n/**\n  * @brief  UART1 Synchrone modes\n  */\ntypedef enum { UART1_SYNCMODE_CLOCK_DISABLE    = (uint8_t)0x80, /**< 0x80 Sync mode Disable, SLK pin Disable */\n               UART1_SYNCMODE_CLOCK_ENABLE     = (uint8_t)0x08, /**< 0x08 Sync mode Enable, SLK pin Enable     */\n               UART1_SYNCMODE_CPOL_LOW         = (uint8_t)0x40, /**< 0x40 Steady low value on SCLK pin outside transmission window */\n               UART1_SYNCMODE_CPOL_HIGH        = (uint8_t)0x04, /**< 0x04 Steady high value on SCLK pin outside transmission window */\n               UART1_SYNCMODE_CPHA_MIDDLE      = (uint8_t)0x20, /**< 0x20 SCLK clock line activated in middle of data bit     */\n               UART1_SYNCMODE_CPHA_BEGINING    = (uint8_t)0x02, /**< 0x02 SCLK clock line activated at beginning of data bit  */\n               UART1_SYNCMODE_LASTBIT_DISABLE  = (uint8_t)0x10, /**< 0x10 The clock pulse of the last data bit is not output to the SCLK pin */\n               UART1_SYNCMODE_LASTBIT_ENABLE   = (uint8_t)0x01  /**< 0x01 The clock pulse of the last data bit is output to the SCLK pin */\n             } UART1_SyncMode_TypeDef;\n\n/**\n  * @brief  UART1 Word length possible values\n  */\ntypedef enum { UART1_WORDLENGTH_8D = (uint8_t)0x00,/**< 0x00 8 bits Data  */\n               UART1_WORDLENGTH_9D = (uint8_t)0x10 /**< 0x10 9 bits Data  */\n             } UART1_WordLength_TypeDef;\n\n/**\n  * @brief  UART1 Mode possible values\n  */\ntypedef enum { UART1_MODE_RX_ENABLE     = (uint8_t)0x08,  /**< 0x08 Receive Enable */\n               UART1_MODE_TX_ENABLE     = (uint8_t)0x04,  /**< 0x04 Transmit Enable */\n               UART1_MODE_TX_DISABLE    = (uint8_t)0x80,  /**< 0x80 Transmit Disable */\n               UART1_MODE_RX_DISABLE    = (uint8_t)0x40,  /**< 0x40 Single-wire Half-duplex mode */\n               UART1_MODE_TXRX_ENABLE   = (uint8_t)0x0C  /**< 0x0C Transmit Enable and Receive Enable */\n             } UART1_Mode_TypeDef;\n\n/**\n  * @brief  UART1 Flag possible values\n  */\ntypedef enum { UART1_FLAG_TXE   = (uint16_t)0x0080, /*!< Transmit Data Register Empty flag */\n               UART1_FLAG_TC    = (uint16_t)0x0040, /*!< Transmission Complete flag */\n               UART1_FLAG_RXNE  = (uint16_t)0x0020, /*!< Read Data Register Not Empty flag */\n               UART1_FLAG_IDLE  = (uint16_t)0x0010, /*!< Idle line detected flag */\n               UART1_FLAG_OR    = (uint16_t)0x0008, /*!< OverRun error flag */\n               UART1_FLAG_NF    = (uint16_t)0x0004, /*!< Noise error flag */\n               UART1_FLAG_FE    = (uint16_t)0x0002, /*!< Framing Error flag */\n               UART1_FLAG_PE    = (uint16_t)0x0001, /*!< Parity Error flag */\n               UART1_FLAG_LBDF  = (uint16_t)0x0210, /*!< Line Break Detection Flag */\n               UART1_FLAG_SBK   = (uint16_t)0x0101  /*!< Send Break characters Flag */\n             } UART1_Flag_TypeDef;\n\n/**\n  * @brief  UART1 Interrupt definition\n  * UART1_IT possible values\n  * Elements values convention: 0xZYX\n  * X: Position of the corresponding Interrupt\n  *   - For the following values, X means the interrupt position in the CR2 register.\n  *     UART1_IT_TXE\n  *     UART1_IT_TC\n  *     UART1_IT_RXNE\n  *     UART1_IT_IDLE \n  *     UART1_IT_OR \n  *   - For the UART1_IT_PE value, X means the flag position in the CR1 register.\n  *   - For the UART1_IT_LBDF value, X means the flag position in the CR4 register.\n  * Y: Flag position\n  *  - For the following values, Y means the flag (pending bit) position in the SR register.\n  *     UART1_IT_TXE\n  *     UART1_IT_TC\n  *     UART1_IT_RXNE\n  *     UART1_IT_IDLE \n  *     UART1_IT_OR\n  *     UART1_IT_PE\n  *  - For the UART1_IT_LBDF value, Y means the flag position in the CR4 register.\n  * Z: Register index: indicate in which register the dedicated interrupt source is:\n  *  - 1==> CR1 register\n  *  - 2==> CR2 register\n  *  - 3==> CR4 register\n  */\ntypedef enum { UART1_IT_TXE        = (uint16_t)0x0277, /*!< Transmit interrupt */\n               UART1_IT_TC         = (uint16_t)0x0266, /*!< Transmission Complete interrupt */\n               UART1_IT_RXNE       = (uint16_t)0x0255, /*!< Receive interrupt */\n               UART1_IT_IDLE       = (uint16_t)0x0244, /*!< IDLE line interrupt */\n               UART1_IT_OR         = (uint16_t)0x0235, /*!< Overrun Error interrupt */\n               UART1_IT_PE         = (uint16_t)0x0100, /*!< Parity Error interrupt */\n               UART1_IT_LBDF       = (uint16_t)0x0346, /**< LIN break detection interrupt */\n               UART1_IT_RXNE_OR    = (uint16_t)0x0205  /*!< Receive/Overrun interrupt */\n             } UART1_IT_TypeDef;\n\n/**\n  * @}\n  */\n\n/* Exported constants --------------------------------------------------------*/\n/* Exported macros ------------------------------------------------------------*/\n\n/* Private macros ------------------------------------------------------------*/\n\n/** @addtogroup UART1_Private_Macros\n  * @{\n  */\n\n/**\n  * @brief  Macro used by the assert function to check the different functions parameters.\n  */\n\n/**\n * @brief Macro used by the assert_param function in order to check the different\n *        sensitivity values for the MODEs possible combination should be one of\n *        the following\n */\n#define IS_UART1_MODE_OK(Mode) \\\n  (((Mode) == (uint8_t)UART1_MODE_RX_ENABLE) || \\\n   ((Mode) == (uint8_t)UART1_MODE_RX_DISABLE) || \\\n   ((Mode) == (uint8_t)UART1_MODE_TX_ENABLE) || \\\n   ((Mode) == (uint8_t)UART1_MODE_TX_DISABLE) || \\\n   ((Mode) == (uint8_t)UART1_MODE_TXRX_ENABLE) || \\\n   ((Mode) == (uint8_t)((uint8_t)UART1_MODE_TX_ENABLE|(uint8_t)UART1_MODE_RX_ENABLE)) || \\\n   ((Mode) == (uint8_t)((uint8_t)UART1_MODE_TX_ENABLE|(uint8_t)UART1_MODE_RX_DISABLE)) || \\\n   ((Mode) == (uint8_t)((uint8_t)UART1_MODE_TX_DISABLE|(uint8_t)UART1_MODE_RX_DISABLE)) || \\\n   ((Mode) == (uint8_t)((uint8_t)UART1_MODE_TX_DISABLE|(uint8_t)UART1_MODE_RX_ENABLE)))\n\n/**\n * @brief Macro used by the assert_param function in order to check the different\n *        sensitivity values for the WordLengths\n */\n#define IS_UART1_WORDLENGTH_OK(WordLength) \\\n  (((WordLength) == UART1_WORDLENGTH_8D) || \\\n   ((WordLength) == UART1_WORDLENGTH_9D))\n\n/**\n  * @brief  Macro used by the assert_param function in order to check the different\n  *         sensitivity values for the SyncModes; it should exclude values such \n  *         as  UART1_CLOCK_ENABLE|UART1_CLOCK_DISABLE\n  */\n#define IS_UART1_SYNCMODE_OK(SyncMode) \\\n  (!((((SyncMode)&(((uint8_t)UART1_SYNCMODE_CLOCK_ENABLE)|((uint8_t)UART1_SYNCMODE_CLOCK_DISABLE))) == (((uint8_t)UART1_SYNCMODE_CLOCK_ENABLE)|((uint8_t)UART1_SYNCMODE_CLOCK_DISABLE))) \\\n    || (((SyncMode)&(((uint8_t)UART1_SYNCMODE_CPOL_LOW )|((uint8_t)UART1_SYNCMODE_CPOL_HIGH))) == (((uint8_t)UART1_SYNCMODE_CPOL_LOW )|((uint8_t)UART1_SYNCMODE_CPOL_HIGH))) \\\n    ||(((SyncMode)&(((uint8_t)UART1_SYNCMODE_CPHA_MIDDLE)|((uint8_t)UART1_SYNCMODE_CPHA_BEGINING))) ==  (((uint8_t)UART1_SYNCMODE_CPHA_MIDDLE)|((uint8_t)UART1_SYNCMODE_CPHA_BEGINING))) \\\n    || (((SyncMode)&(((uint8_t)UART1_SYNCMODE_LASTBIT_DISABLE)|((uint8_t)UART1_SYNCMODE_LASTBIT_ENABLE))) == (((uint8_t)UART1_SYNCMODE_LASTBIT_DISABLE)|((uint8_t)UART1_SYNCMODE_LASTBIT_ENABLE)))))\n\n/**\n  * @brief  Macro used by the assert_param function in order to check the different\n  *         sensitivity values for the FLAGs\n  */\n#define IS_UART1_FLAG_OK(Flag) \\\n  (((Flag) == UART1_FLAG_TXE) || \\\n   ((Flag) == UART1_FLAG_TC)  || \\\n   ((Flag) == UART1_FLAG_RXNE) || \\\n   ((Flag) == UART1_FLAG_IDLE) || \\\n   ((Flag) == UART1_FLAG_OR) || \\\n   ((Flag) == UART1_FLAG_NF) || \\\n   ((Flag) == UART1_FLAG_FE) || \\\n   ((Flag) == UART1_FLAG_PE) || \\\n   ((Flag) == UART1_FLAG_SBK) || \\\n   ((Flag) == UART1_FLAG_LBDF))\n/**\n  * @brief  Macro used by the assert_param function in order to check the different\n  *         sensitivity values for the FLAGs that can be cleared by writing 0\n  */\n#define IS_UART1_CLEAR_FLAG_OK(Flag) \\\n  (((Flag) == UART1_FLAG_RXNE) || \\\n   ((Flag) == UART1_FLAG_LBDF))\n\n\n\n/**\n  * @brief  Macro used by the assert_param function in order to check the different \n  *         sensitivity values for the Interrupts\n  */\n\n#define IS_UART1_CONFIG_IT_OK(Interrupt) \\\n  (((Interrupt) == UART1_IT_PE) || \\\n   ((Interrupt) == UART1_IT_TXE) || \\\n   ((Interrupt) == UART1_IT_TC) || \\\n   ((Interrupt) == UART1_IT_RXNE_OR ) || \\\n   ((Interrupt) == UART1_IT_IDLE) || \\\n   ((Interrupt) == UART1_IT_LBDF))\n\n/**\n  * @brief  Macro used by the assert function in order to check the different \n  *         sensitivity values for the pending bit\n  */\n#define IS_UART1_GET_IT_OK(ITPendingBit) \\\n  (((ITPendingBit) == UART1_IT_TXE)  || \\\n   ((ITPendingBit) == UART1_IT_TC)   || \\\n   ((ITPendingBit) == UART1_IT_RXNE) || \\\n   ((ITPendingBit) == UART1_IT_IDLE) || \\\n   ((ITPendingBit) == UART1_IT_OR)  || \\\n   ((ITPendingBit) == UART1_IT_LBDF)  || \\\n   ((ITPendingBit) == UART1_IT_PE))\n\n/**\n  * @brief  Macro used by the assert function in order to check the different \n  *         sensitivity values for the pending bit that can be cleared by writing 0\n  */\n#define IS_UART1_CLEAR_IT_OK(ITPendingBit) \\\n  (((ITPendingBit) == UART1_IT_RXNE) || \\\n   ((ITPendingBit) == UART1_IT_LBDF))\n\n\n/**\n * @brief Macro used by the assert_param function in order to check the different\n *        sensitivity values for the IrDAModes\n */\n#define IS_UART1_IRDAMODE_OK(IrDAMode) \\\n  (((IrDAMode) == UART1_IRDAMODE_LOWPOWER) || \\\n   ((IrDAMode) == UART1_IRDAMODE_NORMAL))\n\n/**\n  * @brief  Macro used by the assert_param function in order to check the different\n  *         sensitivity values for the WakeUps\n  */\n#define IS_UART1_WAKEUP_OK(WakeUp) \\\n  (((WakeUp) == UART1_WAKEUP_IDLELINE) || \\\n   ((WakeUp) == UART1_WAKEUP_ADDRESSMARK))\n\n/**\n  * @brief  Macro used by the assert_param function in order to check the different \n  *        sensitivity values for the LINBreakDetectionLengths\n  */\n#define IS_UART1_LINBREAKDETECTIONLENGTH_OK(LINBreakDetectionLength) \\\n  (((LINBreakDetectionLength) == UART1_LINBREAKDETECTIONLENGTH_10BITS) || \\\n   ((LINBreakDetectionLength) == UART1_LINBREAKDETECTIONLENGTH_11BITS))\n\n/**\n  * @brief  Macro used by the assert_param function in order to check the different\n  *         sensitivity values for the UART1_StopBits\n  */\n#define IS_UART1_STOPBITS_OK(StopBit) (((StopBit) == UART1_STOPBITS_1) || \\\n                                       ((StopBit) == UART1_STOPBITS_0_5) || \\\n                                       ((StopBit) == UART1_STOPBITS_2) || \\\n                                       ((StopBit) == UART1_STOPBITS_1_5 ))\n\n/**\n * @brief Macro used by the assert_param function in order to check the different\n *        sensitivity values for the Parity\n */\n#define IS_UART1_PARITY_OK(Parity) (((Parity) == UART1_PARITY_NO) || \\\n                                    ((Parity) == UART1_PARITY_EVEN) || \\\n                                    ((Parity) == UART1_PARITY_ODD ))\n\n/**\n * @brief Macro used by the assert_param function in order to check the maximum\n *        baudrate value\n */\n#define IS_UART1_BAUDRATE_OK(NUM) ((NUM) <= (uint32_t)625000)\n\n\n/**\n * @brief Macro used by the assert_param function in order to check the address\n *        of the UART1 or UART node\n */\n#define UART1_ADDRESS_MAX ((uint8_t)16)\n#define IS_UART1_ADDRESS_OK(node) ((node) < UART1_ADDRESS_MAX )\n\n/**\n  * @}\n  */\n\n/* Exported functions ------------------------------------------------------- */\n\n/** @addtogroup UART1_Exported_Functions\n  * @{\n  */\n\nvoid UART1_DeInit(void);\nvoid UART1_Init(uint32_t BaudRate, UART1_WordLength_TypeDef WordLength, \n                UART1_StopBits_TypeDef StopBits, UART1_Parity_TypeDef Parity, \n                UART1_SyncMode_TypeDef SyncMode, UART1_Mode_TypeDef Mode);\nvoid UART1_Cmd(FunctionalState NewState);\nvoid UART1_ITConfig(UART1_IT_TypeDef UART1_IT, FunctionalState NewState);\nvoid UART1_HalfDuplexCmd(FunctionalState NewState);\nvoid UART1_IrDAConfig(UART1_IrDAMode_TypeDef UART1_IrDAMode);\nvoid UART1_IrDACmd(FunctionalState NewState);\nvoid UART1_LINBreakDetectionConfig(UART1_LINBreakDetectionLength_TypeDef UART1_LINBreakDetectionLength);\nvoid UART1_LINCmd(FunctionalState NewState);\nvoid UART1_SmartCardCmd(FunctionalState NewState);\nvoid UART1_SmartCardNACKCmd(FunctionalState NewState);\nvoid UART1_WakeUpConfig(UART1_WakeUp_TypeDef UART1_WakeUp);\nvoid UART1_ReceiverWakeUpCmd(FunctionalState NewState);\nuint8_t UART1_ReceiveData8(void);\nuint16_t UART1_ReceiveData9(void);\nvoid UART1_SendData8(uint8_t Data);\nvoid UART1_SendData9(uint16_t Data);\nvoid UART1_SendBreak(void);\nvoid UART1_SetAddress(uint8_t UART1_Address);\nvoid UART1_SetGuardTime(uint8_t UART1_GuardTime);\nvoid UART1_SetPrescaler(uint8_t UART1_Prescaler);\nFlagStatus UART1_GetFlagStatus(UART1_Flag_TypeDef UART1_FLAG);\nvoid UART1_ClearFlag(UART1_Flag_TypeDef UART1_FLAG);\nITStatus UART1_GetITStatus(UART1_IT_TypeDef UART1_IT);\nvoid UART1_ClearITPendingBit(UART1_IT_TypeDef UART1_IT);\n\n/**\n  * @}\n  */\n\n#endif /* __STM8S_UART1_H */\n\n/**\n  * @}\n  */\n\n/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\n"
  },
  {
    "path": "src/firmware/tsdz2/stm8s/stm8s_uart2.h",
    "content": "/**\n  ********************************************************************************\n  * @file    stm8s_uart2.h\n  * @author  MCD Application Team\n  * @version V2.3.0\n  * @date    16-June-2017\n  * @brief   This file contains all functions prototypes and macros for the UART2 peripheral.\n   ******************************************************************************\n  * @attention\n  *\n  * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>\n  *\n  * Licensed under MCD-ST Liberty SW License Agreement V2, (the \"License\");\n  * You may not use this file except in compliance with the License.\n  * You may obtain a copy of the License at:\n  *\n  *        http://www.st.com/software_license_agreement_liberty_v2\n  *\n  * Unless required by applicable law or agreed to in writing, software \n  * distributed under the License is distributed on an \"AS IS\" BASIS, \n  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  * See the License for the specific language governing permissions and\n  * limitations under the License.\n  *\n  ******************************************************************************\n  */\n\n/* Define to prevent recursive inclusion -------------------------------------*/\n#ifndef __STM8S_UART2_H\n#define __STM8S_UART2_H\n\n/* Includes ------------------------------------------------------------------*/\n#include \"stm8s.h\"\n\n/** @addtogroup STM8S_StdPeriph_Driver\n  * @{\n  */\n\n/* Exported types ------------------------------------------------------------*/\n\n/** @addtogroup UART2_Exported_Types\n  * @{\n  */\n\n/**\n  * @brief  UART2 Irda Modes\n  */\n\ntypedef enum { UART2_IRDAMODE_NORMAL     = (uint8_t)0x00, /**< 0x00 Irda Normal Mode   */\n               UART2_IRDAMODE_LOWPOWER   = (uint8_t)0x01  /**< 0x01 Irda Low Power Mode */\n\n             } UART2_IrDAMode_TypeDef;\n\n/**\n  * @brief  UART2 WakeUP Modes\n  */\n\ntypedef enum { UART2_WAKEUP_IDLELINE       = (uint8_t)0x00, /**< 0x01 Idle Line wake up */\n               UART2_WAKEUP_ADDRESSMARK    = (uint8_t)0x08  /**< 0x02 Address Mark wake up */\n             } UART2_WakeUp_TypeDef;\n\n\n/**\n  * @brief  UART2 LIN Break detection length possible values\n  */\ntypedef enum { UART2_LINBREAKDETECTIONLENGTH_10BITS = (uint8_t)0x00, /**< 0x01 10 bits Lin Break detection */\n               UART2_LINBREAKDETECTIONLENGTH_11BITS = (uint8_t)0x01  /**< 0x02 11 bits Lin Break detection */\n             } UART2_LINBreakDetectionLength_TypeDef;\n\n/**\n  * @brief  UART2 stop bits possible values\n  */\n\ntypedef enum { UART2_STOPBITS_1   = (uint8_t)0x00,    /**< One stop bit is  transmitted at the end of frame*/\n               UART2_STOPBITS_0_5 = (uint8_t)0x10,    /**< Half stop bits is transmitted at the end of frame*/\n               UART2_STOPBITS_2   = (uint8_t)0x20,    /**< Two stop bits are  transmitted at the end of frame*/\n               UART2_STOPBITS_1_5 = (uint8_t)0x30     /**< One and half stop bits*/\n             } UART2_StopBits_TypeDef;\n\n\n/**\n  * @brief  UART2 parity possible values\n  */\ntypedef enum { UART2_PARITY_NO     = (uint8_t)0x00,      /**< No Parity*/\n               UART2_PARITY_EVEN   = (uint8_t)0x04,      /**< Even Parity*/\n               UART2_PARITY_ODD    = (uint8_t)0x06       /**< Odd Parity*/\n             } UART2_Parity_TypeDef;\n/**\n  * @brief  UART2 Mode possible values\n  */\ntypedef enum { UART2_LIN_MODE_MASTER  = (uint8_t)0x00, /**<  LIN Master Mode*/\n               UART2_LIN_MODE_SLAVE   = (uint8_t)0x01  /**<  LIN Slave Mode*/\n             } UART2_LinMode_TypeDef;\n/**\n  * @brief  UART2 automatic resynchronisation possible values\n  */\ntypedef enum { UART2_LIN_AUTOSYNC_DISABLE   = (uint8_t)0x00,  /**< LIN Autosynchronization Disable*/\n               UART2_LIN_AUTOSYNC_ENABLE    = (uint8_t)0x01   /**< LIN Autosynchronization Enable*/\n             } UART2_LinAutosync_TypeDef;\n/**\n  * @brief  UART2 Divider Update Method possible values\n  */\ntypedef enum { UART2_LIN_DIVUP_LBRR1    = (uint8_t)0x00, /**<  LIN LDIV is updated as soon as LBRR1 is written*/\n               UART2_LIN_DIVUP_NEXTRXNE = (uint8_t)0x01  /**<  LIN LDIV is updated at the next received character*/\n             } UART2_LinDivUp_TypeDef;\n\n/**\n  * @brief  UART2 Synchrone modes\n  */\ntypedef enum { UART2_SYNCMODE_CLOCK_DISABLE    = (uint8_t)0x80, /**< 0x80 Sync mode Disable, SLK pin Disable */\n               UART2_SYNCMODE_CLOCK_ENABLE     = (uint8_t)0x08, /**< 0x08 Sync mode Enable, SLK pin Enable     */\n               UART2_SYNCMODE_CPOL_LOW         = (uint8_t)0x40, /**< 0x40 Steady low value on SCLK pin outside transmission window */\n               UART2_SYNCMODE_CPOL_HIGH        = (uint8_t)0x04, /**< 0x04 Steady high value on SCLK pin outside transmission window */\n               UART2_SYNCMODE_CPHA_MIDDLE      = (uint8_t)0x20, /**< 0x20 SCLK clock line activated in middle of data bit     */\n               UART2_SYNCMODE_CPHA_BEGINING    = (uint8_t)0x02, /**< 0x02 SCLK clock line activated at beginning of data bit  */\n               UART2_SYNCMODE_LASTBIT_DISABLE  = (uint8_t)0x10, /**< 0x10 The clock pulse of the last data bit is not output to the SCLK pin */\n               UART2_SYNCMODE_LASTBIT_ENABLE   = (uint8_t)0x01  /**< 0x01 The clock pulse of the last data bit is output to the SCLK pin */\n             } UART2_SyncMode_TypeDef;\n\n/**\n  * @brief  UART2 Word length possible values\n  */\ntypedef enum { UART2_WORDLENGTH_8D = (uint8_t)0x00,/**< 0x00 8 bits Data  */\n               UART2_WORDLENGTH_9D = (uint8_t)0x10 /**< 0x10 9 bits Data  */\n             } UART2_WordLength_TypeDef;\n\n/**\n  * @brief  UART2 Mode possible values\n  */\ntypedef enum { UART2_MODE_RX_ENABLE     = (uint8_t)0x08,  /**< 0x08 Receive Enable */\n               UART2_MODE_TX_ENABLE     = (uint8_t)0x04,  /**< 0x04 Transmit Enable */\n               UART2_MODE_TX_DISABLE    = (uint8_t)0x80,  /**< 0x80 Transmit Disable */\n               UART2_MODE_RX_DISABLE    = (uint8_t)0x40,  /**< 0x40 Single-wire Half-duplex mode */\n               UART2_MODE_TXRX_ENABLE   = (uint8_t)0x0C  /**< 0x0C Transmit Enable and Receive Enable */\n             } UART2_Mode_TypeDef;\n/**\n  * @brief  UART2 Flag possible values\n  */\ntypedef enum\n{\n  UART2_FLAG_TXE          = (uint16_t)0x0080, /*!< Transmit Data Register Empty flag */\n  UART2_FLAG_TC           = (uint16_t)0x0040, /*!< Transmission Complete flag */\n  UART2_FLAG_RXNE         = (uint16_t)0x0020, /*!< Read Data Register Not Empty flag */\n  UART2_FLAG_IDLE         = (uint16_t)0x0010, /*!< Idle line detected flag */\n  UART2_FLAG_OR_LHE       = (uint16_t)0x0008, /*!< OverRun error flag */\n  UART2_FLAG_NF           = (uint16_t)0x0004, /*!< Noise error flag */\n  UART2_FLAG_FE           = (uint16_t)0x0002, /*!< Framing Error flag */\n  UART2_FLAG_PE           = (uint16_t)0x0001, /*!< Parity Error flag */\n  UART2_FLAG_SBK          = (uint16_t)0x0101,  /**< Send Break Complete interrupt flag */\n  UART2_FLAG_LBDF         = (uint16_t)0x0210, /**< LIN Break Detection Flag           */\n  UART2_FLAG_LHDF         = (uint16_t)0x0302, /**< LIN Header Detection Flag*/\n  UART2_FLAG_LSF          = (uint16_t)0x0301  /**< LIN Sync Field Flag*/\n} UART2_Flag_TypeDef;\n\n/**\n  * @brief  UART2 Interrupt definition\n  * UART2_IT possible values\n  * Elements values convention: 0xZYX\n  * X: Position of the corresponding Interrupt\n  *   - For the following values, X means the interrupt position in the CR2 register.\n  *     UART2_IT_TXE\n  *     UART2_IT_TC\n  *     UART2_IT_RXNE\n  *     UART2_IT_IDLE \n  *     UART2_IT_OR \n  *   - For the UART2_IT_PE value, X means the flag position in the CR1 register.\n  *   - For the UART2_IT_LBDF value, X means the flag position in the CR4 register.\n  *   - For the UART2_IT_LHDF value, X means the flag position in the CR6 register.\n  * Y: Flag position\n  *  - For the following values, Y means the flag (pending bit) position in the SR register.\n  *     UART2_IT_TXE\n  *     UART2_IT_TC\n  *     UART2_IT_RXNE\n  *     UART2_IT_IDLE \n  *     UART2_IT_OR\n  *     UART2_IT_PE\n  *  - For the UART2_IT_LBDF value, Y means the flag position in the CR4 register.\n  *  - For the UART2_IT_LHDF value, Y means the flag position in the CR6 register.\n  * Z: Register index: indicate in which register the dedicated interrupt source is:\n  *  - 1==> CR1 register\n  *  - 2==> CR2 register\n  *  - 3==> CR4 register\n  *  - 4==> CR6 register\n  */\ntypedef enum { UART2_IT_TXE        = (uint16_t)0x0277, /**< Transmit interrupt */\n               UART2_IT_TC         = (uint16_t)0x0266, /**< Transmission Complete interrupt */\n               UART2_IT_RXNE       = (uint16_t)0x0255, /**< Data Register Not Empty interrupt */\n               UART2_IT_IDLE       = (uint16_t)0x0244, /**< Idle line detected interrupt */\n               UART2_IT_OR         = (uint16_t)0x0235, /**< OverRun error interrupt */\n               UART2_IT_PE         = (uint16_t)0x0100, /**< Parity Error interrupt */\n               UART2_IT_LBDF       = (uint16_t)0x0346, /**< LIN Break Detection interrupt */\n               UART2_IT_LHDF       = (uint16_t)0x0412, /**< LIN Header Detection interrupt*/\n               UART2_IT_RXNE_OR    = (uint16_t)0x0205  /*!< Receive/Overrun interrupt */\n             } UART2_IT_TypeDef;\n\n/**\n  * @}\n  */\n\n/* Exported constants --------------------------------------------------------*/\n/* Exported macros ------------------------------------------------------------*/\n\n/* Private macros ------------------------------------------------------------*/\n\n/** @addtogroup UART2_Private_Macros\n  * @{\n  */\n\n/**\n  * @brief  Macro used by the assert function to check the different functions parameters.\n  */\n\n/**\n * @brief Macro used by the assert_param function in order to check the different\n *        sensitivity values for the MODEs possible combination should be one of\n *        the following.\n */\n \n#define IS_UART2_MODE_OK(Mode) \\\n  (((Mode) == (uint8_t)UART2_MODE_RX_ENABLE) || \\\n   ((Mode) == (uint8_t)UART2_MODE_RX_DISABLE) || \\\n   ((Mode) == (uint8_t)UART2_MODE_TX_ENABLE) || \\\n   ((Mode) == (uint8_t)UART2_MODE_TX_DISABLE) || \\\n   ((Mode) == (uint8_t)UART2_MODE_TXRX_ENABLE) || \\\n   ((Mode) == (uint8_t)((uint8_t)UART2_MODE_TX_ENABLE|(uint8_t)UART2_MODE_RX_ENABLE)) || \\\n   ((Mode) == (uint8_t)((uint8_t)UART2_MODE_TX_ENABLE|(uint8_t)UART2_MODE_RX_DISABLE)) || \\\n   ((Mode) == (uint8_t)((uint8_t)UART2_MODE_TX_DISABLE|(uint8_t)UART2_MODE_RX_DISABLE)) || \\\n   ((Mode) == (uint8_t)((uint8_t)UART2_MODE_TX_DISABLE|(uint8_t)UART2_MODE_RX_ENABLE)))\n\n/**\n * @brief Macro used by the assert_param function in order to check the different\n *        sensitivity values for the WordLengths\n */\n#define IS_UART2_WORDLENGTH_OK(WordLength) \\\n  (((WordLength) == UART2_WORDLENGTH_8D) || \\\n   ((WordLength) == UART2_WORDLENGTH_9D))\n\n/**\n  * @brief  Macro used by the assert_param function in order to check the different\n  *         sensitivity values for the SyncModes; it should exclude values such \n  *         as  UART2_CLOCK_ENABLE|UART2_CLOCK_DISABLE\n  */\n#define IS_UART2_SYNCMODE_OK(SyncMode) \\\n  (!((((SyncMode)&(((uint8_t)UART2_SYNCMODE_CLOCK_ENABLE)|((uint8_t)UART2_SYNCMODE_CLOCK_DISABLE))) == (((uint8_t)UART2_SYNCMODE_CLOCK_ENABLE)|((uint8_t)UART2_SYNCMODE_CLOCK_DISABLE))) || \\\n     (((SyncMode)&(((uint8_t)UART2_SYNCMODE_CPOL_LOW )|((uint8_t)UART2_SYNCMODE_CPOL_HIGH))) == (((uint8_t)UART2_SYNCMODE_CPOL_LOW )|((uint8_t)UART2_SYNCMODE_CPOL_HIGH))) || \\\n     (((SyncMode)&(((uint8_t)UART2_SYNCMODE_CPHA_MIDDLE)|((uint8_t)UART2_SYNCMODE_CPHA_BEGINING))) == (((uint8_t)UART2_SYNCMODE_CPHA_MIDDLE)|((uint8_t)UART2_SYNCMODE_CPHA_BEGINING))) || \\\n     (((SyncMode)&(((uint8_t)UART2_SYNCMODE_LASTBIT_DISABLE)|((uint8_t)UART2_SYNCMODE_LASTBIT_ENABLE))) == (((uint8_t)UART2_SYNCMODE_LASTBIT_DISABLE)|((uint8_t)UART2_SYNCMODE_LASTBIT_ENABLE)))))\n\n/**\n  * @brief  Macro used by the assert_param function in order to check the \n  *         different sensitivity values for the FLAGs\n  */\n#define IS_UART2_FLAG_OK(Flag) \\\n  (((Flag) == UART2_FLAG_TXE) || \\\n   ((Flag) == UART2_FLAG_TC)  || \\\n   ((Flag) == UART2_FLAG_RXNE) || \\\n   ((Flag) == UART2_FLAG_IDLE) || \\\n   ((Flag) == UART2_FLAG_OR_LHE) || \\\n   ((Flag) == UART2_FLAG_NF) || \\\n   ((Flag) == UART2_FLAG_FE) || \\\n   ((Flag) == UART2_FLAG_PE) || \\\n   ((Flag) == UART2_FLAG_SBK) || \\\n   ((Flag) == UART2_FLAG_LSF) || \\\n   ((Flag) == UART2_FLAG_LHDF) || \\\n   ((Flag) == UART2_FLAG_LBDF))\n\n\n/**\n  * @brief  Macro used by the assert_param function in order to check the \n  *         different sensitivity values for the FLAGs that can be cleared by writing 0\n  */\n#define IS_UART2_CLEAR_FLAG_OK(Flag) \\\n  (((Flag) == UART2_FLAG_RXNE) || \\\n   ((Flag) == UART2_FLAG_LHDF) || \\\n   ((Flag) == UART2_FLAG_LSF) || \\\n   ((Flag) == UART2_FLAG_LBDF))\n\n/**\n  * @brief  Macro used by the assert_param function in order to check \n  *         the different sensitivity values for the Interrupts\n  */\n\n#define IS_UART2_CONFIG_IT_OK(Interrupt) \\\n  (((Interrupt) == UART2_IT_PE) || \\\n   ((Interrupt) == UART2_IT_TXE) || \\\n   ((Interrupt) == UART2_IT_TC) || \\\n   ((Interrupt) == UART2_IT_RXNE_OR ) || \\\n   ((Interrupt) == UART2_IT_IDLE) || \\\n   ((Interrupt) == UART2_IT_LHDF) || \\\n   ((Interrupt) == UART2_IT_LBDF))\n\n/**\n  * @brief  Macro used by the assert function in order to check the different \n  *         sensitivity values for the pending bit\n  */\n#define IS_UART2_GET_IT_OK(ITPendingBit) \\\n  (((ITPendingBit) == UART2_IT_TXE)  || \\\n   ((ITPendingBit) == UART2_IT_TC)   || \\\n   ((ITPendingBit) == UART2_IT_RXNE) || \\\n   ((ITPendingBit) == UART2_IT_IDLE) || \\\n   ((ITPendingBit) == UART2_IT_OR)  || \\\n   ((ITPendingBit) == UART2_IT_LBDF)  || \\\n   ((ITPendingBit) == UART2_IT_LHDF)  || \\\n   ((ITPendingBit) == UART2_IT_PE))\n\n/**\n  * @brief  Macro used by the assert function in order to check the different \n  *         sensitivity values for the pending bit that can be cleared by writing 0\n  */\n#define IS_UART2_CLEAR_IT_OK(ITPendingBit) \\\n  (((ITPendingBit) == UART2_IT_RXNE) || \\\n   ((ITPendingBit) == UART2_IT_LHDF) || \\\n   ((ITPendingBit) == UART2_IT_LBDF))\n\n\n/**\n * @brief Macro used by the assert_param function in order to check the different\n *        sensitivity values for the IrDAModes\n */\n#define IS_UART2_IRDAMODE_OK(IrDAMode) \\\n  (((IrDAMode) == UART2_IRDAMODE_LOWPOWER) || \\\n   ((IrDAMode) == UART2_IRDAMODE_NORMAL))\n\n/**\n  * @brief  Macro used by the assert_param function in order to check the different\n  *         sensitivity values for the WakeUps\n  */\n#define IS_UART2_WAKEUP_OK(WakeUp) \\\n  (((WakeUp) == UART2_WAKEUP_IDLELINE) || \\\n   ((WakeUp) == UART2_WAKEUP_ADDRESSMARK))\n\n/**\n  * @brief  Macro used by the assert_param function in order to check the different\n  *         sensitivity values for the LINBreakDetectionLengths\n  */\n#define IS_UART2_LINBREAKDETECTIONLENGTH_OK(LINBreakDetectionLength) \\\n  (((LINBreakDetectionLength) == UART2_LINBREAKDETECTIONLENGTH_10BITS) || \\\n   ((LINBreakDetectionLength) == UART2_LINBREAKDETECTIONLENGTH_11BITS))\n\n/**\n  * @brief  Macro used by the assert_param function in order to check the different\n  *         sensitivity values for the UART2_StopBits\n  */\n#define IS_UART2_STOPBITS_OK(StopBit) (((StopBit) == UART2_STOPBITS_1) || \\\n                                       ((StopBit) == UART2_STOPBITS_0_5) || \\\n                                       ((StopBit) == UART2_STOPBITS_2) || \\\n                                       ((StopBit) == UART2_STOPBITS_1_5 ))\n\n/**\n * @brief Macro used by the assert_param function in order to check the different\n *        sensitivity values for the Paritys\n */\n#define IS_UART2_PARITY_OK(Parity) (((Parity) == UART2_PARITY_NO) || \\\n                                    ((Parity) == UART2_PARITY_EVEN) || \\\n                                    ((Parity) == UART2_PARITY_ODD ))\n\n/**\n * @brief Macro used by the assert_param function in order to check the maximum\n *        baudrate value\n */\n#define IS_UART2_BAUDRATE_OK(NUM) ((NUM) <= (uint32_t)625000)\n\n\n/**\n * @brief Macro used by the assert_param function in order to check the address \n *        of the UART2 or UART node\n */\n#define UART2_ADDRESS_MAX ((uint8_t)16)\n#define IS_UART2_ADDRESS_OK(node) ((node) < UART2_ADDRESS_MAX )\n\n/**\n * @brief Macro used by the assert_param function in order to check the LIN mode\n */\n#define IS_UART2_SLAVE_OK(Mode) \\\n  (((Mode) == UART2_LIN_MODE_MASTER) || \\\n   ((Mode) == UART2_LIN_MODE_SLAVE))\n\n/**\n * @brief Macro used by the assert_param function in order to check the LIN \n *        automatic resynchronization mode\n */\n#define IS_UART2_AUTOSYNC_OK(AutosyncMode) \\\n  (((AutosyncMode) ==  UART2_LIN_AUTOSYNC_ENABLE) || \\\n   ((AutosyncMode) == UART2_LIN_AUTOSYNC_DISABLE))\n\n/**\n * @brief Macro used by the assert_param function in order to check the LIN divider update method\n */\n#define IS_UART2_DIVUP_OK(DivupMethod) \\\n  (((DivupMethod) == UART2_LIN_DIVUP_LBRR1) || \\\n   ((DivupMethod) == UART2_LIN_DIVUP_NEXTRXNE))\n\n\n/**\n  * @}\n  */\n\n/* Exported functions ------------------------------------------------------- */\n\n/** @addtogroup UART2_Exported_Functions\n  * @{\n  */\n\nvoid UART2_DeInit(void);\nvoid UART2_Init(uint32_t BaudRate, UART2_WordLength_TypeDef WordLength, \n                UART2_StopBits_TypeDef StopBits, UART2_Parity_TypeDef Parity, \n                UART2_SyncMode_TypeDef SyncMode, UART2_Mode_TypeDef Mode);\nvoid UART2_Cmd(FunctionalState NewState);\nvoid UART2_ITConfig(UART2_IT_TypeDef UART2_IT, FunctionalState NewState);\nvoid UART2_HalfDuplexCmd(FunctionalState NewState);\nvoid UART2_IrDAConfig(UART2_IrDAMode_TypeDef UART2_IrDAMode);\nvoid UART2_IrDACmd(FunctionalState NewState);\nvoid UART2_LINBreakDetectionConfig(UART2_LINBreakDetectionLength_TypeDef UART2_LINBreakDetectionLength);\nvoid UART2_LINConfig(UART2_LinMode_TypeDef UART2_Mode, \n                     UART2_LinAutosync_TypeDef UART2_Autosync, \n                     UART2_LinDivUp_TypeDef UART2_DivUp);\nvoid UART2_LINCmd(FunctionalState NewState);\nvoid UART2_SmartCardCmd(FunctionalState NewState);\nvoid UART2_SmartCardNACKCmd(FunctionalState NewState);\nvoid UART2_WakeUpConfig(UART2_WakeUp_TypeDef UART2_WakeUp);\nvoid UART2_ReceiverWakeUpCmd(FunctionalState NewState);\nuint8_t UART2_ReceiveData8(void);\nuint16_t UART2_ReceiveData9(void);\nvoid UART2_SendData8(uint8_t Data);\nvoid UART2_SendData9(uint16_t Data);\nvoid UART2_SendBreak(void);\nvoid UART2_SetAddress(uint8_t UART2_Address);\nvoid UART2_SetGuardTime(uint8_t UART2_GuardTime);\nvoid UART2_SetPrescaler(uint8_t UART2_Prescaler);\nFlagStatus UART2_GetFlagStatus(UART2_Flag_TypeDef UART2_FLAG);\nvoid UART2_ClearFlag(UART2_Flag_TypeDef UART2_FLAG);\nITStatus UART2_GetITStatus(UART2_IT_TypeDef UART2_IT);\nvoid UART2_ClearITPendingBit(UART2_IT_TypeDef UART2_IT);\n\n\n/**\n  * @}\n  */\n\n#endif /* __STM8S_UART2_H */\n\n/**\n  * @}\n  */\n  \n\n/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\n"
  },
  {
    "path": "src/firmware/tsdz2/stm8s/stm8s_uart3.h",
    "content": "/**\n  ********************************************************************************\n  * @file    stm8s_uart3.h\n  * @author  MCD Application Team\n  * @version V2.3.0\n  * @date    16-June-2017\n  * @brief   This file contains all functions prototypes and macros for the UART3 peripheral.\n   ******************************************************************************\n  * @attention\n  *\n  * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>\n  *\n  * Licensed under MCD-ST Liberty SW License Agreement V2, (the \"License\");\n  * You may not use this file except in compliance with the License.\n  * You may obtain a copy of the License at:\n  *\n  *        http://www.st.com/software_license_agreement_liberty_v2\n  *\n  * Unless required by applicable law or agreed to in writing, software \n  * distributed under the License is distributed on an \"AS IS\" BASIS, \n  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  * See the License for the specific language governing permissions and\n  * limitations under the License.\n  *\n  ******************************************************************************\n  */\n\n/* Define to prevent recursive inclusion -------------------------------------*/\n#ifndef __STM8S_UART3_H\n#define __STM8S_UART3_H\n\n/* Includes ------------------------------------------------------------------*/\n#include \"stm8s.h\"\n\n/** @addtogroup STM8S_StdPeriph_Driver\n  * @{\n  */\n\n/* Exported types ------------------------------------------------------------*/\n\n/** @addtogroup UART3_Exported_Types\n  * @{\n  */\n\n/**\n  * @brief  UART3 WakeUP Modes\n  */\ntypedef enum { UART3_WAKEUP_IDLELINE      = (uint8_t)0x00,  /**< 0x01 Idle Line wake up*/\n               UART3_WAKEUP_ADDRESSMARK   = (uint8_t)0x08   /**< 0x02 Address Mark wake up*/\n             } UART3_WakeUp_TypeDef;\n\n/**\n  * @brief  UART3 LIN Break detection length possible values\n  */\ntypedef enum { UART3_LINBREAKDETECTIONLENGTH_10BITS = (uint8_t)0x00, /**< 10 bits Lin Break detection */\n               UART3_LINBREAKDETECTIONLENGTH_11BITS = (uint8_t)0x01  /**< 11 bits Lin Break detection */\n             } UART3_LINBreakDetectionLength_TypeDef;\n\n\n/**\n  * @brief  UART3 stop bits possible values\n  */\ntypedef enum { UART3_STOPBITS_1  = (uint8_t)0x00,  /**< One stop bit is  transmitted at the end of frame*/\n               UART3_STOPBITS_2  = (uint8_t)0x20   /**< Two stop bits are  transmitted at the end of frame*/\n             } UART3_StopBits_TypeDef;\n\n/**\n  * @brief  UART3 parity possible values\n  */\ntypedef enum { UART3_PARITY_NO    = (uint8_t)0x00,    /**< No Parity*/\n               UART3_PARITY_EVEN  = (uint8_t)0x04,    /**< Even Parity*/\n               UART3_PARITY_ODD   = (uint8_t)0x06     /**< Odd Parity*/\n             } UART3_Parity_TypeDef;\n\n/**\n  * @brief  UART3 Word length possible values\n  */\ntypedef enum { UART3_WORDLENGTH_8D = (uint8_t)0x00,    /**< 0x00 8 bits Data*/\n               UART3_WORDLENGTH_9D = (uint8_t)0x10     /**< 0x10 9 bits Data*/\n             } UART3_WordLength_TypeDef;\n\n/**\n  * @brief  UART3 Mode Transmit/Receive possible values\n  */\ntypedef enum { UART3_MODE_RX_ENABLE    = (uint8_t)0x08,  /**< 0x08 Receive Enable*/\n               UART3_MODE_TX_ENABLE    = (uint8_t)0x04,  /**< 0x04 Transmit Enable*/\n               UART3_MODE_TX_DISABLE   = (uint8_t)0x80,  /**< 0x80 Receive Enable*/\n               UART3_MODE_RX_DISABLE   = (uint8_t)0x40,  /**< 0x40 Single-wire Half-duplex mode*/\n               UART3_MODE_TXRX_ENABLE  = (uint8_t)0x0C   /**< 0x0C Receive Enable and Transmit enable*/\n             } UART3_Mode_TypeDef;\n\n/**\n  * @brief  UART3 Mode possible values\n  */\ntypedef enum { UART3_LIN_MODE_MASTER  = (uint8_t)0x00, /**<  LIN Master Mode*/\n               UART3_LIN_MODE_SLAVE   = (uint8_t)0x01  /**<  LIN Slave Mode*/\n             } UART3_LinMode_TypeDef;\n/**\n  * @brief  UART3 automatic resynchronisation possible values\n  */\ntypedef enum { UART3_LIN_AUTOSYNC_DISABLE   = (uint8_t)0x00,  /**< LIN Autosynchronization Disable*/\n               UART3_LIN_AUTOSYNC_ENABLE    = (uint8_t)0x01   /**< LIN Autosynchronization Enable*/\n             } UART3_LinAutosync_TypeDef;\n/**\n  * @brief  UART3 Divider Update Method possible values\n  */\ntypedef enum { UART3_LIN_DIVUP_LBRR1    = (uint8_t)0x00, /**<  LIN LDIV is updated as soon as LBRR1 is written*/\n               UART3_LIN_DIVUP_NEXTRXNE = (uint8_t)0x01  /**<  LIN LDIV is updated at the next received character*/\n             } UART3_LinDivUp_TypeDef;\n\n\n/**\n  * @brief  UART3 Flag possible values\n  */\ntypedef enum\n{\n  UART3_FLAG_TXE         = (uint16_t)0x0080, /*!< Transmit Data Register Empty flag */\n  UART3_FLAG_TC          = (uint16_t)0x0040, /*!< Transmission Complete flag */\n  UART3_FLAG_RXNE        = (uint16_t)0x0020, /*!< Read Data Register Not Empty flag */\n  UART3_FLAG_IDLE        = (uint16_t)0x0010, /*!< Idle line detected flag */\n  UART3_FLAG_OR_LHE      = (uint16_t)0x0008, /*!< OverRun error flag */\n  UART3_FLAG_NF          = (uint16_t)0x0004, /*!< Noise error flag */\n  UART3_FLAG_FE          = (uint16_t)0x0002, /*!< Framing Error flag */\n  UART3_FLAG_PE          = (uint16_t)0x0001, /*!< Parity Error flag */\n  UART3_FLAG_SBK         = (uint16_t)0x0101,  /**< Send Break Complete interrupt flag */\n  UART3_FLAG_LBDF        = (uint16_t)0x0210, /**< LIN Break Detection Flag           */\n  UART3_FLAG_LHDF        = (uint16_t)0x0302, /**< LIN Header Detection Flag*/\n  UART3_FLAG_LSF         = (uint16_t)0x0301  /**< LIN Sync Field Flag*/\n} UART3_Flag_TypeDef;\n\n/**\n  * @brief  UART3 Interrupt definition\n  * UART3_IT possible values\n  * Elements values convention: 0xZYX\n  * X: Position of the corresponding Interrupt\n  *   - For the following values, X means the interrupt position in the CR2 register.\n  *     UART3_IT_TXE\n  *     UART3_IT_TC\n  *     UART3_IT_RXNE\n  *     UART3_IT_IDLE \n  *     UART3_IT_OR \n  *   - For the UART3_IT_PE value, X means the flag position in the CR1 register.\n  *   - For the UART3_IT_LBDF value, X means the flag position in the CR4 register.\n  *   - For the UART3_IT_LHDF value, X means the flag position in the CR6 register.\n  * Y: Flag position\n  *  - For the following values, Y means the flag (pending bit) position in the SR register.\n  *     UART3_IT_TXE\n  *     UART3_IT_TC\n  *     UART3_IT_RXNE\n  *     UART3_IT_IDLE \n  *     UART3_IT_OR\n  *     UART3_IT_PE\n  *  - For the UART3_IT_LBDF value, Y means the flag position in the CR4 register.\n  *  - For the UART3_IT_LHDF value, Y means the flag position in the CR6 register.\n  * Z: Register index: indicate in which register the dedicated interrupt source is:\n  *  - 1==> CR1 register\n  *  - 2==> CR2 register\n  *  - 3==> CR4 register\n  *  - 4==> CR6 register\n  */\ntypedef enum { UART3_IT_TXE        = (uint16_t)0x0277, /**< Transmit interrupt */\n               UART3_IT_TC         = (uint16_t)0x0266, /**< Transmission Complete interrupt */\n               UART3_IT_RXNE       = (uint16_t)0x0255, /**< Data Register Not Empty interrupt */\n               UART3_IT_IDLE       = (uint16_t)0x0244, /**< Idle line detected interrupt */\n               UART3_IT_OR         = (uint16_t)0x0235, /**< OverRun error interrupt */\n               UART3_IT_PE         = (uint16_t)0x0100, /**< Parity Error interrupt */\n               UART3_IT_LBDF       = (uint16_t)0x0346, /**< LIN Break Detection interrupt */\n               UART3_IT_LHDF       = (uint16_t)0x0412, /**< LIN Header Detection interrupt*/\n               UART3_IT_RXNE_OR    = (uint16_t)0x0205  /*!< Receive/Overrun interrupt */\n             } UART3_IT_TypeDef;\n\n\n/**\n  * @}\n  */\n\n/* Exported constants --------------------------------------------------------*/\n/* Exported macros ------------------------------------------------------------*/\n\n/* Private macros ------------------------------------------------------------*/\n\n/** @addtogroup UART3_Private_Macros\n  * @{\n  */\n\n/**\n  * @brief  Macro used by the assert_param function in order to check the \n  *         different sensitivity values for the FLAGs\n  */\n#define IS_UART3_FLAG_OK(Flag) \\\n  (((Flag) == UART3_FLAG_TXE) || \\\n   ((Flag) == UART3_FLAG_TC)  || \\\n   ((Flag) == UART3_FLAG_RXNE) || \\\n   ((Flag) == UART3_FLAG_IDLE) || \\\n   ((Flag) == UART3_FLAG_OR_LHE) || \\\n   ((Flag) == UART3_FLAG_NF) || \\\n   ((Flag) == UART3_FLAG_FE) || \\\n   ((Flag) == UART3_FLAG_PE) || \\\n   ((Flag) == UART3_FLAG_SBK) || \\\n   ((Flag) == UART3_FLAG_LSF) || \\\n   ((Flag) == UART3_FLAG_LHDF) || \\\n   ((Flag) == UART3_FLAG_LBDF))\n\n\n/**\n  * @brief  Macro used by the assert_param function in order to check the \n  *         different sensitivity values for the FLAGs that can be cleared by writing 0\n  */\n#define IS_UART3_CLEAR_FLAG_OK(Flag) \\\n  (((Flag) == UART3_FLAG_RXNE) || \\\n   ((Flag) == UART3_FLAG_LHDF) || \\\n   ((Flag) == UART3_FLAG_LSF) || \\\n   ((Flag) == UART3_FLAG_LBDF))\n\n/**\n  * @brief  Macro used by the assert_param function in order to check the \n  *         different sensitivity values for the Interrupts\n  */\n\n#define IS_UART3_CONFIG_IT_OK(Interrupt) \\\n  (((Interrupt) == UART3_IT_PE) || \\\n   ((Interrupt) == UART3_IT_TXE) || \\\n   ((Interrupt) == UART3_IT_TC) || \\\n   ((Interrupt) == UART3_IT_RXNE_OR ) || \\\n   ((Interrupt) == UART3_IT_IDLE) || \\\n   ((Interrupt) == UART3_IT_LHDF) || \\\n   ((Interrupt) == UART3_IT_LBDF))\n\n/**\n  * @brief  Macro used by the assert function in order to check the different \n  *         sensitivity values for the pending bit\n  */\n#define IS_UART3_GET_IT_OK(ITPendingBit) \\\n  (((ITPendingBit) == UART3_IT_TXE)  || \\\n   ((ITPendingBit) == UART3_IT_TC)   || \\\n   ((ITPendingBit) == UART3_IT_RXNE) || \\\n   ((ITPendingBit) == UART3_IT_IDLE) || \\\n   ((ITPendingBit) == UART3_IT_OR)  || \\\n   ((ITPendingBit) == UART3_IT_LBDF)  || \\\n   ((ITPendingBit) == UART3_IT_LHDF)  || \\\n   ((ITPendingBit) == UART3_IT_PE))\n\n/**\n  * @brief  Macro used by the assert function in order to check the different \n  *         sensitivity values for the pending bit that can be cleared by writing 0\n  */\n#define IS_UART3_CLEAR_IT_OK(ITPendingBit) \\\n  (((ITPendingBit) == UART3_IT_RXNE) || \\\n   ((ITPendingBit) == UART3_IT_LHDF) || \\\n   ((ITPendingBit) == UART3_IT_LBDF))\n\n/**\n * @brief Macro used by the assert_param function in order to check the different\n *        sensitivity values for the MODEs\n */\n#define IS_UART3_MODE_OK(Mode) \\\n  (((Mode) == (uint8_t)UART3_MODE_RX_ENABLE) || \\\n   ((Mode) == (uint8_t)UART3_MODE_RX_DISABLE) || \\\n   ((Mode) == (uint8_t)UART3_MODE_TX_ENABLE) || \\\n   ((Mode) == (uint8_t)UART3_MODE_TX_DISABLE) || \\\n   ((Mode) == (uint8_t)UART3_MODE_TXRX_ENABLE) || \\\n   ((Mode) == (uint8_t)((uint8_t)UART3_MODE_TX_ENABLE|(uint8_t)UART3_MODE_RX_ENABLE)) || \\\n   ((Mode) == (uint8_t)((uint8_t)UART3_MODE_TX_ENABLE|(uint8_t)UART3_MODE_RX_DISABLE)) || \\\n   ((Mode) == (uint8_t)((uint8_t)UART3_MODE_TX_DISABLE|(uint8_t)UART3_MODE_RX_DISABLE)) || \\\n   ((Mode) == (uint8_t)((uint8_t)UART3_MODE_TX_DISABLE|(uint8_t)UART3_MODE_RX_ENABLE)))\n\n/**\n * @brief Macro used by the assert_param function in order to check the different\n *        sensitivity values for the WordLengths\n */\n#define IS_UART3_WORDLENGTH_OK(WordLength) \\\n  (((WordLength) == UART3_WORDLENGTH_8D) || \\\n   ((WordLength) == UART3_WORDLENGTH_9D))\n\n\n/**\n  * @brief  Macro used by the assert_param function in order to check the different\n  *         sensitivity values for the WakeUps\n  */\n#define IS_UART3_WAKEUP_OK(WakeUpMode) \\\n  (((WakeUpMode) == UART3_WAKEUP_IDLELINE) || \\\n   ((WakeUpMode) == UART3_WAKEUP_ADDRESSMARK))\n\n/**\n  * @brief  Macro used by the assert_param function in order to check the different\n  *         sensitivity values for the LINBreakDetectionLengths\n  */\n#define IS_UART3_LINBREAKDETECTIONLENGTH_OK(LINBreakDetectionLengths) \\\n  (((LINBreakDetectionLengths) == UART3_LINBREAKDETECTIONLENGTH_10BITS) || \\\n   ((LINBreakDetectionLengths) == UART3_LINBREAKDETECTIONLENGTH_11BITS))\n\n/**\n  * @brief  Macro used by the assert_param function in order to check the different\n  *         sensitivity values for the UART3_StopBits\n  */\n#define IS_UART3_STOPBITS_OK(StopBit) \\\n  (((StopBit) == UART3_STOPBITS_1) || \\\n   ((StopBit) == UART3_STOPBITS_2))\n\n/**\n * @brief Macro used by the assert_param function in order to check the different\n *        sensitivity values for the Parity\n */\n#define IS_UART3_PARITY_OK(Parity) \\\n  (((Parity) == UART3_PARITY_NO) || \\\n   ((Parity) == UART3_PARITY_EVEN) || \\\n   ((Parity) == UART3_PARITY_ODD ))\n\n/**\n * @brief Macro used by the assert_param function in order to check the maximum \n *        baudrate value\n */\n#define IS_UART3_BAUDRATE_OK(NUM) ((NUM) <= (uint32_t)625000)\n\n/**\n * @brief Macro used by the assert_param function in order to check the address \n *        of the UART3 or UART node\n */\n#define UART3_ADDRESS_MAX ((uint8_t)16)\n#define IS_UART3_ADDRESS_OK(Node) ((Node) < UART3_ADDRESS_MAX)\n\n/**\n * @brief Macro used by the assert_param function in order to check the LIN mode\n */\n#define IS_UART3_SLAVE_OK(Mode) \\\n  (((Mode) == UART3_LIN_MODE_MASTER) || \\\n   ((Mode) == UART3_LIN_MODE_SLAVE))\n\n/**\n * @brief Macro used by the assert_param function in order to check the LIN \n *        automatic resynchronization mode\n */\n#define IS_UART3_AUTOSYNC_OK(AutosyncMode) \\\n  (((AutosyncMode) ==  UART3_LIN_AUTOSYNC_ENABLE) || \\\n   ((AutosyncMode) == UART3_LIN_AUTOSYNC_DISABLE))\n\n/**\n * @brief Macro used by the assert_param function in order to check the LIN \n *        divider update method\n */\n#define IS_UART3_DIVUP_OK(DivupMethod) \\\n  (((DivupMethod) == UART3_LIN_DIVUP_LBRR1) || \\\n   ((DivupMethod) == UART3_LIN_DIVUP_NEXTRXNE))\n\n/**\n  * @}\n  */\n\n/* Exported functions ------------------------------------------------------- */\n\n/** @addtogroup UART3_Exported_Functions\n  * @{\n  */\n\nvoid UART3_DeInit(void);\nvoid UART3_Init(uint32_t BaudRate, UART3_WordLength_TypeDef WordLength, \n                UART3_StopBits_TypeDef StopBits, UART3_Parity_TypeDef Parity, \n                UART3_Mode_TypeDef Mode);\nvoid UART3_Cmd(FunctionalState NewState);\nvoid UART3_ITConfig(UART3_IT_TypeDef UART3_IT, FunctionalState NewState);\nvoid UART3_LINBreakDetectionConfig(UART3_LINBreakDetectionLength_TypeDef UART3_LINBreakDetectionLength);\nvoid UART3_LINConfig(UART3_LinMode_TypeDef UART3_Mode, \n                     UART3_LinAutosync_TypeDef UART3_Autosync, \n                     UART3_LinDivUp_TypeDef UART3_DivUp);\nvoid UART3_LINCmd(FunctionalState NewState);\nvoid UART3_ReceiverWakeUpCmd(FunctionalState NewState);\nvoid UART3_WakeUpConfig( UART3_WakeUp_TypeDef UART3_WakeUp);\nuint8_t UART3_ReceiveData8(void);\nuint16_t UART3_ReceiveData9(void);\nvoid UART3_SendData8(uint8_t Data);\nvoid UART3_SendData9(uint16_t Data);\nvoid UART3_SendBreak(void);\nvoid UART3_SetAddress(uint8_t UART3_Address);\nFlagStatus UART3_GetFlagStatus(UART3_Flag_TypeDef UART3_FLAG);\nvoid UART3_ClearFlag(UART3_Flag_TypeDef UART3_FLAG);\nITStatus UART3_GetITStatus(UART3_IT_TypeDef UART3_IT);\nvoid UART3_ClearITPendingBit(UART3_IT_TypeDef UART3_IT);\n/**\n  * @}\n  */\n\n#endif /* __STM8S_UART3_H */\n\n/**\n  * @}\n  */\n\n\n/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\n"
  },
  {
    "path": "src/firmware/tsdz2/stm8s/stm8s_uart4.h",
    "content": "/**\n  ********************************************************************************\n  * @file    stm8s_uart4.h\n  * @author  MCD Application Team\n  * @version V2.3.0\n  * @date    16-June-2017\n  * @brief   This file contains all functions prototypes and macros for the UART4 peripheral.\n   ******************************************************************************\n  * @attention\n  *\n  * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>\n  *\n  * Licensed under MCD-ST Liberty SW License Agreement V2, (the \"License\");\n  * You may not use this file except in compliance with the License.\n  * You may obtain a copy of the License at:\n  *\n  *        http://www.st.com/software_license_agreement_liberty_v2\n  *\n  * Unless required by applicable law or agreed to in writing, software \n  * distributed under the License is distributed on an \"AS IS\" BASIS, \n  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  * See the License for the specific language governing permissions and\n  * limitations under the License.\n  *\n  ******************************************************************************\n  */\n\n/* Define to prevent recursive inclusion -------------------------------------*/\n#ifndef __STM8S_UART4_H\n#define __STM8S_UART4_H\n\n/* Includes ------------------------------------------------------------------*/\n#include \"stm8s.h\"\n\n/** @addtogroup STM8S_StdPeriph_Driver\n  * @{\n  */\n\n/* Exported types ------------------------------------------------------------*/\n\n/** @addtogroup UART4_Exported_Types\n  * @{\n  */\n\n/**\n  * @brief  UART4 Irda Modes\n  */\n\ntypedef enum { UART4_IRDAMODE_NORMAL     = (uint8_t)0x00, /**< 0x00 Irda Normal Mode   */\n               UART4_IRDAMODE_LOWPOWER   = (uint8_t)0x01  /**< 0x01 Irda Low Power Mode */\n\n             } UART4_IrDAMode_TypeDef;\n\n/**\n  * @brief  UART4 WakeUP Modes\n  */\n\ntypedef enum { UART4_WAKEUP_IDLELINE       = (uint8_t)0x00, /**< 0x01 Idle Line wake up */\n               UART4_WAKEUP_ADDRESSMARK    = (uint8_t)0x08  /**< 0x02 Address Mark wake up */\n             } UART4_WakeUp_TypeDef;\n\n\n/**\n  * @brief  UART4 LIN Break detection length possible values\n  */\ntypedef enum { UART4_LINBREAKDETECTIONLENGTH_10BITS = (uint8_t)0x00, /**< 0x01 10 bits Lin Break detection */\n               UART4_LINBREAKDETECTIONLENGTH_11BITS = (uint8_t)0x01  /**< 0x02 11 bits Lin Break detection */\n             } UART4_LINBreakDetectionLength_TypeDef;\n\n/**\n  * @brief  UART4 stop bits possible values\n  */\n\ntypedef enum { UART4_STOPBITS_1   = (uint8_t)0x00,    /**< One stop bit is  transmitted at the end of frame*/\n               UART4_STOPBITS_0_5 = (uint8_t)0x10,    /**< Half stop bits is transmitted at the end of frame*/\n               UART4_STOPBITS_2   = (uint8_t)0x20,    /**< Two stop bits are  transmitted at the end of frame*/\n               UART4_STOPBITS_1_5 = (uint8_t)0x30     /**< One and half stop bits*/\n             } UART4_StopBits_TypeDef;\n\n\n/**\n  * @brief  UART4 parity possible values\n  */\ntypedef enum { UART4_PARITY_NO     = (uint8_t)0x00,      /**< No Parity*/\n               UART4_PARITY_EVEN   = (uint8_t)0x04,      /**< Even Parity*/\n               UART4_PARITY_ODD    = (uint8_t)0x06       /**< Odd Parity*/\n             } UART4_Parity_TypeDef;\n/**\n  * @brief  UART4 Mode possible values\n  */\ntypedef enum { UART4_LIN_MODE_MASTER  = (uint8_t)0x00, /**<  LIN Master Mode*/\n               UART4_LIN_MODE_SLAVE   = (uint8_t)0x01  /**<  LIN Slave Mode*/\n             } UART4_LinMode_TypeDef;\n/**\n  * @brief  UART4 automatic resynchronisation possible values\n  */\ntypedef enum { UART4_LIN_AUTOSYNC_DISABLE   = (uint8_t)0x00,  /**< LIN Autosynchronization Disable*/\n               UART4_LIN_AUTOSYNC_ENABLE    = (uint8_t)0x01   /**< LIN Autosynchronization Enable*/\n             } UART4_LinAutosync_TypeDef;\n/**\n  * @brief  UART4 Divider Update Method possible values\n  */\ntypedef enum { UART4_LIN_DIVUP_LBRR1    = (uint8_t)0x00, /**<  LIN LDIV is updated as soon as LBRR1 is written*/\n               UART4_LIN_DIVUP_NEXTRXNE = (uint8_t)0x01  /**<  LIN LDIV is updated at the next received character*/\n             } UART4_LinDivUp_TypeDef;\n\n/**\n  * @brief  UART4 Synchrone modes\n  */\ntypedef enum { UART4_SYNCMODE_CLOCK_DISABLE    = (uint8_t)0x80, /**< 0x80 Sync mode Disable, SLK pin Disable */\n               UART4_SYNCMODE_CLOCK_ENABLE     = (uint8_t)0x08, /**< 0x08 Sync mode Enable, SLK pin Enable     */\n               UART4_SYNCMODE_CPOL_LOW         = (uint8_t)0x40, /**< 0x40 Steady low value on SCLK pin outside transmission window */\n               UART4_SYNCMODE_CPOL_HIGH        = (uint8_t)0x04, /**< 0x04 Steady high value on SCLK pin outside transmission window */\n               UART4_SYNCMODE_CPHA_MIDDLE      = (uint8_t)0x20, /**< 0x20 SCLK clock line activated in middle of data bit     */\n               UART4_SYNCMODE_CPHA_BEGINING    = (uint8_t)0x02, /**< 0x02 SCLK clock line activated at beginning of data bit  */\n               UART4_SYNCMODE_LASTBIT_DISABLE  = (uint8_t)0x10, /**< 0x10 The clock pulse of the last data bit is not output to the SCLK pin */\n               UART4_SYNCMODE_LASTBIT_ENABLE   = (uint8_t)0x01  /**< 0x01 The clock pulse of the last data bit is output to the SCLK pin */\n             } UART4_SyncMode_TypeDef;\n\n/**\n  * @brief  UART4 Word length possible values\n  */\ntypedef enum { UART4_WORDLENGTH_8D = (uint8_t)0x00,/**< 0x00 8 bits Data  */\n               UART4_WORDLENGTH_9D = (uint8_t)0x10 /**< 0x10 9 bits Data  */\n             } UART4_WordLength_TypeDef;\n\n/**\n  * @brief  UART4 Mode possible values\n  */\ntypedef enum { UART4_MODE_RX_ENABLE     = (uint8_t)0x08,  /**< 0x08 Receive Enable */\n               UART4_MODE_TX_ENABLE     = (uint8_t)0x04,  /**< 0x04 Transmit Enable */\n               UART4_MODE_TX_DISABLE    = (uint8_t)0x80,  /**< 0x80 Transmit Disable */\n               UART4_MODE_RX_DISABLE    = (uint8_t)0x40,  /**< 0x40 Single-wire Half-duplex mode */\n               UART4_MODE_TXRX_ENABLE   = (uint8_t)0x0C  /**< 0x0C Transmit Enable and Receive Enable */\n             } UART4_Mode_TypeDef;\n/**\n  * @brief  UART4 Flag possible values\n  */\ntypedef enum\n{\n  UART4_FLAG_TXE          = (uint16_t)0x0080, /*!< Transmit Data Register Empty flag */\n  UART4_FLAG_TC           = (uint16_t)0x0040, /*!< Transmission Complete flag */\n  UART4_FLAG_RXNE         = (uint16_t)0x0020, /*!< Read Data Register Not Empty flag */\n  UART4_FLAG_IDLE         = (uint16_t)0x0010, /*!< Idle line detected flag */\n  UART4_FLAG_OR_LHE       = (uint16_t)0x0008, /*!< OverRun error flag */\n  UART4_FLAG_NF           = (uint16_t)0x0004, /*!< Noise error flag */\n  UART4_FLAG_FE           = (uint16_t)0x0002, /*!< Framing Error flag */\n  UART4_FLAG_PE           = (uint16_t)0x0001, /*!< Parity Error flag */\n  UART4_FLAG_SBK          = (uint16_t)0x0101,  /**< Send Break Complete interrupt flag */\n  UART4_FLAG_LBDF         = (uint16_t)0x0210, /**< LIN Break Detection Flag           */\n  UART4_FLAG_LHDF         = (uint16_t)0x0302, /**< LIN Header Detection Flag*/\n  UART4_FLAG_LSF          = (uint16_t)0x0301  /**< LIN Sync Field Flag*/\n} UART4_Flag_TypeDef;\n\n/**\n  * @brief  UART4 Interrupt definition\n  * UART4_IT possible values\n  * Elements values convention: 0xZYX\n  * X: Position of the corresponding Interrupt\n  *   - For the following values, X means the interrupt position in the CR2 register.\n  *     UART4_IT_TXE\n  *     UART4_IT_TC\n  *     UART4_IT_RXNE\n  *     UART4_IT_IDLE \n  *     UART4_IT_OR \n  *   - For the UART4_IT_PE value, X means the flag position in the CR1 register.\n  *   - For the UART4_IT_LBDF value, X means the flag position in the CR4 register.\n  *   - For the UART4_IT_LHDF value, X means the flag position in the CR6 register.\n  * Y: Flag position\n  *  - For the following values, Y means the flag (pending bit) position in the SR register.\n  *     UART4_IT_TXE\n  *     UART4_IT_TC\n  *     UART4_IT_RXNE\n  *     UART4_IT_IDLE \n  *     UART4_IT_OR\n  *     UART4_IT_PE\n  *  - For the UART4_IT_LBDF value, Y means the flag position in the CR4 register.\n  *  - For the UART4_IT_LHDF value, Y means the flag position in the CR6 register.\n  * Z: Register index: indicate in which register the dedicated interrupt source is:\n  *  - 1==> CR1 register\n  *  - 2==> CR2 register\n  *  - 3==> CR4 register\n  *  - 4==> CR6 register\n  */\ntypedef enum { UART4_IT_TXE        = (uint16_t)0x0277, /**< Transmit interrupt */\n               UART4_IT_TC         = (uint16_t)0x0266, /**< Transmission Complete interrupt */\n               UART4_IT_RXNE       = (uint16_t)0x0255, /**< Data Register Not Empty interrupt */\n               UART4_IT_IDLE       = (uint16_t)0x0244, /**< Idle line detected interrupt */\n               UART4_IT_OR         = (uint16_t)0x0235, /**< OverRun error interrupt */\n               UART4_IT_PE         = (uint16_t)0x0100, /**< Parity Error interrupt */\n               UART4_IT_LBDF       = (uint16_t)0x0346, /**< LIN Break Detection interrupt */\n               UART4_IT_LHDF       = (uint16_t)0x0412, /**< LIN Header Detection interrupt*/\n               UART4_IT_RXNE_OR    = (uint16_t)0x0205  /*!< Receive/Overrun interrupt */\n             } UART4_IT_TypeDef;\n\n/**\n  * @}\n  */\n\n/* Exported constants --------------------------------------------------------*/\n/* Exported macros -----------------------------------------------------------*/\n/* Private macros ------------------------------------------------------------*/\n\n/** @addtogroup UART4_Private_Macros\n  * @{\n  */\n\n/**\n  * @brief  Macro used by the assert function to check the different functions parameters.\n  */\n\n/**\n * @brief Macro used by the assert_param function in order to check the different\n *        sensitivity values for the MODEs possible combination should be one of\n *        the following.\n */\n \n#define IS_UART4_MODE_OK(Mode) \\\n  (((Mode) == (uint8_t)UART4_MODE_RX_ENABLE) || \\\n   ((Mode) == (uint8_t)UART4_MODE_RX_DISABLE) || \\\n   ((Mode) == (uint8_t)UART4_MODE_TX_ENABLE) || \\\n   ((Mode) == (uint8_t)UART4_MODE_TX_DISABLE) || \\\n   ((Mode) == (uint8_t)UART4_MODE_TXRX_ENABLE) || \\\n   ((Mode) == (uint8_t)((uint8_t)UART4_MODE_TX_ENABLE|(uint8_t)UART4_MODE_RX_ENABLE)) || \\\n   ((Mode) == (uint8_t)((uint8_t)UART4_MODE_TX_ENABLE|(uint8_t)UART4_MODE_RX_DISABLE)) || \\\n   ((Mode) == (uint8_t)((uint8_t)UART4_MODE_TX_DISABLE|(uint8_t)UART4_MODE_RX_DISABLE)) || \\\n   ((Mode) == (uint8_t)((uint8_t)UART4_MODE_TX_DISABLE|(uint8_t)UART4_MODE_RX_ENABLE)))\n\n/**\n * @brief Macro used by the assert_param function in order to check the different\n *        sensitivity values for the WordLengths\n */\n#define IS_UART4_WORDLENGTH_OK(WordLength) \\\n  (((WordLength) == UART4_WORDLENGTH_8D) || \\\n   ((WordLength) == UART4_WORDLENGTH_9D))\n\n/**\n  * @brief  Macro used by the assert_param function in order to check the different\n  *         sensitivity values for the SyncModes; it should exclude values such \n  *         as  UART4_CLOCK_ENABLE|UART4_CLOCK_DISABLE\n  */\n#define IS_UART4_SYNCMODE_OK(SyncMode) \\\n  (!((((SyncMode)&(((uint8_t)UART4_SYNCMODE_CLOCK_ENABLE)|((uint8_t)UART4_SYNCMODE_CLOCK_DISABLE))) == (((uint8_t)UART4_SYNCMODE_CLOCK_ENABLE)|((uint8_t)UART4_SYNCMODE_CLOCK_DISABLE))) || \\\n     (((SyncMode)&(((uint8_t)UART4_SYNCMODE_CPOL_LOW )|((uint8_t)UART4_SYNCMODE_CPOL_HIGH))) == (((uint8_t)UART4_SYNCMODE_CPOL_LOW )|((uint8_t)UART4_SYNCMODE_CPOL_HIGH))) || \\\n     (((SyncMode)&(((uint8_t)UART4_SYNCMODE_CPHA_MIDDLE)|((uint8_t)UART4_SYNCMODE_CPHA_BEGINING))) == (((uint8_t)UART4_SYNCMODE_CPHA_MIDDLE)|((uint8_t)UART4_SYNCMODE_CPHA_BEGINING))) || \\\n     (((SyncMode)&(((uint8_t)UART4_SYNCMODE_LASTBIT_DISABLE)|((uint8_t)UART4_SYNCMODE_LASTBIT_ENABLE))) == (((uint8_t)UART4_SYNCMODE_LASTBIT_DISABLE)|((uint8_t)UART4_SYNCMODE_LASTBIT_ENABLE)))))\n\n/**\n  * @brief  Macro used by the assert_param function in order to check the \n  *         different sensitivity values for the FLAGs\n  */\n#define IS_UART4_FLAG_OK(Flag) \\\n  (((Flag) == UART4_FLAG_TXE) || \\\n   ((Flag) == UART4_FLAG_TC)  || \\\n   ((Flag) == UART4_FLAG_RXNE) || \\\n   ((Flag) == UART4_FLAG_IDLE) || \\\n   ((Flag) == UART4_FLAG_OR_LHE) || \\\n   ((Flag) == UART4_FLAG_NF) || \\\n   ((Flag) == UART4_FLAG_FE) || \\\n   ((Flag) == UART4_FLAG_PE) || \\\n   ((Flag) == UART4_FLAG_SBK) || \\\n   ((Flag) == UART4_FLAG_LSF) || \\\n   ((Flag) == UART4_FLAG_LHDF) || \\\n   ((Flag) == UART4_FLAG_LBDF))\n\n\n/**\n  * @brief  Macro used by the assert_param function in order to check the \n  *         different sensitivity values for the FLAGs that can be cleared by writing 0\n  */\n#define IS_UART4_CLEAR_FLAG_OK(Flag) \\\n  (((Flag) == UART4_FLAG_RXNE) || \\\n   ((Flag) == UART4_FLAG_LHDF) || \\\n   ((Flag) == UART4_FLAG_LSF) || \\\n   ((Flag) == UART4_FLAG_LBDF))\n\n/**\n  * @brief  Macro used by the assert_param function in order to check \n  *         the different sensitivity values for the Interrupts\n  */\n\n#define IS_UART4_CONFIG_IT_OK(Interrupt) \\\n  (((Interrupt) == UART4_IT_PE) || \\\n   ((Interrupt) == UART4_IT_TXE) || \\\n   ((Interrupt) == UART4_IT_TC) || \\\n   ((Interrupt) == UART4_IT_RXNE_OR ) || \\\n   ((Interrupt) == UART4_IT_IDLE) || \\\n   ((Interrupt) == UART4_IT_LHDF) || \\\n   ((Interrupt) == UART4_IT_LBDF))\n\n/**\n  * @brief  Macro used by the assert function in order to check the different \n  *         sensitivity values for the pending bit\n  */\n#define IS_UART4_GET_IT_OK(ITPendingBit) \\\n  (((ITPendingBit) == UART4_IT_TXE)  || \\\n   ((ITPendingBit) == UART4_IT_TC)   || \\\n   ((ITPendingBit) == UART4_IT_RXNE) || \\\n   ((ITPendingBit) == UART4_IT_IDLE) || \\\n   ((ITPendingBit) == UART4_IT_OR)  || \\\n   ((ITPendingBit) == UART4_IT_LBDF)  || \\\n   ((ITPendingBit) == UART4_IT_LHDF)  || \\\n   ((ITPendingBit) == UART4_IT_PE))\n\n/**\n  * @brief  Macro used by the assert function in order to check the different \n  *         sensitivity values for the pending bit that can be cleared by writing 0\n  */\n#define IS_UART4_CLEAR_IT_OK(ITPendingBit) \\\n  (((ITPendingBit) == UART4_IT_RXNE) || \\\n   ((ITPendingBit) == UART4_IT_LHDF) || \\\n   ((ITPendingBit) == UART4_IT_LBDF))\n\n\n/**\n * @brief Macro used by the assert_param function in order to check the different\n *        sensitivity values for the IrDAModes\n */\n#define IS_UART4_IRDAMODE_OK(IrDAMode) \\\n  (((IrDAMode) == UART4_IRDAMODE_LOWPOWER) || \\\n   ((IrDAMode) == UART4_IRDAMODE_NORMAL))\n\n/**\n  * @brief  Macro used by the assert_param function in order to check the different\n  *         sensitivity values for the WakeUps\n  */\n#define IS_UART4_WAKEUP_OK(WakeUp) \\\n  (((WakeUp) == UART4_WAKEUP_IDLELINE) || \\\n   ((WakeUp) == UART4_WAKEUP_ADDRESSMARK))\n\n/**\n  * @brief  Macro used by the assert_param function in order to check the different\n  *         sensitivity values for the LINBreakDetectionLengths\n  */\n#define IS_UART4_LINBREAKDETECTIONLENGTH_OK(LINBreakDetectionLength) \\\n  (((LINBreakDetectionLength) == UART4_LINBREAKDETECTIONLENGTH_10BITS) || \\\n   ((LINBreakDetectionLength) == UART4_LINBREAKDETECTIONLENGTH_11BITS))\n\n/**\n  * @brief  Macro used by the assert_param function in order to check the different\n  *         sensitivity values for the UART4_StopBits\n  */\n#define IS_UART4_STOPBITS_OK(StopBit) (((StopBit) == UART4_STOPBITS_1) || \\\n                                       ((StopBit) == UART4_STOPBITS_0_5) || \\\n                                       ((StopBit) == UART4_STOPBITS_2) || \\\n                                       ((StopBit) == UART4_STOPBITS_1_5 ))\n\n/**\n * @brief Macro used by the assert_param function in order to check the different\n *        sensitivity values for the Paritys\n */\n#define IS_UART4_PARITY_OK(Parity) (((Parity) == UART4_PARITY_NO) || \\\n                                    ((Parity) == UART4_PARITY_EVEN) || \\\n                                    ((Parity) == UART4_PARITY_ODD ))\n\n/**\n * @brief Macro used by the assert_param function in order to check the maximum\n *        baudrate value\n */\n#define IS_UART4_BAUDRATE_OK(NUM) ((NUM) <= (uint32_t)625000)\n\n/**\n * @brief Macro used by the assert_param function in order to check the address \n *        of the UART4 or UART node\n */\n#define UART4_ADDRESS_MAX ((uint8_t)16)\n#define IS_UART4_ADDRESS_OK(node) ((node) < UART4_ADDRESS_MAX )\n\n/**\n * @brief Macro used by the assert_param function in order to check the LIN mode\n */\n#define IS_UART4_SLAVE_OK(Mode) \\\n  (((Mode) == UART4_LIN_MODE_MASTER) || \\\n   ((Mode) == UART4_LIN_MODE_SLAVE))\n\n/**\n * @brief Macro used by the assert_param function in order to check the LIN \n *        automatic resynchronization mode\n */\n#define IS_UART4_AUTOSYNC_OK(AutosyncMode) \\\n  (((AutosyncMode) ==  UART4_LIN_AUTOSYNC_ENABLE) || \\\n   ((AutosyncMode) == UART4_LIN_AUTOSYNC_DISABLE))\n\n/**\n * @brief Macro used by the assert_param function in order to check the LIN divider update method\n */\n#define IS_UART4_DIVUP_OK(DivupMethod) \\\n  (((DivupMethod) == UART4_LIN_DIVUP_LBRR1) || \\\n   ((DivupMethod) == UART4_LIN_DIVUP_NEXTRXNE))\n\n\n/**\n  * @}\n  */\n\n/* Exported functions ------------------------------------------------------- */\n\n/** @addtogroup UART4_Exported_Functions\n  * @{\n  */\nvoid UART4_DeInit(void);\nvoid UART4_Init(uint32_t BaudRate, UART4_WordLength_TypeDef WordLength, \n                UART4_StopBits_TypeDef StopBits, UART4_Parity_TypeDef Parity, \n                UART4_SyncMode_TypeDef SyncMode, UART4_Mode_TypeDef Mode);\nvoid UART4_Cmd(FunctionalState NewState);\nvoid UART4_ITConfig(UART4_IT_TypeDef UART4_IT, FunctionalState NewState);\nvoid UART4_HalfDuplexCmd(FunctionalState NewState);\nvoid UART4_IrDAConfig(UART4_IrDAMode_TypeDef UART4_IrDAMode);\nvoid UART4_IrDACmd(FunctionalState NewState);\nvoid UART4_LINBreakDetectionConfig(UART4_LINBreakDetectionLength_TypeDef UART4_LINBreakDetectionLength);\nvoid UART4_LINConfig(UART4_LinMode_TypeDef UART4_Mode, \n                     UART4_LinAutosync_TypeDef UART4_Autosync, \n                     UART4_LinDivUp_TypeDef UART4_DivUp);\nvoid UART4_LINCmd(FunctionalState NewState);\nvoid UART4_SmartCardCmd(FunctionalState NewState);\nvoid UART4_SmartCardNACKCmd(FunctionalState NewState);\nvoid UART4_WakeUpConfig(UART4_WakeUp_TypeDef UART4_WakeUp);\nvoid UART4_ReceiverWakeUpCmd(FunctionalState NewState);\nuint8_t UART4_ReceiveData8(void);\nuint16_t UART4_ReceiveData9(void);\nvoid UART4_SendData8(uint8_t Data);\nvoid UART4_SendData9(uint16_t Data);\nvoid UART4_SendBreak(void);\nvoid UART4_SetAddress(uint8_t UART4_Address);\nvoid UART4_SetGuardTime(uint8_t UART4_GuardTime);\nvoid UART4_SetPrescaler(uint8_t UART4_Prescaler);\nFlagStatus UART4_GetFlagStatus(UART4_Flag_TypeDef UART4_FLAG);\nvoid UART4_ClearFlag(UART4_Flag_TypeDef UART4_FLAG);\nITStatus UART4_GetITStatus(UART4_IT_TypeDef UART4_IT);\nvoid UART4_ClearITPendingBit(UART4_IT_TypeDef UART4_IT);\n\n\n/**\n  * @}\n  */\n\n#endif /* __STM8S_UART4_H */\n\n/**\n  * @}\n  */\n  \n\n/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\n"
  },
  {
    "path": "src/firmware/tsdz2/stm8s/stm8s_wwdg.h",
    "content": "/**\n  ********************************************************************************\n  * @file    stm8s_wwdg.h\n  * @author  MCD Application Team\n  * @version V2.3.0\n  * @date    16-June-2017\n  * @brief   This file contains all functions prototype and macros for the WWDG peripheral.\n   ******************************************************************************\n  * @attention\n  *\n  * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>\n  *\n  * Licensed under MCD-ST Liberty SW License Agreement V2, (the \"License\");\n  * You may not use this file except in compliance with the License.\n  * You may obtain a copy of the License at:\n  *\n  *        http://www.st.com/software_license_agreement_liberty_v2\n  *\n  * Unless required by applicable law or agreed to in writing, software \n  * distributed under the License is distributed on an \"AS IS\" BASIS, \n  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  * See the License for the specific language governing permissions and\n  * limitations under the License.\n  *\n  ******************************************************************************\n  */\n\n/* Define to prevent recursive inclusion -------------------------------------*/\n#ifndef __STM8S_WWDG_H\n#define __STM8S_WWDG_H\n\n/* Includes ------------------------------------------------------------------*/\n#include \"stm8s.h\"\n\n/** @addtogroup STM8S_StdPeriph_Driver\n  * @{\n  */\n\n/* Private macros ------------------------------------------------------------*/\n\n/** @addtogroup WWDG_Private_Macros\n  * @{\n  */\n\n/**\n  * @brief  Macro used by the assert function in order to check the\n  * values of the window register.\n  */\n#define IS_WWDG_WINDOWLIMITVALUE_OK(WindowLimitValue) ((WindowLimitValue) <= 0x7F)\n\n/**\n  * @brief  Macro used by the assert function in order to check the different\n  * values of the counter register.\n  */\n#define IS_WWDG_COUNTERVALUE_OK(CounterValue) ((CounterValue) <= 0x7F)\n\n/**\n  * @}\n  */\n\n/* Exported types ------------------------------------------------------------*/\n\n/* Exported functions ------------------------------------------------------- */\n\n/** @addtogroup WWDG_Exported_Functions\n  * @{\n  */\n\nvoid WWDG_Init(uint8_t Counter, uint8_t WindowValue);\nvoid WWDG_SetCounter(uint8_t Counter);\nuint8_t WWDG_GetCounter(void);\nvoid WWDG_SWReset(void);\nvoid WWDG_SetWindowValue(uint8_t WindowValue);\n\n\n/**\n  * @}\n  */\n\n#endif /* __STM8S_WWDG_H */\n\n/**\n  * @}\n  */\n\n\n/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\n"
  },
  {
    "path": "src/firmware/tsdz2/system.c",
    "content": "/*\n * bbs-fw\n *\n * Copyright (C) Daniel Nilsson, 2022.\n *\n * Released under the GPL License, Version 3\n */\n\n#include \"system.h\"\n#include \"watchdog.h\"\n#include \"cpu.h\"\n#include \"tsdz2/interrupt.h\"\n#include \"tsdz2/timers.h\"\n\n#include \"tsdz2/stm8s/stm8s.h\"\n#include \"tsdz2/stm8s/stm8s_clk.h\"\n#include \"tsdz2/stm8s/stm8s_tim3.h\"\n\nstatic volatile uint32_t\t_ms;\n\nvoid system_init()\n{\n\tCLK->CKDIVR = 0x00;\t// Set 16MHz\n\twhile ((CLK->ICKR & CLK_ICKR_HSIRDY) == 0); // Wait for stable clock\n\n\t_ms = 0;\n\n\t// Setup timer3 as a ms counter\n\ttimer3_init_system();\n\n\tenableInterrupts();\n}\n\nuint32_t system_ms()\n{\n\tuint32_t val;\n\tuint8_t ier = TIM3->IER;\n\n\tTIM3->IER &= ~(TIM3_IT_UPDATE); // disable timer3 interrupt\n\tval = _ms;\n\n\tTIM3->IER = ier;\n\n\treturn val;\n}\n\nvoid system_delay_ms(uint16_t ms)\n{\n\tif (!ms)\n\t{\n\t\treturn;\n\t}\n\n\tuint32_t end = system_ms() + ms;\n\twhile (system_ms() != end)\n\t{\n\t\twatchdog_yeild();\n\t}\n}\n\nvoid isr_timer3_ovf(void) __interrupt(ITC_IRQ_TIM3_OVF)\n{\n\t_ms++;\n\n\t// Clear interrupt pending bit\n\tTIM3->SR1 &= (uint8_t)(~TIM3_IT_UPDATE);\n}\n"
  },
  {
    "path": "src/firmware/tsdz2/timers.c",
    "content": "/*\n * bbs-fw\n *\n * Copyright (C) Daniel Nilsson, 2022.\n *\n * Released under the GPL License, Version 3\n */\n\n#include \"timers.h\"\n#include \"cpu.h\"\n#include \"tsdz2/stm8s/stm8s.h\"\n#include \"tsdz2/stm8s/stm8s_clk.h\"\n#include \"tsdz2/stm8s/stm8s_tim1.h\"\n#include \"tsdz2/stm8s/stm8s_tim2.h\"\n#include \"tsdz2/stm8s/stm8s_tim3.h\"\n#include \"tsdz2/stm8s/stm8s_tim4.h\"\n\n#define TIM1_AUTO_RELOAD_PERIOD\t\t\t511\n#define TIM2_AUTO_RELOAD_PERIOD\t\t\t159\t\t// 20us\n#define TIM3_AUTO_RELOAD_PERIOD\t\t\t15999\t// 1ms\n#define TIM4_AUTO_RELOAD_PERIOD\t\t\t99\t\t// 100us\n\n\nvoid timers_init()\n{\n\t// nothing to do here\n}\n\n\nvoid timer1_init_motor_pwm()\n{\n\tCLK->PCKENR1 |= CLK_PCKENR1_TIM1;\n\n\t// prescaler\n\tTIM1->PSCRH = 0;\n\tTIM1->PSCRL = 0;\n\n\t// auto reload\n\t// clock = 16MHz, counter period = 1024, PWM freq = 16MHz / 1024 = 15.625MHz\n\t// (BUT PWM center aligned mode needs double frequency)\n\tTIM1->ARRH = (uint8_t)(TIM1_AUTO_RELOAD_PERIOD >> 8);\n\tTIM1->ARRL = (uint8_t)TIM1_AUTO_RELOAD_PERIOD;\n\n\tTIM1->CR1 |= TIM1_COUNTERMODE_CENTERALIGNED1;\n\tTIM1->RCR = 1;\n\n\t// OC1\n\tTIM1->CCER1 |= (uint8_t)(\n\t\t(uint8_t)(TIM1_OUTPUTSTATE_DISABLE & TIM1_CCER1_CC1E) |\n\t\t(uint8_t)(TIM1_OUTPUTNSTATE_DISABLE & TIM1_CCER1_CC1NE) |\n\t\t(uint8_t)(TIM1_OCPOLARITY_HIGH & TIM1_CCER1_CC1P) |\n\t\t(uint8_t)(TIM1_OCNPOLARITY_HIGH & TIM1_CCER1_CC1NP)\n\t);\n\n\tTIM1->CCMR1 |= TIM1_OCMODE_PWM1;\n\n\tTIM1->OISR |= (uint8_t)(\n\t\t(uint8_t)(TIM1_OCIDLESTATE_RESET & TIM1_OISR_OIS1) |\n\t\t(uint8_t)(TIM1_OCNIDLESTATE_SET & TIM1_OISR_OIS1N)\n\t);\n\n\tTIM1->CCR1H = 0;\n\tTIM1->CCR1L = 255;\n\n\n\t// OC2\n\tTIM1->CCER1 |= (uint8_t)(\n\t\t(uint8_t)(TIM1_OUTPUTSTATE_DISABLE & TIM1_CCER1_CC2E) |\n\t\t(uint8_t)(TIM1_OUTPUTNSTATE_DISABLE & TIM1_CCER1_CC2NE) |\n\t\t(uint8_t)(TIM1_OCPOLARITY_HIGH & TIM1_CCER1_CC2P) |\n\t\t(uint8_t)(TIM1_OCNPOLARITY_HIGH & TIM1_CCER1_CC2NP)\n\t\t);\n\n\tTIM1->CCMR2 |= TIM1_OCMODE_PWM1;\n\n\tTIM1->OISR |= (uint8_t)(\n\t\t(uint8_t)(TIM1_OCIDLESTATE_RESET & TIM1_OISR_OIS2) |\n\t\t(uint8_t)(TIM1_OCNIDLESTATE_SET & TIM1_OISR_OIS2N)\n\t\t);\n\n\tTIM1->CCR2H = 0;\n\tTIM1->CCR2L = 255;\n\n\t// OC3\n\tTIM1->CCER2 |= (uint8_t)(\n\t\t(uint8_t)(TIM1_OUTPUTSTATE_DISABLE & TIM1_CCER2_CC3E) |\n\t\t(uint8_t)(TIM1_OUTPUTNSTATE_DISABLE & TIM1_CCER2_CC3NE) |\n\t\t(uint8_t)(TIM1_OCPOLARITY_HIGH & TIM1_CCER2_CC3P) |\n\t\t(uint8_t)(TIM1_OCNPOLARITY_HIGH & TIM1_CCER2_CC3NP)\n\t\t);\n\n\tTIM1->CCMR3 |= TIM1_OCMODE_PWM1;\n\n\tTIM1->OISR |= (uint8_t)(\n\t\t(uint8_t)(TIM1_OCIDLESTATE_RESET & TIM1_OISR_OIS3) |\n\t\t(uint8_t)(TIM1_OCNIDLESTATE_SET & TIM1_OISR_OIS3N)\n\t\t);\n\n\tTIM1->CCR3H = 0;\n\tTIM1->CCR3L = 255;\n\n\t// OC4\n\t// Used for to fire interrupt at a specific time (middle of DC link current pulses)\n\t// and is always syncronized with PWM\n\n\tTIM1->CCER2 |= (uint8_t)(\n\t\t(uint8_t)(TIM1_OUTPUTSTATE_DISABLE & TIM1_CCER2_CC4E) |\n\t\t(uint8_t)(TIM1_OCPOLARITY_HIGH & TIM1_CCER2_CC4P)\n\t);\n\n\tTIM1->OISR &= (uint8_t)(~TIM1_OISR_OIS4);\n\n\t// timming for interrupt firing (hand adjusted)\n\tconst uint16_t Timing = 285;\n\n\tTIM1->CCR4H = (uint8_t)(Timing >> 8);\n\tTIM1->CCR4L = (uint8_t)Timing;\n\n\t// hardware needs a dead time of 1us\n\t//\t16, // DTG = 0; dead time in 62.5 ns steps; 1us/62.5ns = 16\n\tTIM1->DTR = (uint8_t)16;\n\n\tTIM1->BKR = (uint8_t)(\n\t\tTIM1_OSSISTATE_ENABLE |\n\t\tTIM1_LOCKLEVEL_OFF |\n\t\tTIM1_BREAK_DISABLE |\n\t\tTIM1_BREAKPOLARITY_LOW |\n\t\tTIM1_AUTOMATICOUTPUT_DISABLE\n\t);\n\n\t// enable cc4 interrupt\n\tTIM1->IER |= TIM1_IT_CC4;\n\n\t// enable timer\n\tTIM1->CR1 |= TIM1_CR1_CEN;\n\n\tTIM1->BKR |= TIM1_BKR_MOE;\n}\n\nvoid timer2_init_torque_sensor_pwm()\n{\n\t// Timer2 is used to create the pulse signal for excitation of the torque sensor circuit\n\t// Timer2 clock = 16MHz; target: 20us period --> 50khz\n\t// counter period = (1 / (16000000 / prescaler)) * (159 + 1) = 20us\n\n\t// set period\n\tTIM2->PSCR = TIM2_PRESCALER_2;\n\tTIM2->ARRH = (uint8_t)(TIM2_AUTO_RELOAD_PERIOD >> 8);\n\tTIM2->ARRL = (uint8_t)(TIM2_AUTO_RELOAD_PERIOD);\n\n\t// pulse of 2us\n\tTIM2->CCER1 |= TIM2_CCER1_CC2E; // output enable\n\tTIM2->CCMR2 |= TIM2_OCMODE_PWM1;\n\tTIM2->CCR2H = 0;\n\tTIM2->CCR2L = 16;\n\n\t// enable\n\tTIM2->CCMR2 |= TIM2_CCMR_OCxPE;\n\tTIM2->CR1 |= TIM2_CR1_ARPE;\n\tTIM2->CR1 |= TIM2_CR1_CEN;\n}\n\nvoid timer3_init_system()\n{\n\t// enable timer3 clock source\n\tCLK->PCKENR1 |= CLK_PCKENR1_TIM3;\n\n\t// set period\n\tTIM3->PSCR = TIM3_PRESCALER_1;\n\tTIM3->ARRH = (uint8_t)(TIM3_AUTO_RELOAD_PERIOD >> 8);\n\tTIM3->ARRL = (uint8_t)(TIM3_AUTO_RELOAD_PERIOD);\n\n\t// clear counter\n\tTIM3->CNTRH = 0;\n\tTIM3->CNTRL = 0;\n\n\t// enable TIM3 interrupt\n\tTIM3->IER |= TIM3_IT_UPDATE;\n\n\t// clear interrupt pending bit\n\tTIM3->SR1 &= ~TIM3_IT_UPDATE;\n\n\t// TIM3 enable\n\tTIM3->CR1 |= TIM3_CR1_CEN;\n}\n\nvoid timer4_init_sensors()\n{\n\t// enable timer4 clock source\n\tCLK->PCKENR1 |= CLK_PCKENR1_TIM4;\n\n\t// set period\n\tTIM4->PSCR = TIM4_PRESCALER_16;\n\tTIM4->ARR = TIM4_AUTO_RELOAD_PERIOD;\n\n\t// clear counter\n\tTIM4->CNTR = 0;\n\n\t// enable TIM4 interrupt\n\tTIM4->IER |= TIM4_IT_UPDATE;\n\n\t// clear interrupt pending bit\n\tTIM4->SR1 &= ~TIM4_IT_UPDATE;\n\n\t// TIM4 enable\n\tTIM4->CR1 |= TIM4_CR1_CEN;\n}\n"
  },
  {
    "path": "src/firmware/tsdz2/timers.h",
    "content": "/*\n * bbs-fw\n *\n * Copyright (C) Daniel Nilsson, 2022.\n *\n * Released under the GPL License, Version 3\n */\n\n#ifndef _TSDZ2_TIMERS_H_\n#define _TSDZ2_TIMERS_H_\n\n\nvoid timer1_init_motor_pwm();\nvoid timer2_init_torque_sensor_pwm();\nvoid timer3_init_system();\nvoid timer4_init_sensors();\n\n#endif\n"
  },
  {
    "path": "src/firmware/tsdz2/torquesensor.c",
    "content": "/*\n * bbs-fw\n *\n * Copyright (C) Daniel Nilsson, 2022.\n *\n * Released under the GPL License, Version 3\n */\n#include <stdint.h>\n#include \"system.h\"\n#include \"sensors.h\"\n#include \"adc.h\"\n#include \"util.h\"\n#include \"eventlog.h\"\n#include \"tsdz2/stm8.h\"\n#include \"tsdz2/pins.h\"\n#include \"tsdz2/stm8s/stm8s_adc1.h\"\n#include \"tsdz2/timers.h\"\n\n\n#define AUTO_BIAS_START_TIME_MS\t\t2000\n#define AUTO_BIAS_DURATION_MS\t\t3000\n\n// Hard coded default torque sensor calibration table for now\n//\n// Torque sensor readings on different TSDZ2 differs by a lot.\n// This table is therefore not perfect for every motor but\n// it will have to be good enough for now.\n//\n// Default firmware has no way to calibrate, no idea if calibrations\n// is done at factory though.\n//\n// Consider adding manual calibration though config tool at some point.\n// Until then, sensitivity can be set using torque amplification factor,\n// which works well enough even if response will potentially not be linear.\n\n#define TORQUE_SENSOR_LUT_SIZE 8\n\ntypedef struct { uint8_t adc; uint16_t nm_x100; } torque_lut_t;\nstatic const torque_lut_t torque_sensor_lut[TORQUE_SENSOR_LUT_SIZE] =\n{\n\t// (adc value - bias), (Nm x 100) \n\t{ 0,   0     },\t// 0kg\n\t{ 30,  834   },\t// 5kg\n\t{ 55,  1668  },\t// 10kg\n\t{ 78,  2502  },\t// 15kg\n\t{ 93,  3169  },\t// 19kg\n\t{ 188, 7004  },\t// 42kg\n\t{ 204, 8672  },\t// 52kg\n\t{ 224, 17511 }\t// 105kg\n};\n\nstatic uint16_t torque_adc_to_nm_x100(uint16_t torque_adc)\n{\n\t// interpolate in lookup table\n\n\tif (torque_adc < torque_sensor_lut[0].adc)\n\t{\n\t\t// use minimum value\n\t\treturn torque_sensor_lut[0].nm_x100;\n\t}\n\telse if (torque_adc > torque_sensor_lut[TORQUE_SENSOR_LUT_SIZE - 1].adc)\n\t{\n\t\t// use maximum value\n\t\treturn torque_sensor_lut[TORQUE_SENSOR_LUT_SIZE - 1].nm_x100;\n\t}\n\n\tuint8_t i = 0;\n\tfor (i = 0; i < TORQUE_SENSOR_LUT_SIZE - 1; i++)\n\t{\n\t\tif (torque_sensor_lut[i + 1].adc > torque_adc)\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t}\n\n\treturn (uint16_t)MAP32(torque_adc,\n\t\ttorque_sensor_lut[i].adc,\n\t\ttorque_sensor_lut[i + 1].adc,\n\t\ttorque_sensor_lut[i].nm_x100,\n\t\ttorque_sensor_lut[i + 1].nm_x100);\n}\n\nstatic uint16_t torque_nm_x100 = 0;\n\nstatic bool adc_bias_set = false;\nstatic uint16_t adc_bias_steps = 0;\n\n\nvoid torque_sensor_init()\n{\n\tSET_PIN_OUTPUT_OPEN_DRAIN(PIN_TORQUE_SENSOR_EXC);\n\n\ttimer2_init_torque_sensor_pwm();\n\n\t// some delay for torque sensor to power on\n\tsystem_delay_ms(50);\n}\n\nvoid torque_sensor_process()\n{\n\tif (adc_bias_set)\n\t{\n\t\tuint16_t adc_val = adc_get_torque();\n\t\tif (adc_val > adc_bias_steps)\n\t\t{\n\t\t\tadc_val -= adc_bias_steps;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tadc_val = 0;\n\t\t}\n\n\t\t// IDEA: Find max over pedal revolution period and use sin average (0.637)?\n\t\t// Doesn't seem to be needed, hw filtering seems to be very slow and should average just fine\n\t\ttorque_nm_x100 = torque_adc_to_nm_x100(adc_val);\n\t}\n\telse\n\t{\n\t\t// find torque sensor adc bias during startup, torque sensor lookup table is relative to bias\n\n\t\tuint32_t now = system_ms();\n\t\tif (now < (AUTO_BIAS_START_TIME_MS + AUTO_BIAS_DURATION_MS))\n\t\t{\n\t\t\tif (now > AUTO_BIAS_START_TIME_MS)\n\t\t\t{\n\t\t\t\tuint16_t adc_val = adc_get_torque();\n\t\t\t\tif (adc_val > adc_bias_steps)\n\t\t\t\t{\n\t\t\t\t\tadc_bias_steps = adc_val;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tadc_bias_set = true;\n\t\t\teventlog_write_data(EVT_DATA_TORQUE_ADC_CALIBRATED, adc_bias_steps);\n\t\t}\n\t}\n}\n\nuint16_t torque_sensor_get_nm_x100()\n{\n\treturn torque_nm_x100;\n}\n\nbool torque_sensor_ok()\n{\n\treturn !adc_bias_set || adc_bias_steps > 50;\n}\n"
  },
  {
    "path": "src/firmware/tsdz2/uart.c",
    "content": "/*\n * bbs-fw\n *\n * Copyright (C) Daniel Nilsson, 2022.\n *\n * Released under the GPL License, Version 3\n */\n\n#include \"uart.h\"\n#include \"interrupt.h\"\n#include \"watchdog.h\"\n\n#include <stdint.h>\n\n\n#define RX1_BUFFER_SIZE\t\t\t64\n#define RX1_BUFFER_MASK\t\t\t(RX1_BUFFER_SIZE - 1)\n\n#define TX1_BUFFER_SIZE\t\t\t32\n#define TX1_BUFFER_MASK\t\t\t(TX1_BUFFER_SIZE - 1)\n\nstatic volatile uint8_t rx1_head;\nstatic volatile uint8_t rx1_tail;\nstatic volatile uint8_t rx1_buf[RX1_BUFFER_SIZE];\nstatic volatile uint8_t tx1_head;\nstatic volatile uint8_t tx1_tail;\nstatic volatile uint8_t tx1_sending;\nstatic volatile uint8_t tx1_buf[TX1_BUFFER_SIZE];\n\nvoid uart_open(uint32_t baudrate)\n{\n\trx1_head = 0;\n\trx1_tail = 0;\n\ttx1_head = 0;\n\ttx1_tail = 0;\n\ttx1_sending = 0;\n\n\t// enable uart2 clock\n\tCLK->PCKENR1 |= CLK_PCKENR1_UART2;\n\n\t// default, 8bit, no parity, 1 stop bit etc\n\tUART2->CR1 = 0x00;\n\tUART2->CR2 = 0x00;\n\tUART2->CR3 = 0x00;\n\n\t// clear the LSB mantissa of UART2DIV\n\tUART2->BRR1 &= (uint8_t)(~UART2_BRR1_DIVM);\n\t// clear the MSB mantissa of UART2DIV\n\tUART2->BRR2 &= (uint8_t)(~UART2_BRR2_DIVM);\n\t// clear the fraction bits of UART2DIV\n\tUART2->BRR2 &= (uint8_t)(~UART2_BRR2_DIVF);\n\n\t// set the UART2 baudrate in BRR1 and BRR2 registers according to baudrate value\n\tuint32_t baud_mantissa = ((uint32_t)CPU_FREQ / (baudrate << 4));\n\tuint32_t baud_mantissa100 = (((uint32_t)CPU_FREQ * 100) / (baudrate << 4));\n\n\tuint8_t BRR2_1 = (uint8_t)((uint8_t)(((baud_mantissa100 - (baud_mantissa * 100)) << 4) / 100) & (uint8_t)0x0F);\n\tuint8_t BRR2_2 = (uint8_t)((baud_mantissa >> 4) & (uint8_t)0xF0);\n\n\tUART2->BRR2 = (uint8_t)(BRR2_1 | BRR2_2);\n\tUART2->BRR1 = (uint8_t)baud_mantissa;\n\n\t// enable rx and tx\n\tUART2->CR2 |= UART2_CR2_TEN;\n\tUART2->CR2 |= UART2_CR2_REN;\n\n\t// clear rx and tx interrupt flags\n\tUART2->SR &= ~UART2_SR_RXNE;\n\n\t// enable rx interrupts\n\tUART2->CR2 |= UART2_CR2_RIEN;\n}\n\nvoid uart_close()\n{\n\tUART2->BRR2 = 0x00;\n\tUART2->BRR1 = 0x00;\n\n\tUART2->CR1 = 0x00;\n\tUART2->CR2 = 0x00;\n\tUART2->CR3 = 0x00;\n}\n\nuint8_t uart_available()\n{\n\treturn (RX1_BUFFER_SIZE + rx1_head - rx1_tail) & RX1_BUFFER_MASK;\n}\n\nuint8_t uart_read()\n{\n\tuint8_t byte = rx1_buf[rx1_tail];\n\trx1_tail = (rx1_tail + 1) & RX1_BUFFER_MASK;\n\treturn byte;\n}\n\nvoid uart_write(uint8_t byte)\n{\n\tif (!tx1_sending)\n\t{\n\t\ttx1_sending = 1;\n\t\tUART2->DR = byte;\n\t\tUART2->CR2 |= UART2_CR2_TIEN; // enable tx done interrupt\n\n\t\treturn;\n\t}\n\n\tuint8_t i = (tx1_head + 1) & TX1_BUFFER_MASK;\n\n\t// wait for free space in buffer\n\tuint8_t prev_tail = tx1_tail;\n\twhile (i == tx1_tail)\n\t{\n\t\tif (tx1_tail != prev_tail)\n\t\t{\n\t\t\tprev_tail = tx1_tail;\n\t\t\twatchdog_yeild();\n\t\t}\n\t}\n\n\ttx1_buf[tx1_head] = byte;\n\ttx1_head = i;\n}\n\nvoid uart_flush()\n{\n\twhile (tx1_sending);\n}\n\n\n\nvoid isr_uart2_rx(void) __interrupt(ITC_IRQ_UART2_RX)\n{\n\tif (UART2->SR & UART2_SR_RXNE)\n\t{\n\t\tuint8_t c = UART2->DR;\n\t\tuint8_t i = (rx1_head + 1) & RX1_BUFFER_MASK;\n\n\t\tif (i != rx1_tail)\n\t\t{\n\t\t\trx1_buf[rx1_head] = c;\n\t\t\trx1_head = i;\n\t\t}\n\t}\n}\n\nvoid isr_uart2_tx(void) __interrupt(ITC_IRQ_UART2_TX)\n{\n\tif (UART2->SR & UART2_SR_TXE)\n\t{\n\t\tif (tx1_head != tx1_tail)\n\t\t{\n\t\t\ttx1_sending = 1;\n\n\t\t\tUART2->DR = tx1_buf[tx1_tail];\n\t\t\ttx1_tail = (tx1_tail + 1) & TX1_BUFFER_MASK;\n\t\t}\n\t\telse\n\t\t{\n\t\t\ttx1_sending = 0;\n\t\t\t// no more data clear tx empty flag\n\t\t\tUART2->CR2 &= ~UART2_CR2_TIEN;\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/firmware/tsdz2/watchdog.c",
    "content": "/*\n * bbs-fw\n *\n * Copyright (C) Daniel Nilsson, 2022.\n *\n * Released under the GPL License, Version 3\n */\n\n#include \"watchdog.h\"\n#include \"tsdz2/cpu.h\"\n#include \"tsdz2/stm8s/stm8s_iwdg.h\"\n\nstatic bool triggered;\n\nvoid watchdog_init()\n{\n\t// :TODO: implement if possible, check if reset triggered by watchdog\n\ttriggered = false;\n\n\tIWDG->KR = 0xcc;\t// start\n\tIWDG->KR = 0x55;\t// unlock\n\tIWDG->PR = 6;\t\t// divide by 256\n\tIWDG->RLR = 156;\t// reload to 625 milliseconds\n\n\twatchdog_yeild();\n}\n\nvoid watchdog_yeild()\n{\n\tIWDG->KR = 0xaa;\n}\n\nbool watchdog_triggered()\n{\n\treturn triggered;\n}\n"
  },
  {
    "path": "src/firmware/uart.h",
    "content": "/*\n * bbs-fw\n *\n * Copyright (C) Daniel Nilsson, 2022.\n *\n * Released under the GPL License, Version 3\n */\n\n#ifndef _UART_H_\n#define _UART_H_\n\n#include <stdint.h>\n\nvoid uart_open(uint32_t baudrate);\nvoid uart_close();\n\nuint8_t uart_available();\nuint8_t uart_read();\n\nvoid uart_write(uint8_t byte);\nvoid uart_flush();\n\n#endif\n"
  },
  {
    "path": "src/firmware/util.h",
    "content": "/*\n * bbs-fw\n *\n * Copyright (C) Daniel Nilsson, 2022.\n *\n * Released under the GPL License, Version 3\n */\n\n#ifndef _UTIL_H_\n#define _UTIL_H_\n\n#include <stdint.h>\n\n#define MAP16(x, in_min, in_max, out_min, out_max)\t((((int16_t)x) - (in_min)) * ((out_max) - (out_min)) / ((in_max) - (in_min)) + (out_min))\n#define MAP32(x, in_min, in_max, out_min, out_max)\t((((int32_t)x) - (in_min)) * ((out_max) - (out_min)) / ((in_max) - (in_min)) + (out_min))\n\n#define EXPAND_U16(high, low) ((((uint16_t)high) << 8) | (uint8_t)low)\n#define EXPAND_I16(high, low) ((int16_t)EXPAND_U16(high,low))\n\n#define ABS(x) (x) < 0 ? -(x) : (x)\n\n#define MAX(x, y) (x) > (y) ? (x) : (y)\n#define MIN(x, y) (x) < (y) ? (x) : (y)\n\n#define CLAMP(x, min, max) (MIN(MAX(x, min), max))\n\n// Low pass filter\n// value + (new_value - value) / n;\n#define EXPONENTIAL_FILTER(value, new_value, n)\t\t(value) + ((new_value) - (value)) / (n)\t\t\n\n#endif\n\n"
  },
  {
    "path": "src/firmware/version.h",
    "content": "/*\r\n * bbs-fw\r\n *\r\n * Copyright (C) Daniel Nilsson, 2022.\r\n *\r\n * Released under the GPL License, Version 3\r\n */\r\n\r\n#ifndef _VERSION_H_\r\n#define _VERSION_H_\r\n\r\n#define VERSION_MAJOR\t\t1\r\n#define VERSION_MINOR\t\t5\r\n#define VERSION_PATCH\t\t99\r\n\r\n\r\n#if defined(BBSHD)\r\n\t#define CTRL_TYPE\t\t1\r\n#elif defined(BBS02)\r\n\t#define CTRL_TYPE\t\t2\r\n#elif defined(TSDZ2)\r\n\t#define CTRL_TYPE\t\t3\r\n#else\r\n\t#define CTRL_TYPE\t\t0\r\n#endif\r\n\r\n#endif\r\n"
  },
  {
    "path": "src/firmware/watchdog.h",
    "content": "/*\n * bbs-fw\n *\n * Copyright (C) Daniel Nilsson, 2022.\n *\n * Released under the GPL License, Version 3\n */\n\n#ifndef _WATCHDOG_H_\n#define _WATCHDOG_H_\n\n#include \"intellisense.h\"\n#include <stdint.h>\n#include <stdbool.h>\n\nvoid watchdog_init();\nvoid watchdog_yeild();\n\nbool watchdog_triggered();\n\n#endif\n\n"
  },
  {
    "path": "src/logger/.gitignore",
    "content": ".pio\n.vscode/.browse.c_cpp.db*\n.vscode/c_cpp_properties.json\n.vscode/launch.json\n.vscode/ipch\n"
  },
  {
    "path": "src/logger/.vscode/extensions.json",
    "content": "{\n    // See http://go.microsoft.com/fwlink/?LinkId=827846\n    // for the documentation about the extensions.json format\n    \"recommendations\": [\n        \"platformio.platformio-ide\"\n    ],\n    \"unwantedRecommendations\": [\n        \"ms-vscode.cpptools-extension-pack\"\n    ]\n}\n"
  },
  {
    "path": "src/logger/include/ComProxy.h",
    "content": "\n#include <Arduino.h>\n#include <SoftwareSerial.h>\n\n#define EVT_MSG_MOTOR_INIT_OK\t\t\t\t1\n#define EVT_MSG_CONFIG_READ\t\t\t\t\t2\n#define EVT_MSG_CONFIG_RESET\t\t\t\t3\n#define EVT_MSG_CONFIG_WRITTEN\t\t\t\t4\n\n#define EVT_ERROR_INIT_MOTOR\t\t\t\t64\n#define EVT_ERROR_CHANGE_TARGET_SPEED\t\t65\n#define EVT_ERROR_CHANGE_TARGET_CURRENT\t\t66\n#define EVT_ERROR_READ_MOTOR_STATUS\t\t\t67\n#define EVT_ERROR_READ_MOTOR_CURRENT\t\t68\n#define EVT_ERROR_READ_MOTOR_VOLTAGE\t\t69\n\n#define EVT_ERROR_CONFIG_READ_EEPROM\t\t70\n#define EVT_ERROR_CONFIG_WRITE_EEPROM\t\t71\n#define EVT_ERROR_CONFIG_ERASE_EEPROM\t\t72\n#define EVT_ERROR_CONFIG_VERSION\t\t\t73\n#define EVT_ERROR_CONFIG_CHECKSUM\t\t\t74\n#define EVT_ERROR_THROTTLE_LOW_LIMIT\t\t75\n#define EVT_ERROR_THROTTLE_HIGH_LIMIT\t\t76\n\n\n#define EVT_DATA_TARGET_CURRENT\t\t\t\t128\n#define EVT_DATA_TARGET_SPEED\t\t\t\t129\n#define EVT_DATA_MOTOR_STATUS\t\t\t\t130\n#define EVT_DATA_ASSIST_LEVEL\t\t\t\t131\n#define EVT_DATA_OPERATION_MODE\t\t\t\t132\n#define EVT_DATA_WHEEL_SPEED_PPM\t\t\t133\n#define EVT_DATA_LIGHTS\t\t\t\t\t\t134\n#define EVT_DATA_TEMPERATURE\t\t\t\t135\n#define EVT_DATA_THERMAL_LIMITING\t\t\t136\n#define EVT_DATA_SPEED_LIMITING\t\t\t\t137\n#define EVT_DATA_MAX_CURRENT_ADC_REQUEST\t138\n#define EVT_DATA_MAX_CURRENT_ADC_RESPONSE\t139\n#define EVT_DATA_MAIN_LOOP_TIME\t\t\t\t140\n#define EVT_DATA_THROTTLE_ADC\t\t\t\t141 \n#define EVT_DATA_LVC_LIMITING\t\t\t\t142\n#define EVT_DATA_SHIFT_SENSOR\t\t\t\t143\n\n\nclass ComProxy\n{\npublic:\n    struct Event\n    {\n        uint32_t timestamp;\n        uint8_t id;\n        int16_t data;\n    };\n\n    static void printFormat(Stream& stream, const Event& e);\n\n    ComProxy(Stream& controller, Stream& display, Stream& log);\n\n    bool connect();\n    bool isConnected() const;\n\n    void process();\n\n    bool hasLogEvent() const;\n    bool getLogEvent(Event& e);\n\nprivate:\n    void processControllerTx();\n    void processDisplayTx();\n\n    void flushInterceptbuffer();\n    bool interceptMessage();\n\n    int tryProcessControllerMessage();\n    int processReadRequestResponse();\n    int processWriteRequestResponse();\n    int processEventLogMessage();\n\nprivate:\n    Stream& _log;\n    Stream& _controller;\n    Stream& _display;\n    bool _connected;\n    uint8_t _msgLen;\n    uint8_t _msgBuf[128];\n    uint32_t _lastRecv;\n\n    bool _hasEvent;\n    Event _event;\n};\n"
  },
  {
    "path": "src/logger/platformio.ini",
    "content": "; PlatformIO Project Configuration File\n;\n;   Build options: build flags, source filter\n;   Upload options: custom upload port, speed and extra flags\n;   Library options: dependencies, extra library storages\n;   Advanced options: extra scripting\n;\n; Please visit documentation for the other options and examples\n; https://docs.platformio.org/page/projectconf.html\n\n[env:nanoatmega328]\nplatform = atmelavr\nboard = nanoatmega328\nframework = arduino\nlib_deps = \n\tfeatherfly/SoftwareSerial@^1.0\n\tpaulstoffregen/AltSoftSerial@^1.4\nupload_port = COM8\nmonitor_port = COM4\nmonitor_speed = 57600\n"
  },
  {
    "path": "src/logger/src/ComProxy.cpp",
    "content": "#include \"ComProxy.h\"\n\n#define KEEP\t\t            0\n#define FAIL\t\t            -1\n\n\n#define REQUEST_TYPE_READ\t\t\t\t\t\t0x01\n#define REQUEST_TYPE_WRITE\t\t\t\t\t\t0x02\n\n// Firmware config tool communication (only expected opcodes)\n#define OPCODE_READ_FW_VERSION\t\t\t\t\t0x01\n#define OPCODE_READ_EVTLOG_ENABLE\t\t\t\t0x02\n\n#define OPCODE_WRITE_EVTLOG_ENABLE\t\t\t\t0xf0\n\n#define EVENT_LOG_ENTRY         \t\t\t\t0xee\n#define EVENT_LOG_DATA_ENTRY \t\t\t\t\t0xed\n\n\nstatic uint8_t computeChecksum(uint8_t* buf, uint8_t length)\n{\n\tuint8_t result = 0;\n\tfor (uint8_t i = 0; i < length; ++i)\n\t{\n\t\tresult += buf[i];\n\t}\n\n\treturn result;\n}\n\nint verifyControllerMessage(uint8_t* buf, uint8_t length, uint8_t requiredLength, Stream& log)\n{\n\tif (length < requiredLength)\n\t{\n\t\treturn KEEP;\n\t}\n\n\tuint8_t checksum = computeChecksum(buf, requiredLength - 1);\n\tif (checksum == buf[requiredLength - 1])\n\t{\n\t\treturn requiredLength;\n\t}\n\t/*else\n\t{\n\t\tlog.print(\"Checksum mismatch, computed=\");\n\t\tlog.print(checksum, HEX);\n\t\tlog.print(\" message=\");\n\t\tfor (uint8_t i = 0; i < requiredLength; i++)\n\t\t{\n\t\t\tlog.print(buf[i], HEX);\n\t\t\tlog.print(\" \");\n\t\t}\n\t\tlog.println();\n\t}*/\n\n\treturn FAIL;\n}\n\n\nvoid ComProxy::printFormat(Stream& stream, const Event& evt)\n{\n\tswitch (evt.id)\n\t{\n\tcase EVT_MSG_MOTOR_INIT_OK:\n\t\tstream.print(F(\"Motor initialization successful.\"));\n\t\tbreak;\n\tcase EVT_MSG_CONFIG_READ:\n\t\tstream.print(F(\"Successfully read configuration from eeprom.\"));\n\t\tbreak;\n\tcase EVT_MSG_CONFIG_RESET:\n\t\tstream.print(F(\"Configuration reset performed.\"));\n\t\tbreak;\n\tcase EVT_MSG_CONFIG_WRITTEN:\n\t\tstream.print(F(\"Configuration written to eeprom.\"));\n\t\tbreak;\n\tcase EVT_ERROR_INIT_MOTOR:\n\t\tstream.print(F(\"Failed to perform motor controller initialization.\"));\n\t\tbreak;\n\tcase EVT_ERROR_CHANGE_TARGET_CURRENT:\n\t\tstream.print(F(\"Failed to set motor target current on motor controller.\"));\n\t\tbreak;\n\tcase EVT_ERROR_CHANGE_TARGET_SPEED:\n\t\tstream.print(F(\"Failed to set motor target speed on motor controller.\"));\n\t\tbreak;\n\tcase EVT_ERROR_READ_MOTOR_STATUS:\n\t\tstream.print(F(\"Failed to read status from motor controller.\"));\n\t\tbreak;\n\tcase EVT_ERROR_READ_MOTOR_CURRENT:\n\t\tstream.print(F(\"Failed to read current from motor controller.\"));\n\t\tbreak;\n\tcase EVT_ERROR_READ_MOTOR_VOLTAGE:\n\t\tstream.print(F(\"Failed to read voltage from motor controller.\"));\n\t\tbreak;\n\tcase EVT_ERROR_CONFIG_READ_EEPROM:\n\t\tstream.print(F(\"Failed to read config from eeprom.\"));\n\t\tbreak;\n\tcase EVT_ERROR_CONFIG_WRITE_EEPROM:\n\t\tstream.print(F(\"Failed to write config to eeprom.\"));\n\t\tbreak;\n\tcase EVT_ERROR_CONFIG_ERASE_EEPROM:\n\t\tstream.print(F(\"Failed to erase eeprom before writing config.\"));\n\t\tbreak;\n\tcase EVT_ERROR_CONFIG_VERSION:\n\t\tstream.print(F(\"Configuration read from eeprom is of the wrong version.\"));\n\t\tbreak;\n\tcase EVT_ERROR_CONFIG_CHECKSUM:\n\t\tstream.print(F(\"Failed to verify checksum on configuration read from eeprom.\"));\n\t\tbreak;\n\tcase EVT_ERROR_THROTTLE_LOW_LIMIT:\n\t\tstream.print(F(\"Invalid throttle reading, below low limit, check throttle.\"));\n\t\tbreak;\n\tcase EVT_ERROR_THROTTLE_HIGH_LIMIT:\n\t\tstream.print(F(\"Invalid throttle reading, above high limit, check throttle.\"));\n\t\tbreak;\n\n\tcase EVT_DATA_TARGET_CURRENT:\n\t\tstream.print(F(\"Motor target current changed to \"));\n\t\tstream.print(evt.data);\n\t\tstream.print(F(\"%\"));\n\t\tbreak;\n\tcase EVT_DATA_TARGET_SPEED:\n\t\tstream.print(F(\"Motor target speed changed to \"));\n\t\tstream.print((evt.data * 100) / 255);\n\t\tstream.print(F(\"%.\"));\n\t\tbreak;\n\tcase EVT_DATA_MOTOR_STATUS:\n\t\tstream.print(F(\"Motor controller status changed to \"));\n\t\tstream.print(evt.data, HEX);\n\t\tstream.print(F(\".\"));\n\t\tbreak;\n\tcase EVT_DATA_ASSIST_LEVEL:\n\t\tstream.print(F(\"Assist level changed to \"));\n\t\tstream.print(evt.data);\n\t\tstream.print(F(\".\"));\n\t\tbreak;\n\tcase EVT_DATA_OPERATION_MODE:\n\t\tstream.print(F(\"Operation mode changed to \"));\n\t\tstream.print(evt.data);\n\t\tstream.print(F(\".\"));\n\t\tbreak;\n\tcase EVT_DATA_WHEEL_SPEED_PPM:\n\t\tstream.print(F(\"Max wheel speed changed to \"));\n\t\tstream.print(evt.data);\n\t\tstream.print(F(\" rpm.\"));\n\t\tbreak;\n\tcase EVT_DATA_LIGHTS:\n\t\tstream.print(F(\"Lights status changed to \"));\n\t\tstream.print(evt.data);\n\t\tstream.print(F(\".\"));\n\t\tbreak;\n\tcase EVT_DATA_TEMPERATURE:\n\t\tstream.print(F(\"Motor controller temperature changed to \"));\n\t\tstream.print(evt.data);\n\t\tstream.print(F(\"C.\"));\n\t\tbreak;\n\tcase EVT_DATA_THERMAL_LIMITING:\n\t\tif (evt.data != 0)\n\t\t{\n\t\t\tstream.print(F(\"Thermal limit reached, power reduced to 50%.\"));\n\t\t}\n\t\telse\n\t\t{\n\t\t\tstream.print(F(\"Thermal limiting removed.\"));\n\t\t}\n\t\tbreak;\n\tcase EVT_DATA_SPEED_LIMITING:\n\t\tif (evt.data != 0)\n\t\t{\n\t\t\tstream.print(F(\"Speed limiting activated.\"));\n\t\t}\n\t\telse\n\t\t{\n\t\t\tstream.print(F(\"Speed limiting deactivated.\"));\n\t\t}\n\t\tbreak;\n\tcase EVT_DATA_MAX_CURRENT_ADC_REQUEST:\n\t\tstream.print(F(\"Requesting to configure max current on motor controller mcu, adc=\"));\n\t\tstream.print(evt.data);\n\t\tstream.print(\".\");\n\t\tbreak;\n\tcase EVT_DATA_MAX_CURRENT_ADC_RESPONSE:\n\t\tstream.print(F(\"Max current configured on motor controller mcu, response was adc=\"));\n\t\tstream.print(evt.data);\n\t\tstream.print(F(\".\"));\n\t\tbreak;\n\tcase EVT_DATA_MAIN_LOOP_TIME:\n\t\tstream.print(F(\"Main loop, interval=\"));\n\t\tstream.print(evt.data);\n\t\tstream.print(F(\"ms.\"));\n\t\tbreak;\n\tcase EVT_DATA_THROTTLE_ADC:\n\t\tstream.print(F(\"Throttle adc, value=\"));\n\t\tstream.print(evt.data);\n\t\tstream.print(F(\".\"));\n\t\tbreak;\n    case EVT_DATA_LVC_LIMITING:\n        if (evt.data != 0)\n        {\n            stream.print(F(\"Low voltage limiting activated, voltage=\"));\n            stream.print(evt.data / 10.f);\n            stream.print(F(\".\"));\n        }\n        else\n        {\n            stream.print(\"Low voltage limiting deactivated.\");\n        }\n        break;\n    case EVT_DATA_SHIFT_SENSOR:\n        if (evt.data.Value != 0)\n        {\n            stream.print(\"Shift sensor power ramp started.\");\n        }\n        else\n        {\n            stream.print(\"Shift sensor power ramp ended.\");\n        }\n        break;\n\tdefault:\n\t\tstream.print(F(\"Unknown entry, id=\"));\n\t\tstream.print(evt.id);\n\t\tstream.print(F(\" data=\"));\n\t\tstream.print(evt.data);\n\t\tbreak;\n\t}\n}\n\n\n\nComProxy::ComProxy(Stream& controller, Stream& display, Stream& log)\n    : _log(log)\n\t, _controller(controller)\n\t, _display(display)\n\t, _connected(false)\n    , _msgLen(0)\n    , _lastRecv(0)\n\t, _hasEvent(false)\n{ }\n\nbool ComProxy::isConnected() const\n{\n\treturn _connected;\n}\n\nbool ComProxy::connect()\n{\n\tuint8_t buffer[4];\n\n\tbuffer[0] = REQUEST_TYPE_WRITE;\n\tbuffer[1] = OPCODE_WRITE_EVTLOG_ENABLE;\n\tbuffer[2] = 1;\n\tbuffer[3] = computeChecksum(buffer, 3);\n\n\t_controller.write(buffer, 4);\n\n\tuint32_t now = millis();\n\twhile(!_connected && (millis() - now) < 1000)\n\t{\n\t\tprocessControllerTx();\n\t}\n\n\treturn _connected;\n}\n\nvoid ComProxy::process()\n{  \n\tprocessControllerTx();\n\tprocessDisplayTx();\n}\n   \nbool ComProxy::hasLogEvent() const\n{\n\treturn _hasEvent;\n}\n\nbool ComProxy::getLogEvent(Event& e)\n{\n\tif (_hasEvent)\n\t{\n\t\te = _event;\n\t\t_hasEvent = false;\n\t\treturn true;\n\t}\n\t\n\treturn false;\n}\n\n\nvoid ComProxy::processControllerTx()\n{\n\tint b = -1;\n\twhile ((b = _controller.read()) != -1)\n\t{\n\t\t_lastRecv = millis();\n\n\t\t_msgBuf[_msgLen++] = b;\n\n\t\tint res;\n\t\twhile (_msgLen > 0 && (res = tryProcessControllerMessage()) != KEEP)\n\t\t{\n\t\t\tif (res == FAIL)\n\t\t\t{\n\t\t\t\t_display.write(_msgBuf[0]);\n\t\t\t\tif (_msgLen > 1)\n\t\t\t\t{\n\t\t\t\t\tmemcpy(_msgBuf, _msgBuf + 1, _msgLen - 1);\n\t\t\t\t}\t\t\t\t\n\t\t\t\t_msgLen--;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\telse if (res >= 0)\n\t\t\t{\n\t\t\t\t// succesfully intercepted\n\t\t\t\t_msgLen = 0;\n\t\t\t\tbreak;\n\t\t\t}\t\t\n\t\t}\n\t}\n\n\tif (_msgLen > 0 && millis() - _lastRecv > 20)\n\t{\n\t\tflushInterceptbuffer();\n\t}\n}\n\nvoid ComProxy::processDisplayTx()\n{\n\tint b = -1;\n\twhile ((b = _display.read()) != -1)\n\t{\n\t\t_controller.write((uint8_t)b);\n\t}\n}\n\n\nvoid ComProxy::flushInterceptbuffer()\n{\n\tfor (uint8_t i = 0; i < _msgLen; i++)\n\t{\n\t\t_display.write(_msgBuf[i]);\n\t}\n\n\t_msgLen = 0;\n}\n\n\nint ComProxy::tryProcessControllerMessage()\n {\n    if (_msgLen < 1)\n\t{\n\t\treturn KEEP;\n\t}\n\n\tswitch (_msgBuf[0])\n\t{\n\tcase REQUEST_TYPE_READ:\n\t\treturn processReadRequestResponse();\n\tcase REQUEST_TYPE_WRITE:\n\t\treturn processWriteRequestResponse();\n    case EVENT_LOG_ENTRY:\n    case EVENT_LOG_DATA_ENTRY:\n        return processEventLogMessage();\n\t}\n\n\treturn FAIL; // unknown message, forward to display\n}\n\nint ComProxy::processReadRequestResponse()\n{\n\tif (_msgLen < 2)\n\t{\n\t\treturn KEEP;\n\t}\n\n\tswitch (_msgBuf[1])\n\t{\n\tcase OPCODE_READ_FW_VERSION:\n\t\treturn verifyControllerMessage(_msgBuf, _msgLen, 7, _log);\n\tcase OPCODE_READ_EVTLOG_ENABLE:\n\t\treturn verifyControllerMessage(_msgBuf, _msgLen, 4, _log);\n\t}\n\n\treturn FAIL;\n}\n\nint ComProxy::processWriteRequestResponse()\n{\n\tif (_msgLen < 2)\n\t{\n\t\treturn KEEP;\n\t}\n\n\tswitch(_msgBuf[1])\n\t{\n\tcase OPCODE_WRITE_EVTLOG_ENABLE:\n\t{\n\t\tif (_msgLen < 4)\n\t\t{\n\t\t\treturn KEEP;\n\t\t}\n\n\t\tint res = verifyControllerMessage(_msgBuf, _msgLen, 4, _log);\n\t\tif (res > 0)\n\t\t{\n\t\t\t_connected = _msgBuf[2] != 0;\n\t\t}\n\n\t\treturn res;\n\t}};\n\n\treturn FAIL;\n}\n\nint ComProxy::processEventLogMessage()\n{\n    if (_msgBuf[0] == EVENT_LOG_ENTRY)\n    {\n        const int MessageSize = 3;\n\n        if (_msgLen < MessageSize)\n        {\n            return KEEP;\n        }\n\n\t\tint res = verifyControllerMessage(_msgBuf, _msgLen, MessageSize, _log);\n\t\tif (res > 0)\n\t\t{\n\t\t\t_hasEvent = true;\n\t\t\t_event.timestamp = millis();\n       \t \t_event.id = _msgBuf[1];\n        \t_event.data = 0;\n\t\t}\n\n        return res;\n    }\n    else if (_msgBuf[0] == EVENT_LOG_DATA_ENTRY)\n    {\n        const int MessageSize = 5;\n\n        if (_msgLen < MessageSize)\n        {\n            return KEEP;\n        }\n\n\t\tint res = verifyControllerMessage(_msgBuf, _msgLen, MessageSize, _log);\n\t\tif (res > 0)\n\t\t{\n\t\t\t_hasEvent = true;\n\t\t\t_event.timestamp = millis();\n       \t\t_event.id = _msgBuf[1];\n        \t_event.data = _msgBuf[2] << 8 | _msgBuf[3];\n\t\t}\n\n        return res;\n    }\n\n    return FAIL;\n}\n"
  },
  {
    "path": "src/logger/src/Main.cpp",
    "content": "#include <Arduino.h>\n#include <AltSoftSerial.h>>\n\n#include \"ComProxy.h\"\n\n// NOTE:\n// This project uses a Arduno Nano based on Atmega328p.\n// This MCU only has a single UART.\n//\n// Two differenst software serial libraries are used\n// to compensate for the lack of HW ports (should have used another MCU).\n//\n// This causes a few problems since the entire CPu\n// is stalled when doing transmit. You may therefore see \n// error code 30 pop up on the display birefly if a lot is \n// printed to the log since the response is not fast enough.\n\nSoftwareSerial logSerial(11, 12);\nAltSoftSerial controllerSerial(8, 9);\n// HW Serial used for display connection\n\nComProxy proxy(controllerSerial, Serial, logSerial);\n\n\nvoid initProxy()\n{\n    controllerSerial.begin(1200);\n    controllerSerial.listen();\n\n    pinMode(A2, INPUT);\n    pinMode(A3, INPUT);\n\n    // display\n    Serial.begin(1200);\n\n    if (proxy.connect())\n    {\n        logSerial.println(\"Connected to controller.\");\n    }\n    else\n    {\n        logSerial.println(\"Failed to connect to controller.\");\n    }\n}\n\nvoid printEvent(const ComProxy::Event& evt)\n{    \n    ComProxy::printFormat(logSerial, evt);\n    logSerial.println();\n}\n\nvoid setup()\n{\n    logSerial.begin(57600);\n\n    pinMode(2, INPUT_PULLUP);\n\n    if (digitalRead(2))\n    {\n        // Disable proxy, needed when reflashing controller to not interfere with communication\n        pinMode(0, INPUT);\n        pinMode(1, INPUT);\n        pinMode(8, INPUT);\n        pinMode(9, INPUT);\n\n        logSerial.println(\"Logger Disabled.\");\n    }\n    else\n    {\n        delay(100);   \n        initProxy();\n    } \n}\n\nvoid loop()\n{\n    if (proxy.isConnected())\n    {\n        proxy.process();\n     \n        if (proxy.hasLogEvent())\n        {\n            ComProxy::Event evt;\n            if (proxy.getLogEvent(evt))\n            {\n                printEvent(evt); \n            }          \n        }\n    }\n}\n"
  },
  {
    "path": "src/tool/.gitignore",
    "content": "## Ignore Visual Studio temporary files, build results, and\n## files generated by popular Visual Studio add-ons.\n##\n## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore\n\n# User-specific files\n*.rsuser\n*.suo\n*.user\n*.userosscache\n*.sln.docstates\n\n# User-specific files (MonoDevelop/Xamarin Studio)\n*.userprefs\n\n# Mono auto generated files\nmono_crash.*\n\n# Build results\n[Dd]ebug/\n[Dd]ebugPublic/\n[Rr]elease/\n[Rr]eleases/\nx64/\nx86/\n[Ww][Ii][Nn]32/\n[Aa][Rr][Mm]/\n[Aa][Rr][Mm]64/\nbld/\n[Bb]in/\n[Oo]bj/\n[Ll]og/\n[Ll]ogs/\n\n# Visual Studio 2015/2017 cache/options directory\n.vs/\n# Uncomment if you have tasks that create the project's static files in wwwroot\n#wwwroot/\n\n# Visual Studio 2017 auto generated files\nGenerated\\ Files/\n\n# MSTest test Results\n[Tt]est[Rr]esult*/\n[Bb]uild[Ll]og.*\n\n# NUnit\n*.VisualState.xml\nTestResult.xml\nnunit-*.xml\n\n# Build Results of an ATL Project\n[Dd]ebugPS/\n[Rr]eleasePS/\ndlldata.c\n\n# Benchmark Results\nBenchmarkDotNet.Artifacts/\n\n# .NET Core\nproject.lock.json\nproject.fragment.lock.json\nartifacts/\n\n# ASP.NET Scaffolding\nScaffoldingReadMe.txt\n\n# StyleCop\nStyleCopReport.xml\n\n# Files built by Visual Studio\n*_i.c\n*_p.c\n*_h.h\n*.ilk\n*.meta\n*.obj\n*.iobj\n*.pch\n*.pdb\n*.ipdb\n*.pgc\n*.pgd\n*.rsp\n*.sbr\n*.tlb\n*.tli\n*.tlh\n*.tmp\n*.tmp_proj\n*_wpftmp.csproj\n*.log\n*.vspscc\n*.vssscc\n.builds\n*.pidb\n*.svclog\n*.scc\n\n# Chutzpah Test files\n_Chutzpah*\n\n# Visual C++ cache files\nipch/\n*.aps\n*.ncb\n*.opendb\n*.opensdf\n*.sdf\n*.cachefile\n*.VC.db\n*.VC.VC.opendb\n\n# Visual Studio profiler\n*.psess\n*.vsp\n*.vspx\n*.sap\n\n# Visual Studio Trace Files\n*.e2e\n\n# TFS 2012 Local Workspace\n$tf/\n\n# Guidance Automation Toolkit\n*.gpState\n\n# ReSharper is a .NET coding add-in\n_ReSharper*/\n*.[Rr]e[Ss]harper\n*.DotSettings.user\n\n# TeamCity is a build add-in\n_TeamCity*\n\n# DotCover is a Code Coverage Tool\n*.dotCover\n\n# AxoCover is a Code Coverage Tool\n.axoCover/*\n!.axoCover/settings.json\n\n# Coverlet is a free, cross platform Code Coverage Tool\ncoverage*.json\ncoverage*.xml\ncoverage*.info\n\n# Visual Studio code coverage results\n*.coverage\n*.coveragexml\n\n# NCrunch\n_NCrunch_*\n.*crunch*.local.xml\nnCrunchTemp_*\n\n# MightyMoose\n*.mm.*\nAutoTest.Net/\n\n# Web workbench (sass)\n.sass-cache/\n\n# Installshield output folder\n[Ee]xpress/\n\n# DocProject is a documentation generator add-in\nDocProject/buildhelp/\nDocProject/Help/*.HxT\nDocProject/Help/*.HxC\nDocProject/Help/*.hhc\nDocProject/Help/*.hhk\nDocProject/Help/*.hhp\nDocProject/Help/Html2\nDocProject/Help/html\n\n# Click-Once directory\npublish/\n\n# Publish Web Output\n*.[Pp]ublish.xml\n*.azurePubxml\n# Note: Comment the next line if you want to checkin your web deploy settings,\n# but database connection strings (with potential passwords) will be unencrypted\n*.pubxml\n*.publishproj\n\n# Microsoft Azure Web App publish settings. Comment the next line if you want to\n# checkin your Azure Web App publish settings, but sensitive information contained\n# in these scripts will be unencrypted\nPublishScripts/\n\n# NuGet Packages\n*.nupkg\n# NuGet Symbol Packages\n*.snupkg\n# The packages folder can be ignored because of Package Restore\n**/[Pp]ackages/*\n# except build/, which is used as an MSBuild target.\n!**/[Pp]ackages/build/\n# Uncomment if necessary however generally it will be regenerated when needed\n#!**/[Pp]ackages/repositories.config\n# NuGet v3's project.json files produces more ignorable files\n*.nuget.props\n*.nuget.targets\n\n# Microsoft Azure Build Output\ncsx/\n*.build.csdef\n\n# Microsoft Azure Emulator\necf/\nrcf/\n\n# Windows Store app package directories and files\nAppPackages/\nBundleArtifacts/\nPackage.StoreAssociation.xml\n_pkginfo.txt\n*.appx\n*.appxbundle\n*.appxupload\n\n# Visual Studio cache files\n# files ending in .cache can be ignored\n*.[Cc]ache\n# but keep track of directories ending in .cache\n!?*.[Cc]ache/\n\n# Others\nClientBin/\n~$*\n*~\n*.dbmdl\n*.dbproj.schemaview\n*.jfm\n*.pfx\n*.publishsettings\norleans.codegen.cs\n\n# Including strong name files can present a security risk\n# (https://github.com/github/gitignore/pull/2483#issue-259490424)\n#*.snk\n\n# Since there are multiple workflows, uncomment next line to ignore bower_components\n# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)\n#bower_components/\n\n# RIA/Silverlight projects\nGenerated_Code/\n\n# Backup & report files from converting an old project file\n# to a newer Visual Studio version. Backup files are not needed,\n# because we have git ;-)\n_UpgradeReport_Files/\nBackup*/\nUpgradeLog*.XML\nUpgradeLog*.htm\nServiceFabricBackup/\n*.rptproj.bak\n\n# SQL Server files\n*.mdf\n*.ldf\n*.ndf\n\n# Business Intelligence projects\n*.rdl.data\n*.bim.layout\n*.bim_*.settings\n*.rptproj.rsuser\n*- [Bb]ackup.rdl\n*- [Bb]ackup ([0-9]).rdl\n*- [Bb]ackup ([0-9][0-9]).rdl\n\n# Microsoft Fakes\nFakesAssemblies/\n\n# GhostDoc plugin setting file\n*.GhostDoc.xml\n\n# Node.js Tools for Visual Studio\n.ntvs_analysis.dat\nnode_modules/\n\n# Visual Studio 6 build log\n*.plg\n\n# Visual Studio 6 workspace options file\n*.opt\n\n# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)\n*.vbw\n\n# Visual Studio LightSwitch build output\n**/*.HTMLClient/GeneratedArtifacts\n**/*.DesktopClient/GeneratedArtifacts\n**/*.DesktopClient/ModelManifest.xml\n**/*.Server/GeneratedArtifacts\n**/*.Server/ModelManifest.xml\n_Pvt_Extensions\n\n# Paket dependency manager\n.paket/paket.exe\npaket-files/\n\n# FAKE - F# Make\n.fake/\n\n# CodeRush personal settings\n.cr/personal\n\n# Python Tools for Visual Studio (PTVS)\n__pycache__/\n*.pyc\n\n# Cake - Uncomment if you are using it\n# tools/**\n# !tools/packages.config\n\n# Tabs Studio\n*.tss\n\n# Telerik's JustMock configuration file\n*.jmconfig\n\n# BizTalk build output\n*.btp.cs\n*.btm.cs\n*.odx.cs\n*.xsd.cs\n\n# OpenCover UI analysis results\nOpenCover/\n\n# Azure Stream Analytics local run output\nASALocalRun/\n\n# MSBuild Binary and Structured Log\n*.binlog\n\n# NVidia Nsight GPU debugger configuration file\n*.nvuser\n\n# MFractors (Xamarin productivity tool) working folder\n.mfractor/\n\n# Local History for Visual Studio\n.localhistory/\n\n# BeatPulse healthcheck temp database\nhealthchecksdb\n\n# Backup folder for Package Reference Convert tool in Visual Studio 2017\nMigrationBackup/\n\n# Ionide (cross platform F# VS Code tools) working folder\n.ionide/\n\n# Fody - auto-generated XML schema\nFodyWeavers.xsd"
  },
  {
    "path": "src/tool/App.xaml",
    "content": "<Application x:Class=\"bbshd_fw_tool.App\"\n             xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"\n             xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\"\n             xmlns:local=\"clr-namespace:BBSFW\"\n             StartupUri=\"View/MainWindow.xaml\">\n    <Application.Resources>\n         \n    </Application.Resources>\n</Application>\n"
  },
  {
    "path": "src/tool/App.xaml.cs",
    "content": "using System;\nusing System.Collections.Generic;\nusing System.Configuration;\nusing System.Data;\nusing System.Linq;\nusing System.Threading.Tasks;\nusing System.Windows;\n\nnamespace BBSFW\n{\n\t/// <summary>\n\t/// Interaction logic for App.xaml\n\t/// </summary>\n\tpublic partial class App : Application\n\t{\n\t}\n}\n"
  },
  {
    "path": "src/tool/AssemblyInfo.cs",
    "content": "using System.Windows;\n\n[assembly: ThemeInfo(\n\tResourceDictionaryLocation.None, //where theme specific resource dictionaries are located\n\t\t\t\t\t\t\t\t\t //(used if a resource is not found in the page,\n\t\t\t\t\t\t\t\t\t // or application resource dictionaries)\n\tResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located\n\t\t\t\t\t\t\t\t\t\t\t  //(used if a resource is not found in the page,\n\t\t\t\t\t\t\t\t\t\t\t  // app, or any theme specific resource dictionaries)\n)]\n"
  },
  {
    "path": "src/tool/Model/BbsfwConnection.cs",
    "content": "using System;\nusing System.Collections.Generic;\nusing System.IO.Ports;\nusing System.Linq;\nusing System.Management;\nusing System.Threading;\nusing System.Threading.Tasks;\n\nnamespace BBSFW.Model\n{\n\n\tpublic class ComPort\n\t{\n\t\tpublic string Name { get; private set; }\n\n\t\tpublic string Description { get; private set; }\n\n\t\tpublic ComPort(string name, string description)\n\t\t{\n\t\t\tName = name;\n\t\t\tDescription = description;\n\t\t}\n\t}\n\n\tpublic class BbsfwConnection\n\t{\n\t\tpublic enum Controller\n\t\t{\n\t\t\tUnknown = 0,\n\t\t\tBBSHD = 1,\n\t\t\tBBS02 = 2,\n\t\t\tTSDZ2 = 3\n\t\t}\n\n\t\tprivate const int REQUEST_TYPE_READ =\t\t\t0x01;\n\t\tprivate const int REQUEST_TYPE_WRITE =\t\t\t0x02;\n\n\t\tprivate const int RESPONSE_TYPE_READ = \t\t\t0x01;\n\t\tprivate const int RESPONSE_TYPE_WRITE = \t\t0x02;\n\n\t\tprivate const int EVENT_LOG_ENTRY =\t\t\t\t0xee;\n\t\tprivate const int EVENT_LOG_DATA_ENTRY =\t\t0xed;\n\n\t\tprivate const int OPCODE_READ_FW_VERSION =\t\t0x01;\n\t\tprivate const int OPCODE_READ_EVTLOG_ENABLE =\t0x02;\n\t\tprivate const int OPCODE_READ_CONFIG =\t\t\t0x03;\n\n\t\tprivate const int OPCODE_WRITE_EVTLOG_ENABLE =\t0xf0;\n\t\tprivate const int OPCODE_WRITE_CONFIG =\t\t\t0xf1;\n\t\tprivate const int OPCODE_WRITE_RESET_CONFIG =\t0xf2;\n\t\tprivate const int OPCODE_WRITE_ADC_VOLTAGE_CALIBRATION = 0xf3;\n\n\t\tprivate const int Keep = 0;\n\t\tprivate const int Discard = -1;\n\n\t\tprivate SerialPort _port = null;\n\t\tprivate volatile bool _isConnecting = false;\n\t\tprivate volatile bool _isConnected = false;\n\t\tprivate Controller _controllerType = Controller.Unknown;\n\n\t\tprivate DateTime _lastRecv = DateTime.Now;\n\t\tprivate List<byte> _rxBuffer = new List<byte>();\n\n\n\t\tprivate CompletionQueue<Configuration> _readConfigCq = new CompletionQueue<Configuration>();\n\t\tprivate CompletionQueue<bool> _writeConfigCq = new CompletionQueue<bool>();\n\t\tprivate CompletionQueue<bool> _writeResetConfigCq = new CompletionQueue<bool>();\n\t\tprivate CompletionQueue<bool> _writeVoltageCalibrationCq = new CompletionQueue<bool>();\n\n\n\t\tprivate int ConfigVersion = 0;\n\n\n\n\t\tpublic bool IsConnected\n\t\t{\n\t\t\tget\n\t\t\t{\n\t\t\t\treturn _isConnected;\n\t\t\t}\n\t\t}\n\n\t\tpublic Controller ControllerType\n\t\t{\n\t\t\tget\n\t\t\t{\n\t\t\t\treturn _controllerType;\n\t\t\t}\n\t\t}\n\n\t\tpublic event Action<Controller, string, int>\tConnected;\n\t\tpublic event Action\t\t\t\t\t\t\t\tDisconnected;\n\n\n\t\tpublic event Action<EventLogEntry>\t\tEventLog;\n\n\n\t\tpublic static List<ComPort> GetComPorts()\n\t\t{\n\t\t\tvar result = new List<ComPort>();\n\n\t\t\tusing (var searcher = new ManagementObjectSearcher(\"SELECT * FROM Win32_PnPEntity WHERE Name LIKE '%COM%'\"))\n\t\t\t{\n\t\t\t\tvar portNames = SerialPort.GetPortNames();\n\t\t\t\tvar ports = searcher.Get().Cast<ManagementBaseObject>().ToList();\n\n\t\t\t\tforeach (var name in portNames)\n\t\t\t\t{\n\t\t\t\t\tvar port = ports.FirstOrDefault(p => p[\"Name\"].ToString().ToUpper().Contains(name.ToUpper()));\n\t\t\t\t\tif (port != null)\n\t\t\t\t\t{\n\t\t\t\t\t\tresult.Add(new ComPort(name, port[\"Caption\"].ToString()));\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tresult.Add(new ComPort(name, name));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn result;\n\t\t}\n\n\n\n\t\tpublic async Task<bool> Connect(ComPort port, TimeSpan timeout)\n\t\t{\n\t\t\t_controllerType = Controller.Unknown;\n\t\t\t_isConnected = false;\n\t\t\t_isConnecting = true;\n\t\t\t_port = new SerialPort(port.Name, 1200);\n\t\t\t_port.DataReceived += OnDataReceived;\n\t\t\t_port.Open();\n\n\t\t\tvar connected = await Task.Run(() => SetupConnection(timeout));\n\t\t\tif (!connected)\n\t\t\t{\n\t\t\t\tClose();\n\t\t\t}\n\n\t\t\treturn connected;\n\t\t}\n\n\t\tpublic void Close()\n\t\t{\n\t\t\tif (_port != null)\n\t\t\t{\n\t\t\t\t_isConnected = false;\n\t\t\t\t_isConnecting = false;\n\n\t\t\t\t_port.Close();\n\t\t\t\t_port.DataReceived -= OnDataReceived;\n\t\t\t\t_port = null;\n\n\t\t\t\tlock (_rxBuffer)\n\t\t\t\t{\n\t\t\t\t\t_rxBuffer.Clear();\n\t\t\t\t}\n\n\t\t\t\tDisconnected?.Invoke();\n\t\t\t}\n\t\t}\n\n\n\t\tpublic async Task<RequestResult<Configuration>> ReadConfiguration(TimeSpan timeout)\n\t\t{\n\t\t\tSendReadRequest(OPCODE_READ_CONFIG);\n\t\t\treturn await _readConfigCq.WaitResponse(timeout);\n\t\t}\n\n\t\tpublic async Task<RequestResult<bool>> WriteConfiguration(Configuration configuration, TimeSpan timeout)\n\t\t{\n\t\t\tSendWriteConfigRequest(configuration);\n\t\t\treturn await _writeConfigCq.WaitResponse(timeout);\n\t\t}\n\n\t\tpublic async Task<RequestResult<bool>> ResetConfiguration(TimeSpan timeout)\n\t\t{\n\t\t\tSendWriteResetConfigRequest();\n\t\t\treturn await _writeResetConfigCq.WaitResponse(timeout);\n\t\t}\n\n\t\tpublic async Task<RequestResult<bool>> CalibrateBatteryVoltage(float actualVolts, TimeSpan timeout)\n\t\t{\n\t\t\tSendWriteVoltageCalibration(actualVolts);\n\t\t\treturn await _writeVoltageCalibrationCq.WaitResponse(timeout);\n\t\t}\n\n\n\t\tprivate void OnDataReceived(object sender, SerialDataReceivedEventArgs e)\n\t\t{\n\t\t\t// check for communication error and reset\n\t\t\tif (_rxBuffer.Any() && DateTime.Now - _lastRecv > TimeSpan.FromMilliseconds(1000))\n\t\t\t{\n\t\t\t\t_rxBuffer.Clear();\n\t\t\t}\n\n\t\t\tbool close = false;\n\t\t\tlock(_rxBuffer)\n\t\t\t{\n\t\t\t\twhile (_port.BytesToRead > 0)\n\t\t\t\t{\n\t\t\t\t\t_lastRecv = DateTime.Now;\n\n\t\t\t\t\tvar b = _port.ReadByte();\n\t\t\t\t\tif (b == -1)\n\t\t\t\t\t{\n\t\t\t\t\t\tclose = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\t_rxBuffer.Add((byte)b);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif (close)\n\t\t\t{\n\t\t\t\tClose();\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tProcessInputBuffer();\n\t\t\t}\n\t\t}\n\n\n\t\tprivate void ProcessInputBuffer()\n\t\t{\n\t\t\tlock(_rxBuffer)\n\t\t\t{\n\t\t\t\twhile(true)\n\t\t\t\t{\n\t\t\t\t\tvar result = ProcessMessage();\n\t\t\t\t\tif (result == Discard)\n\t\t\t\t\t{\n\t\t\t\t\t\tSystem.Diagnostics.Debug.WriteLine(\"Discarding: \" + BitConverter.ToString(_rxBuffer.ToArray()).Replace(\"-\", \" \"));\n\t\t\t\t\t\t_rxBuffer.Clear();\n\t\t\t\t\t}\n\t\t\t\t\telse if (result > 0)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (_rxBuffer.Count > result)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t_rxBuffer.RemoveRange(0, result);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t_rxBuffer.Clear();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\t// no data, done\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t}\n\n\n\t\tprivate int ProcessMessage()\n\t\t{\n\t\t\tif (_rxBuffer.Count < 1)\n\t\t\t{\n\t\t\t\treturn 0;\n\t\t\t}\n\n\t\t\tswitch(_rxBuffer[0])\n\t\t\t{\n\t\t\t\tcase RESPONSE_TYPE_READ:\n\t\t\t\t\treturn ProcessReadResponse();\n\t\t\t\tcase RESPONSE_TYPE_WRITE:\n\t\t\t\t\treturn ProcessWriteResponse();\n\t\t\t\tcase EVENT_LOG_ENTRY:\n\t\t\t\tcase EVENT_LOG_DATA_ENTRY:\n\t\t\t\t\treturn ProcessEventLogEntry();\n\t\t\t}\n\n\t\t\treturn Discard;\n\t\t}\n\n\n\t\tprivate int ProcessReadResponse()\n\t\t{\n\t\t\tif (_rxBuffer.Count < 2)\n\t\t\t{\n\t\t\t\treturn 0;\n\t\t\t}\n\n\t\t\tswitch(_rxBuffer[1])\n\t\t\t{\n\t\t\tcase OPCODE_READ_FW_VERSION:\n\t\t\t\treturn ProcessReadResponseFwVersion();\n\t\t\tcase OPCODE_READ_EVTLOG_ENABLE:\n\t\t\t\treturn ProcessReadResponseEvtlogEnable();\n\t\t\tcase OPCODE_READ_CONFIG:\n\t\t\t\treturn ProcessReadResponseConfig();\n\t\t\t}\n\n\t\t\treturn -1;\n\t\t}\n\n\t\tprivate int ProcessReadResponseFwVersion()\n\t\t{\n\t\t\tconst int MessageSizeV1 = 7;\n\t\t\tconst int MessageSizeV2 = 8;\n\n\t\t\tif (_rxBuffer.Count < MessageSizeV1)\n\t\t\t{\n\t\t\t\treturn Keep;\n\t\t\t}\n\n\t\t\tint size = MessageSizeV1;\n\n\t\t\tint major = _rxBuffer[2];\n\t\t\tint minor = _rxBuffer[3];\n\t\t\tint patch = _rxBuffer[4];\n\n\t\t\tif (major > 1 || minor > 0)\n\t\t\t{\n\t\t\t\t// Controller model field added in firmware version 1.1\n\t\t\t\t// Keep backwards compatibility\n\t\t\t\tif (_rxBuffer.Count < MessageSizeV2)\n\t\t\t\t{\n\t\t\t\t\treturn Keep;\n\t\t\t\t}\n\n\t\t\t\tsize = MessageSizeV2;\n\t\t\t}\n\n\t\t\tif (ComputeChecksum(_rxBuffer, size - 1) == _rxBuffer[size - 1])\n\t\t\t{\n\t\t\t\tConfigVersion = _rxBuffer[5];\n\n\t\t\t\tif (_isConnecting)\n\t\t\t\t{\n\t\t\t\t\t_isConnecting = false;\n\t\t\t\t\t_isConnected = true;\n\t\t\t\t\t_controllerType = (size == MessageSizeV1 ? Controller.BBSHD : (Controller)_rxBuffer[6]);\n\n\t\t\t\t\tConnected?.Invoke(ControllerType, String.Format(\"{0}.{1}.{2}\", major, minor, patch), ConfigVersion); ;\n\n\t\t\t\t\tSendEventLogEnableRequest(true);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn size;\n\t\t}\n\n\t\tprivate int ProcessReadResponseEvtlogEnable()\n\t\t{\n\t\t\tconst int MessageSize = 4;\n\n\t\t\tif (_rxBuffer.Count < MessageSize)\n\t\t\t{\n\t\t\t\treturn Keep;\n\t\t\t}\n\n\t\t\t// not used\n\n\t\t\treturn 4;\n\t\t}\n\n\t\tprivate int ProcessReadResponseConfig()\n\t\t{\n\t\t\tint version;\n\n\t\t\tif (_rxBuffer.Count > 3)\n\t\t\t{\n\t\t\t\tversion = _rxBuffer[2];\n\t\t\t\tvar size = _rxBuffer[3];\n\n\t\t\t\tif (version < Configuration.MinVersion || version > Configuration.MaxVersion || size != Configuration.GetByteSize(version))\n\t\t\t\t{\n\t\t\t\t\tSystem.Diagnostics.Debug.WriteLine(\"Config read from flash is of an unsupported version or is corrupt, discarding.\");\n\t\t\t\t\treturn Discard;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn Keep;\n\t\t\t}\n\n\t\t\tint MessageSize = (4 + Configuration.GetByteSize(version) + 1);\n\n\t\t\tif (_rxBuffer.Count < MessageSize)\n\t\t\t{\n\t\t\t\treturn Keep;\n\t\t\t}\n\n\t\t\tif (ComputeChecksum(_rxBuffer, MessageSize - 1) == _rxBuffer[MessageSize - 1])\n\t\t\t{\n\t\t\t\tvar cfg = new Configuration(ControllerType);\n\n\t\t\t\tswitch(version)\n\t\t\t\t{\n\t\t\t\t\tcase 1:\n\t\t\t\t\t\tcfg.ParseFromBufferV1(_rxBuffer.Skip(4).Take(Configuration.GetByteSize(version)).ToArray());\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 2:\n\t\t\t\t\t\tcfg.ParseFromBufferV2(_rxBuffer.Skip(4).Take(Configuration.GetByteSize(version)).ToArray());\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 3:\n\t\t\t\t\t\tcfg.ParseFromBufferV3(_rxBuffer.Skip(4).Take(Configuration.GetByteSize(version)).ToArray());\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 4:\n\t\t\t\t\t\tcfg.ParseFromBufferV4(_rxBuffer.Skip(4).Take(Configuration.GetByteSize(version)).ToArray());\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase 5:\n\t\t\t\t\t\tcfg.ParseFromBufferV5(_rxBuffer.Skip(4).Take(Configuration.GetByteSize(version)).ToArray());\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\t_readConfigCq.Complete(cfg);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tSystem.Diagnostics.Debug.WriteLine(\"Config read from flash has mismatching checksum, discarding.\");\n\t\t\t}\n\n\t\t\treturn MessageSize;\n\t\t}\n\n\n\t\tprivate int ProcessWriteResponse()\n\t\t{\n\t\t\tif (_rxBuffer.Count < 2)\n\t\t\t{\n\t\t\t\treturn Keep;\n\t\t\t}\n\n\t\t\tswitch (_rxBuffer[1])\n\t\t\t{\n\t\t\t\tcase OPCODE_WRITE_EVTLOG_ENABLE:\n\t\t\t\t\treturn ProcessWriteResponseEvtlogEnable();\n\t\t\t\tcase OPCODE_WRITE_CONFIG:\n\t\t\t\t\treturn ProcessWriteResponseConfig();\n\t\t\t\tcase OPCODE_WRITE_RESET_CONFIG:\n\t\t\t\t\treturn ProcessWriteResponseResetConfig();\n\t\t\t\tcase OPCODE_WRITE_ADC_VOLTAGE_CALIBRATION:\n\t\t\t\t\treturn ProcessWriteResponseVoltageCalibration();\n\t\t\t}\n\n\t\t\treturn Discard;\n\t\t}\n\n\t\tprivate int ProcessWriteResponseEvtlogEnable()\n\t\t{\n\t\t\tconst int MessageSize = 4;\n\n\t\t\tif (_rxBuffer.Count < MessageSize)\n\t\t\t{\n\t\t\t\treturn Keep;\n\t\t\t}\n\n\t\t\t// don't care\n\n\t\t\treturn MessageSize;\n\t\t}\n\n\t\tprivate int ProcessWriteResponseConfig()\n\t\t{\n\t\t\tconst int MessageSize = 4;\n\n\t\t\tif (_rxBuffer.Count < MessageSize)\n\t\t\t{\n\t\t\t\treturn Keep;\n\t\t\t}\n\n\t\t\t_writeConfigCq.Complete(_rxBuffer[2] != 0);\n\n\t\t\treturn MessageSize;\n\t\t}\n\n\t\tprivate int ProcessWriteResponseResetConfig()\n\t\t{\n\t\t\tconst int MessageSize = 4;\n\n\t\t\tif (_rxBuffer.Count < MessageSize)\n\t\t\t{\n\t\t\t\treturn Keep;\n\t\t\t}\n\n\t\t\t_writeResetConfigCq.Complete(_rxBuffer[2] != 0);\n\n\t\t\treturn MessageSize;\n\t\t}\n\n\t\tprivate int ProcessWriteResponseVoltageCalibration()\n\t\t{\n\t\t\tconst int MessageSize = 5;\n\n\t\t\tif (_rxBuffer.Count < MessageSize)\n\t\t\t{\n\t\t\t\treturn Keep;\n\t\t\t}\n\n\t\t\t_writeVoltageCalibrationCq.Complete(true);\n\n\t\t\treturn MessageSize;\n\t\t}\n\n\t\tprivate int ProcessEventLogEntry()\n\t\t{\n\t\t\tif (_rxBuffer[0] == EVENT_LOG_ENTRY)\n\t\t\t{\n\t\t\t\tconst int MessageSize = 3;\n\n\t\t\t\tif (_rxBuffer.Count < MessageSize)\n\t\t\t\t{\n\t\t\t\t\treturn Keep;\n\t\t\t\t}\n\n\t\t\t\tif (ComputeChecksum(_rxBuffer, MessageSize - 1) == _rxBuffer[MessageSize - 1])\n\t\t\t\t{\n\t\t\t\t\tEventLog?.Invoke(new EventLogEntry(_rxBuffer[1], null));\n\t\t\t\t\treturn MessageSize;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tConsole.WriteLine(\"Event log cheksum missmatch. Discarding.\");\n\t\t\t\t\treturn Discard;\n\t\t\t\t}\t\t\t\n\t\t\t}\n\t\t\telse if (_rxBuffer[0] == EVENT_LOG_DATA_ENTRY)\n\t\t\t{\n\t\t\t\tconst int MessageSize = 5;\n\n\t\t\t\tif (_rxBuffer.Count < MessageSize)\n\t\t\t\t{\n\t\t\t\t\treturn Keep;\n\t\t\t\t}\n\n\t\t\t\tif (ComputeChecksum(_rxBuffer, MessageSize - 1) == _rxBuffer[MessageSize - 1])\n\t\t\t\t{\n\t\t\t\t\tint data = _rxBuffer[2] << 8 | _rxBuffer[3];\n\t\t\t\t\tEventLog?.Invoke(new EventLogEntry(_rxBuffer[1], data));\n\n\t\t\t\t\treturn MessageSize;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tConsole.WriteLine(\"Event log cheksum missmatch. Discarding.\");\n\t\t\t\t\treturn Discard;\n\t\t\t\t}\t\t\t\t\n\t\t\t}\n\n\t\t\treturn Discard;\n\t\t}\n\n\n\t\tprivate void SendReadRequest(byte opcode)\n\t\t{\n\t\t\tvar buf = new List<byte>();\n\t\t\tbuf.Add(REQUEST_TYPE_READ);\n\t\t\tbuf.Add(opcode);\n\t\t\tbuf.Add(ComputeChecksum(buf, buf.Count));\n\n\t\t\t_port.Write(buf.ToArray(), 0, buf.Count);\n\t\t}\n\n\t\tprivate void SendEventLogEnableRequest(bool enable)\n\t\t{\n\t\t\tvar buf = new List<byte>();\n\t\t\tbuf.Add(REQUEST_TYPE_WRITE);\n\t\t\tbuf.Add(OPCODE_WRITE_EVTLOG_ENABLE);\n\t\t\tbuf.Add((byte)(enable ? 1 : 0));\n\t\t\tbuf.Add(ComputeChecksum(buf, buf.Count));\n\n\t\t\t_port.Write(buf.ToArray(), 0, buf.Count);\n\t\t}\n\n\t\tprivate void SendWriteConfigRequest(Configuration config)\n\t\t{\n\t\t\tif (Configuration.CurrentVersion != ConfigVersion)\n\t\t\t{\n\t\t\t\tthrow new InvalidOperationException(\"Unsupported config version.\");\n\t\t\t}\n\n\t\t\tvar cfgarr = config.WriteToBuffer();\n\n\t\t\tvar buf = new List<byte>();\n\t\t\tbuf.Add(REQUEST_TYPE_WRITE);\n\t\t\tbuf.Add(OPCODE_WRITE_CONFIG);\n\t\t\tbuf.Add((byte)Configuration.CurrentVersion);\n\t\t\tbuf.Add((byte)cfgarr.Length);\n\t\t\tbuf.AddRange(cfgarr);\n\t\t\tbuf.Add(ComputeChecksum(buf, buf.Count));\n\n\t\t\t_port.Write(buf.ToArray(), 0, buf.Count);\n\t\t}\n\n\t\tprivate void SendWriteResetConfigRequest()\n\t\t{\n\t\t\tvar buf = new List<byte>();\n\t\t\tbuf.Add(REQUEST_TYPE_WRITE);\n\t\t\tbuf.Add(OPCODE_WRITE_RESET_CONFIG);\n\t\t\tbuf.Add(ComputeChecksum(buf, buf.Count));\n\n\t\t\t_port.Write(buf.ToArray(), 0, buf.Count);\n\t\t}\n\n\t\tprivate void SendWriteVoltageCalibration(float volts)\n\t\t{\n\t\t\tuint volts_x100 = (uint)(volts * 100);\n\n\t\t\tvar buf = new List<byte>();\n\t\t\tbuf.Add(REQUEST_TYPE_WRITE);\n\t\t\tbuf.Add(OPCODE_WRITE_ADC_VOLTAGE_CALIBRATION);\n\t\t\tbuf.Add((byte)(volts_x100 >> 8));\n\t\t\tbuf.Add((byte)volts_x100);\n\t\t\tbuf.Add(ComputeChecksum(buf, buf.Count));\n\n\t\t\t_port.Write(buf.ToArray(), 0, buf.Count);\n\t\t}\n\n\t\tprivate bool SetupConnection(TimeSpan timeout)\n\t\t{\n\t\t\tvar start = DateTime.Now;\n\t\t\twhile (_isConnecting && !_isConnected)\n\t\t\t{\n\t\t\t\tif (DateTime.Now - start > timeout)\n\t\t\t\t{\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\tSendReadRequest(OPCODE_READ_FW_VERSION);\n\t\t\t\tThread.Sleep(200);\n\t\t\t}\n\n\t\t\treturn true;\n\t\t}\n\n\n\t\tprivate static byte ComputeChecksum(List<byte> buffer, int length)\n\t\t{\n\t\t\tunchecked\n\t\t\t{\n\t\t\t\tbyte result = 0;\n\t\t\t\tfor (int i = 0; i < length; i++)\n\t\t\t\t{\n\t\t\t\t\tresult += buffer[i];\n\t\t\t\t}\n\n\t\t\t\treturn result;\n\t\t\t}\n\t\t}\n\n\t}\n}\n"
  },
  {
    "path": "src/tool/Model/CompletionQueue.cs",
    "content": "using System;\nusing System.Threading;\nusing System.Threading.Tasks;\n\nnamespace BBSFW.Model\n{\n\n\tpublic class RequestResult<T>\n\t{\n\t\tpublic bool Timeout { get; private set; }\n\n\t\tpublic T Result { get; private set; }\n\n\n\t\tpublic RequestResult(bool timeout, T result)\n\t\t{\n\t\t\tTimeout = timeout;\n\t\t\tResult = result;\n\t\t}\n\t}\n\n\n\tpublic class CompletionQueue<T>\n\t{\n\t\tprivate TaskCompletionSource<T> _tcs = null;\n\n\t\tpublic void Complete(T response)\n\t\t{\n\t\t\t_tcs?.SetResult(response);\n\t\t}\n\n\t\tpublic async Task<RequestResult<T>> WaitResponse(TimeSpan timeout)\n\t\t{\n\t\t\tReset(timeout);\n\n\t\t\ttry\n\t\t\t{\n\t\t\t\tvar res =  await _tcs.Task;\n\t\t\t\t_tcs = null;\n\t\t\t\treturn new RequestResult<T>(false, res);\n\t\t\t}\n\t\t\tcatch(TaskCanceledException)\n\t\t\t{\n\t\t\t\t_tcs = null;\n\t\t\t\treturn new RequestResult<T>(true, default(T));\n\t\t\t}\n\t\t}\n\n\t\tprivate void Reset(TimeSpan timeout)\n\t\t{\n\t\t\tvar tcs = new TaskCompletionSource<T>();\n\n\t\t\tvar cancelTokenSrc = new CancellationTokenSource((int)timeout.TotalMilliseconds);\n\t\t\tcancelTokenSrc.Token.Register(() => tcs.TrySetCanceled());\n\n\t\t\t_tcs = tcs;\n\t\t}\n\n\t}\n}\n"
  },
  {
    "path": "src/tool/Model/Configuration.cs",
    "content": "using System;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Xml;\r\nusing System.Xml.Serialization;\r\n\r\nnamespace BBSFW.Model\r\n{\r\n\r\n\t[XmlRoot(\"BBSFW\", Namespace =\"https://github.com/danielnilsson9/bbs-fw\")]\r\n\tpublic class Configuration\r\n\t{\r\n\t\tpublic const int CurrentVersion = 5;\r\n\t\tpublic const int MinVersion = 1;\r\n\t\tpublic const int MaxVersion = CurrentVersion;\r\n\r\n\t\tpublic const int ByteSizeV1 = 120;\r\n\t\tpublic const int ByteSizeV2 = 124;\r\n\t\tpublic const int ByteSizeV3 = 149;\r\n\t\tpublic const int ByteSizeV4 = 152;\r\n\t\tpublic const int ByteSizeV5 = 154;\r\n\r\n\t\tpublic enum Feature\r\n\t\t{\r\n\t\t\tShiftSensor,\r\n\t\t\tTorqueSensor,\r\n\t\t\tControllerTemperatureSensor,\r\n\t\t\tMotorTemperatureSensor\r\n\t\t}\r\n\r\n\t\tpublic static int GetByteSize(int version)\r\n\t\t{\r\n\t\t\tswitch (version)\r\n\t\t\t{\r\n\t\t\t\tcase 1:\r\n\t\t\t\t\treturn ByteSizeV1;\r\n\t\t\t\tcase 2:\r\n\t\t\t\t\treturn ByteSizeV2;\r\n\t\t\t\tcase 3:\r\n\t\t\t\t\treturn ByteSizeV3;\r\n\t\t\t\tcase 4:\r\n\t\t\t\t\treturn ByteSizeV4;\r\n\t\t\t\tcase 5:\r\n\t\t\t\t\treturn ByteSizeV5;\r\n\t\t\t}\r\n\r\n\t\t\treturn 0;\r\n\t\t}\r\n\r\n\t\tpublic enum AssistModeSelect\r\n\t\t{\r\n\t\t\tOff = 0,\r\n\t\t\tStandard = 1,\r\n\t\t\tLights = 2,\r\n\t\t\tPas0AndLights = 3,\r\n\t\t\tPas1AndLights = 4,\r\n\t\t\tPas2AndLights = 5,\r\n\t\t\tPas3AndLights = 6,\r\n\t\t\tPas4AndLights = 7,\r\n\t\t\tPas5AndLights = 8,\r\n\t\t\tPas6AndLights = 9,\r\n\t\t\tPas7AndLights = 10,\r\n\t\t\tPas8AndLights = 11,\r\n\t\t\tPas9AndLights = 12,\r\n\t\t\tBrakesOnBoot = 13\r\n\t\t}\r\n\r\n\t\t[Flags]\r\n\t\tpublic enum AssistFlagsType : byte\r\n\t\t{\r\n\t\t\tNone = 0x00,\r\n\t\t\tPas = 0x01,\r\n\t\t\tThrottle = 0x02,\r\n\t\t\tCruise = 0x04,\r\n\r\n\t\t\tPasVariable = 0x08,\r\n\t\t\tPasTorque = 0x10,\r\n\t\t\tCadenceOverride = 0x20,\r\n\t\t\tSpeedOverride = 0x40\r\n\t\t};\r\n\r\n\t\tpublic enum ThrottleGlobalSpeedLimitOptions\r\n\t\t{\r\n\t\t\tDisabled = 0x00,\r\n\t\t\tEnabled = 0x01,\r\n\t\t\tStandardLevels = 0x02\r\n\t\t}\r\n\r\n\t\tpublic enum TemperatureSensor\r\n\t\t{\r\n\t\t\tDisabled = 0x00,\r\n\t\t\tController = 0x01,\r\n\t\t\tMotor = 0x02,\r\n\t\t\tAll = 0x03\r\n\t\t}\r\n\r\n\t\tpublic enum WalkModeData\r\n\t\t{\r\n\t\t\tSpeed = 0,\r\n\t\t\tTemperature = 1,\r\n\t\t\tRequestedPower = 2,\r\n\t\t\tBatteryPercent = 3\r\n\t\t}\r\n\r\n\t\tpublic enum LightsModeOptions\r\n\t\t{\r\n\t\t\tDefault = 0,\r\n\t\t\tDisabled = 1,\r\n\t\t\tAlwaysOn = 2,\r\n\t\t\tBrakeLight = 3\r\n\t\t}\r\n\r\n\t\tpublic class AssistLevel\r\n\t\t{\r\n\t\t\t[XmlAttribute]\r\n\t\t\tpublic AssistFlagsType Type;\r\n\r\n\t\t\t[XmlAttribute]\r\n\t\t\tpublic uint MaxCurrentPercent;\r\n\r\n\t\t\t[XmlAttribute]\r\n\t\t\tpublic uint MaxThrottlePercent;\r\n\r\n\t\t\t[XmlAttribute]\r\n\t\t\tpublic uint MaxCadencePercent;\r\n\r\n\t\t\t[XmlAttribute]\r\n\t\t\tpublic uint MaxSpeedPercent;\r\n\r\n\t\t\t[XmlAttribute]\r\n\t\t\tpublic float TorqueAmplificationFactor;\r\n\t\t}\r\n\r\n\t\t[XmlIgnore]\r\n\t\tpublic BbsfwConnection.Controller Target { get; private set; }\r\n\r\n\t\tpublic uint MaxCurrentLimitAmps\r\n\t\t{\r\n\t\t\tget\r\n\t\t\t{\r\n\t\t\t\tswitch (Target)\r\n\t\t\t\t{\r\n\t\t\t\t\tcase BbsfwConnection.Controller.BBSHD:\r\n\t\t\t\t\t\treturn 33;\r\n\t\t\t\t\tcase BbsfwConnection.Controller.BBS02:\r\n\t\t\t\t\t\treturn 30;\r\n\t\t\t\t\tcase BbsfwConnection.Controller.TSDZ2:\r\n\t\t\t\t\t\treturn 20;\r\n\t\t\t\t}\r\n\r\n\t\t\t\treturn 50;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// hmi\r\n\t\t[XmlIgnore]\r\n\t\tpublic bool UseFreedomUnits;\r\n\r\n\t\t// global\r\n\t\tpublic uint MaxCurrentAmps;\r\n\t\tpublic uint CurrentRampAmpsSecond;\r\n\t\tpublic float MaxBatteryVolts;\r\n\t\tpublic uint LowCutoffVolts;\r\n\t\tpublic uint MaxSpeedKph;\r\n\r\n\t\t// externals\r\n\t\tpublic bool UseSpeedSensor;\r\n\t\tpublic bool UseShiftSensor;\r\n\t\tpublic bool UsePushWalk;\r\n\t\tpublic bool UsePretension;\r\n\t\tpublic uint PretensionSpeedCutoffKph;\r\n\t\tpublic TemperatureSensor UseTemperatureSensor;\r\n\r\n\t\t// lights\r\n\t\tpublic LightsModeOptions LightsMode;\r\n\r\n\t\t// speed sensor\r\n\t\tpublic float WheelSizeInch;\r\n\t\tpublic uint NumWheelSensorSignals;\r\n\t\t\r\n\t\t// pas options\r\n\t\tpublic uint PasStartDelayPulses;\r\n\t\tpublic uint PasStopDelayMilliseconds;\r\n\t\tpublic uint PasKeepCurrentPercent;\r\n\t\tpublic uint PasKeepCurrentCadenceRpm;\r\n\r\n\t\t// throttle options\r\n\t\tpublic uint ThrottleStartMillivolts;\r\n\t\tpublic uint ThrottleEndMillivolts;\r\n\t\tpublic uint ThrottleStartPercent;\r\n\t\tpublic ThrottleGlobalSpeedLimitOptions ThrottleGlobalSpeedLimit;\r\n\t\tpublic uint ThrottleGlobalSpeedLimitPercent;\r\n\r\n\t\t// shift interrupt options\r\n\t\tpublic uint ShiftInterruptDuration;\r\n\t\tpublic uint ShiftInterruptCurrentThresholdPercent;\r\n\r\n\t\t// misc\r\n\t\tpublic WalkModeData WalkModeDataDisplay;\r\n\r\n\t\t// assists options\r\n\t\tpublic AssistModeSelect AssistModeSelection;\r\n\t\tpublic uint AssistStartupLevel;\r\n\r\n\t\tpublic AssistLevel[] StandardAssistLevels = new AssistLevel[10];\r\n\t\tpublic AssistLevel[] SportAssistLevels = new AssistLevel[10];\r\n\r\n\t\tpublic Configuration() : this(BbsfwConnection.Controller.Unknown)\r\n\t\t{ }\r\n\r\n\t\tpublic Configuration(BbsfwConnection.Controller target)\r\n\t\t{\r\n\t\t\tTarget = target;\r\n\r\n\t\t\tUseFreedomUnits = Properties.Settings.Default.UseFreedomUnits;\r\n\t\t\tMaxCurrentAmps = 0;\r\n\t\t\tCurrentRampAmpsSecond = 0;\r\n\t\t\tMaxBatteryVolts = 0;\r\n\t\t\tLowCutoffVolts = 0;\r\n\r\n\t\t\tUseSpeedSensor = false;\r\n\t\t\tUseShiftSensor = false;\r\n\t\t\tUsePushWalk = false;\r\n\t\t\tUsePretension = false;\r\n\t\t\tPretensionSpeedCutoffKph = 0;\r\n\t\t\tUseTemperatureSensor = TemperatureSensor.All;\r\n\r\n\t\t\tLightsMode = LightsModeOptions.Default;\r\n\r\n\t\t\tWheelSizeInch = 0;\r\n\t\t\tNumWheelSensorSignals = 0;\r\n\t\t\tMaxSpeedKph = 0;\r\n\r\n\t\t\tPasStartDelayPulses = 0;\r\n\t\t\tPasStopDelayMilliseconds = 0;\r\n\t\t\tPasKeepCurrentPercent = 0;\r\n\t\t\tPasKeepCurrentCadenceRpm = 0;\r\n\r\n\t\t\tThrottleStartMillivolts = 0;\r\n\t\t\tThrottleEndMillivolts = 0;\r\n\t\t\tThrottleStartPercent = 0;\r\n\t\t\tThrottleGlobalSpeedLimit = ThrottleGlobalSpeedLimitOptions.Disabled;\r\n\t\t\tThrottleGlobalSpeedLimitPercent = 0;\r\n\r\n\t\t\tShiftInterruptDuration = 0;\r\n\t\t\tShiftInterruptCurrentThresholdPercent = 0;\r\n\r\n\t\t\tWalkModeDataDisplay = WalkModeData.Speed;\r\n\r\n\t\t\tAssistModeSelection = AssistModeSelect.Off;\r\n\t\t\tAssistStartupLevel = 0;\r\n\r\n\t\t\tfor (int i = 0; i < StandardAssistLevels.Length; ++i)\r\n\t\t\t{\r\n\t\t\t\tStandardAssistLevels[i] = new AssistLevel();\r\n\t\t\t}\r\n\r\n\t\t\tfor (int i = 0; i < SportAssistLevels.Length; ++i)\r\n\t\t\t{\r\n\t\t\t\tSportAssistLevels[i] = new AssistLevel();\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tpublic bool IsFeatureSupported(Feature feature)\r\n\t\t{\r\n\t\t\tif (Target == BbsfwConnection.Controller.Unknown)\r\n\t\t\t{\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\r\n\t\t\tswitch (feature)\r\n\t\t\t{\r\n\t\t\t\tcase Feature.ShiftSensor:\r\n\t\t\t\t\treturn new[] { BbsfwConnection.Controller.BBSHD, BbsfwConnection.Controller.BBS02 }.Contains(Target);\r\n\t\t\t\tcase Feature.TorqueSensor:\r\n\t\t\t\t\treturn new[] { BbsfwConnection.Controller.TSDZ2 }.Contains(Target);\r\n\t\t\t\tcase Feature.ControllerTemperatureSensor:\r\n\t\t\t\t\treturn new[] { BbsfwConnection.Controller.BBSHD, BbsfwConnection.Controller.BBS02 }.Contains(Target);\r\n\t\t\t\tcase Feature.MotorTemperatureSensor:\r\n\t\t\t\t\treturn new[] { BbsfwConnection.Controller.BBSHD }.Contains(Target);\r\n\t\t\t}\r\n\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\tpublic bool ParseFromBufferV1(byte[] buffer)\r\n\t\t{\r\n\t\t\tif (buffer.Length != ByteSizeV1)\r\n\t\t\t{\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\r\n\t\t\tusing (var s = new MemoryStream(buffer))\r\n\t\t\t{\r\n\t\t\t\tvar br = new BinaryReader(s);\r\n\r\n\t\t\t\tUseFreedomUnits = br.ReadBoolean();\r\n\r\n\t\t\t\tMaxCurrentAmps = br.ReadByte();\r\n\t\t\t\tCurrentRampAmpsSecond = br.ReadByte();\r\n\t\t\t\tLowCutoffVolts = br.ReadByte();\r\n\t\t\t\tMaxSpeedKph = br.ReadByte();\r\n\r\n\t\t\t\tUseSpeedSensor = br.ReadBoolean();\r\n\t\t\t\t/* UseDisplay = */ br.ReadBoolean();\r\n\t\t\t\tUsePushWalk = br.ReadBoolean();\r\n\r\n\t\t\t\tWheelSizeInch = br.ReadUInt16() / 10f;\r\n\t\t\t\tNumWheelSensorSignals = br.ReadByte();\r\n\r\n\t\t\t\tPasStartDelayPulses = br.ReadByte();\r\n\t\t\t\tPasStopDelayMilliseconds = br.ReadByte() * 10u;\r\n\r\n\t\t\t\tThrottleStartMillivolts = br.ReadUInt16();\r\n\t\t\t\tThrottleEndMillivolts = br.ReadUInt16();\r\n\t\t\t\tThrottleStartPercent = br.ReadByte();\r\n\r\n\t\t\t\tAssistModeSelection = (AssistModeSelect)br.ReadByte();\r\n\t\t\t\tAssistStartupLevel = br.ReadByte();\r\n\r\n\t\t\t\tfor (int i = 0; i < StandardAssistLevels.Length; ++i)\r\n\t\t\t\t{\r\n\t\t\t\t\tStandardAssistLevels[i].Type = (AssistFlagsType)br.ReadByte();\r\n\t\t\t\t\tStandardAssistLevels[i].MaxCurrentPercent = br.ReadByte();\r\n\t\t\t\t\tStandardAssistLevels[i].MaxThrottlePercent = br.ReadByte();\r\n\t\t\t\t\tStandardAssistLevels[i].MaxCadencePercent = br.ReadByte();\r\n\t\t\t\t\tStandardAssistLevels[i].MaxSpeedPercent = br.ReadByte();\r\n\t\t\t\t}\r\n\r\n\t\t\t\tfor (int i = 0; i < SportAssistLevels.Length; ++i)\r\n\t\t\t\t{\r\n\t\t\t\t\tSportAssistLevels[i].Type = (AssistFlagsType)br.ReadByte();\r\n\t\t\t\t\tSportAssistLevels[i].MaxCurrentPercent = br.ReadByte();\r\n\t\t\t\t\tSportAssistLevels[i].MaxThrottlePercent = br.ReadByte();\r\n\t\t\t\t\tSportAssistLevels[i].MaxCadencePercent = br.ReadByte();\r\n\t\t\t\t\tSportAssistLevels[i].MaxSpeedPercent = br.ReadByte();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t// apply default settings for non existing options in version\r\n\t\t\tMaxBatteryVolts = 0f;\r\n\t\t\tUseTemperatureSensor = TemperatureSensor.All;\r\n\t\t\tWalkModeDataDisplay = WalkModeData.Speed;\r\n\t\t\tPasKeepCurrentPercent = 100;\r\n\t\t\tPasKeepCurrentCadenceRpm = 255;\r\n\t\t\tUseShiftSensor = true;\r\n\t\t\tShiftInterruptDuration = 600;\r\n\t\t\tShiftInterruptCurrentThresholdPercent = 10;\r\n\t\t\tLightsMode = LightsModeOptions.Default;\r\n\t\t\tUsePretension = false;\r\n\t\t\tPretensionSpeedCutoffKph = 16;\r\n\t\t\tThrottleGlobalSpeedLimit = ThrottleGlobalSpeedLimitOptions.Disabled;\r\n\t\t\tThrottleGlobalSpeedLimitPercent = 100;\r\n\t\t\tUsePretension = false;\r\n\t\t\tPretensionSpeedCutoffKph = 0;\r\n\r\n\t\t\treturn true;\r\n\t\t}\r\n\r\n\t\tpublic bool ParseFromBufferV2(byte[] buffer)\r\n\t\t{\r\n\t\t\tif (buffer.Length != ByteSizeV2)\r\n\t\t\t{\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\r\n\t\t\tusing (var s = new MemoryStream(buffer))\r\n\t\t\t{\r\n\t\t\t\tvar br = new BinaryReader(s);\r\n\r\n\t\t\t\tUseFreedomUnits = br.ReadBoolean();\r\n\r\n\t\t\t\tMaxCurrentAmps = br.ReadByte();\r\n\t\t\t\tCurrentRampAmpsSecond = br.ReadByte();\r\n\t\t\t\tMaxBatteryVolts = br.ReadUInt16() / 100f;\r\n\t\t\t\tLowCutoffVolts = br.ReadByte();\r\n\t\t\t\tMaxSpeedKph = br.ReadByte();\r\n\r\n\t\t\t\tUseSpeedSensor = br.ReadBoolean();\r\n\t\t\t\t/* UseDisplay = */ br.ReadBoolean();\r\n\t\t\t\tUsePushWalk = br.ReadBoolean();\r\n\t\t\t\tUseTemperatureSensor = (TemperatureSensor)br.ReadByte();\r\n\r\n\t\t\t\tWheelSizeInch = br.ReadUInt16() / 10f;\r\n\t\t\t\tNumWheelSensorSignals = br.ReadByte();\r\n\r\n\t\t\t\tPasStartDelayPulses = br.ReadByte();\r\n\t\t\t\tPasStopDelayMilliseconds = br.ReadByte() * 10u;\r\n\t\t\t\tPasKeepCurrentCadenceRpm = 255;\r\n\t\t\t\tPasKeepCurrentPercent = 100;\r\n\r\n\t\t\t\tThrottleStartMillivolts = br.ReadUInt16();\r\n\t\t\t\tThrottleEndMillivolts = br.ReadUInt16();\r\n\t\t\t\tThrottleStartPercent = br.ReadByte();\r\n\r\n\t\t\t\tWalkModeDataDisplay = (WalkModeData)br.ReadByte();\r\n\r\n\t\t\t\tAssistModeSelection = (AssistModeSelect)br.ReadByte();\r\n\t\t\t\tAssistStartupLevel = br.ReadByte();\r\n\r\n\t\t\t\tfor (int i = 0; i < StandardAssistLevels.Length; ++i)\r\n\t\t\t\t{\r\n\t\t\t\t\tStandardAssistLevels[i].Type = (AssistFlagsType)br.ReadByte();\r\n\t\t\t\t\tStandardAssistLevels[i].MaxCurrentPercent = br.ReadByte();\r\n\t\t\t\t\tStandardAssistLevels[i].MaxThrottlePercent = br.ReadByte();\r\n\t\t\t\t\tStandardAssistLevels[i].MaxCadencePercent = br.ReadByte();\r\n\t\t\t\t\tStandardAssistLevels[i].MaxSpeedPercent = br.ReadByte();\r\n\t\t\t\t}\r\n\r\n\t\t\t\tfor (int i = 0; i < SportAssistLevels.Length; ++i)\r\n\t\t\t\t{\r\n\t\t\t\t\tSportAssistLevels[i].Type = (AssistFlagsType)br.ReadByte();\r\n\t\t\t\t\tSportAssistLevels[i].MaxCurrentPercent = br.ReadByte();\r\n\t\t\t\t\tSportAssistLevels[i].MaxThrottlePercent = br.ReadByte();\r\n\t\t\t\t\tSportAssistLevels[i].MaxCadencePercent = br.ReadByte();\r\n\t\t\t\t\tSportAssistLevels[i].MaxSpeedPercent = br.ReadByte();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t// apply default settings for non existing options in version\r\n\t\t\tPasKeepCurrentPercent = 100;\r\n\t\t\tPasKeepCurrentCadenceRpm = 255;\r\n\t\t\tUseShiftSensor = true;\r\n\t\t\tShiftInterruptDuration = 600;\r\n\t\t\tShiftInterruptCurrentThresholdPercent = 10;\r\n\t\t\tLightsMode = LightsModeOptions.Default;\r\n\t\t\tUsePretension = false;\r\n\t\t\tPretensionSpeedCutoffKph = 16;\r\n\t\t\tThrottleGlobalSpeedLimit = ThrottleGlobalSpeedLimitOptions.Disabled;\r\n\t\t\tThrottleGlobalSpeedLimitPercent = 100;\r\n\t\t\tUsePretension = false;\r\n\t\t\tPretensionSpeedCutoffKph = 0;\r\n\r\n\t\t\treturn true;\r\n\t\t}\r\n\r\n\t\tpublic bool ParseFromBufferV3(byte[] buffer)\r\n\t\t{\r\n\t\t\tif (buffer.Length != ByteSizeV3)\r\n\t\t\t{\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\r\n\t\t\tusing (var s = new MemoryStream(buffer))\r\n\t\t\t{\r\n\t\t\t\tvar br = new BinaryReader(s);\r\n\r\n\t\t\t\tUseFreedomUnits = br.ReadBoolean();\r\n\r\n\t\t\t\tMaxCurrentAmps = br.ReadByte();\r\n\t\t\t\tCurrentRampAmpsSecond = br.ReadByte();\r\n\t\t\t\tMaxBatteryVolts = br.ReadUInt16() / 100f;\r\n\t\t\t\tLowCutoffVolts = br.ReadByte();\r\n\t\t\t\tMaxSpeedKph = br.ReadByte();\r\n\r\n\t\t\t\tUseSpeedSensor = br.ReadBoolean();\r\n\t\t\t\tUseShiftSensor = br.ReadBoolean();\r\n\t\t\t\tUsePushWalk = br.ReadBoolean();\r\n\t\t\t\tUseTemperatureSensor = (TemperatureSensor)br.ReadByte();\r\n\r\n\t\t\t\tWheelSizeInch = br.ReadUInt16() / 10f;\r\n\t\t\t\tNumWheelSensorSignals = br.ReadByte();\r\n\r\n\t\t\t\tPasStartDelayPulses = br.ReadByte();\r\n\t\t\t\tPasStopDelayMilliseconds = br.ReadByte() * 10u;\r\n\t\t\t\tPasKeepCurrentPercent = br.ReadByte();\r\n\t\t\t\tPasKeepCurrentCadenceRpm = br.ReadByte();\r\n\r\n\t\t\t\tThrottleStartMillivolts = br.ReadUInt16();\r\n\t\t\t\tThrottleEndMillivolts = br.ReadUInt16();\r\n\t\t\t\tThrottleStartPercent = br.ReadByte();\r\n\r\n\t\t\t\tShiftInterruptDuration = br.ReadUInt16();\r\n\t\t\t\tShiftInterruptCurrentThresholdPercent = br.ReadByte();\r\n\r\n\t\t\t\tWalkModeDataDisplay = (WalkModeData)br.ReadByte();\r\n\r\n\t\t\t\tAssistModeSelection = (AssistModeSelect)br.ReadByte();\r\n\t\t\t\tAssistStartupLevel = br.ReadByte();\r\n\r\n\t\t\t\tfor (int i = 0; i < StandardAssistLevels.Length; ++i)\r\n\t\t\t\t{\r\n\t\t\t\t\tStandardAssistLevels[i].Type = (AssistFlagsType)br.ReadByte();\r\n\t\t\t\t\tStandardAssistLevels[i].MaxCurrentPercent = br.ReadByte();\r\n\t\t\t\t\tStandardAssistLevels[i].MaxThrottlePercent = br.ReadByte();\r\n\t\t\t\t\tStandardAssistLevels[i].MaxCadencePercent = br.ReadByte();\r\n\t\t\t\t\tStandardAssistLevels[i].MaxSpeedPercent = br.ReadByte();\r\n\t\t\t\t\tStandardAssistLevels[i].TorqueAmplificationFactor = br.ReadByte() / 10f;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tfor (int i = 0; i < SportAssistLevels.Length; ++i)\r\n\t\t\t\t{\r\n\t\t\t\t\tSportAssistLevels[i].Type = (AssistFlagsType)br.ReadByte();\r\n\t\t\t\t\tSportAssistLevels[i].MaxCurrentPercent = br.ReadByte();\r\n\t\t\t\t\tSportAssistLevels[i].MaxThrottlePercent = br.ReadByte();\r\n\t\t\t\t\tSportAssistLevels[i].MaxCadencePercent = br.ReadByte();\r\n\t\t\t\t\tSportAssistLevels[i].MaxSpeedPercent = br.ReadByte();\r\n\t\t\t\t\tSportAssistLevels[i].TorqueAmplificationFactor = br.ReadByte() / 10f;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t// apply default settings for non existing options in version\r\n\t\t\tLightsMode = LightsModeOptions.Default;\r\n\t\t\tThrottleGlobalSpeedLimit = ThrottleGlobalSpeedLimitOptions.Disabled;\r\n\t\t\tThrottleGlobalSpeedLimitPercent = 100;\r\n\t\t\tUsePretension = false;\r\n\t\t\tPretensionSpeedCutoffKph = 0;\r\n\r\n\t\t\treturn true;\r\n\t\t}\r\n\r\n\t\tpublic bool ParseFromBufferV4(byte[] buffer)\r\n\t\t{\r\n\t\t\tif (buffer.Length != ByteSizeV4)\r\n\t\t\t{\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\r\n\t\t\tusing (var s = new MemoryStream(buffer))\r\n\t\t\t{\r\n\t\t\t\tvar br = new BinaryReader(s);\r\n\r\n\t\t\t\tUseFreedomUnits = br.ReadBoolean();\r\n\r\n\t\t\t\tMaxCurrentAmps = br.ReadByte();\r\n\t\t\t\tCurrentRampAmpsSecond = br.ReadByte();\r\n\t\t\t\tMaxBatteryVolts = br.ReadUInt16() / 100f;\r\n\t\t\t\tLowCutoffVolts = br.ReadByte();\r\n\t\t\t\tMaxSpeedKph = br.ReadByte();\r\n\r\n\t\t\t\tUseSpeedSensor = br.ReadBoolean();\r\n\t\t\t\tUseShiftSensor = br.ReadBoolean();\r\n\t\t\t\tUsePushWalk = br.ReadBoolean();\r\n\t\t\t\tUseTemperatureSensor = (TemperatureSensor)br.ReadByte();\r\n\t\t\t\tLightsMode = (LightsModeOptions)br.ReadByte();\r\n\r\n\t\t\t\tWheelSizeInch = br.ReadUInt16() / 10f;\r\n\t\t\t\tNumWheelSensorSignals = br.ReadByte();\r\n\r\n\t\t\t\tPasStartDelayPulses = br.ReadByte();\r\n\t\t\t\tPasStopDelayMilliseconds = br.ReadByte() * 10u;\r\n\t\t\t\tPasKeepCurrentPercent = br.ReadByte();\r\n\t\t\t\tPasKeepCurrentCadenceRpm = br.ReadByte();\r\n\r\n\t\t\t\tThrottleStartMillivolts = br.ReadUInt16();\r\n\t\t\t\tThrottleEndMillivolts = br.ReadUInt16();\r\n\t\t\t\tThrottleStartPercent = br.ReadByte();\r\n\t\t\t\tThrottleGlobalSpeedLimit = (ThrottleGlobalSpeedLimitOptions)br.ReadByte();\r\n\t\t\t\tThrottleGlobalSpeedLimitPercent = br.ReadByte();\r\n\r\n\t\t\t\tShiftInterruptDuration = br.ReadUInt16();\r\n\t\t\t\tShiftInterruptCurrentThresholdPercent = br.ReadByte();\r\n\r\n\t\t\t\tWalkModeDataDisplay = (WalkModeData)br.ReadByte();\r\n\r\n\t\t\t\tAssistModeSelection = (AssistModeSelect)br.ReadByte();\r\n\t\t\t\tAssistStartupLevel = br.ReadByte();\r\n\r\n\t\t\t\tfor (int i = 0; i < StandardAssistLevels.Length; ++i)\r\n\t\t\t\t{\r\n\t\t\t\t\tStandardAssistLevels[i].Type = (AssistFlagsType)br.ReadByte();\r\n\t\t\t\t\tStandardAssistLevels[i].MaxCurrentPercent = br.ReadByte();\r\n\t\t\t\t\tStandardAssistLevels[i].MaxThrottlePercent = br.ReadByte();\r\n\t\t\t\t\tStandardAssistLevels[i].MaxCadencePercent = br.ReadByte();\r\n\t\t\t\t\tStandardAssistLevels[i].MaxSpeedPercent = br.ReadByte();\r\n\t\t\t\t\tStandardAssistLevels[i].TorqueAmplificationFactor = br.ReadByte() / 10f;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tfor (int i = 0; i < SportAssistLevels.Length; ++i)\r\n\t\t\t\t{\r\n\t\t\t\t\tSportAssistLevels[i].Type = (AssistFlagsType)br.ReadByte();\r\n\t\t\t\t\tSportAssistLevels[i].MaxCurrentPercent = br.ReadByte();\r\n\t\t\t\t\tSportAssistLevels[i].MaxThrottlePercent = br.ReadByte();\r\n\t\t\t\t\tSportAssistLevels[i].MaxCadencePercent = br.ReadByte();\r\n\t\t\t\t\tSportAssistLevels[i].MaxSpeedPercent = br.ReadByte();\r\n\t\t\t\t\tSportAssistLevels[i].TorqueAmplificationFactor = br.ReadByte() / 10f;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t// apply default settings for non existing options in version\r\n\t\t\tUsePretension = false;\r\n\t\t\tPretensionSpeedCutoffKph = 0;\r\n\r\n\t\t\treturn true;\r\n\t\t}\r\n\r\n\t\tpublic bool ParseFromBufferV5(byte[] buffer)\r\n\t\t{\r\n\t\t\tif (buffer.Length != ByteSizeV5)\r\n\t\t\t{\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\r\n\t\t\tusing (var s = new MemoryStream(buffer))\r\n\t\t\t{\r\n\t\t\t\tvar br = new BinaryReader(s);\r\n\r\n\t\t\t\tUseFreedomUnits = br.ReadBoolean();\r\n\r\n\t\t\t\tMaxCurrentAmps = br.ReadByte();\r\n\t\t\t\tCurrentRampAmpsSecond = br.ReadByte();\r\n\t\t\t\tMaxBatteryVolts = br.ReadUInt16() / 100f;\r\n\t\t\t\tLowCutoffVolts = br.ReadByte();\r\n\t\t\t\tMaxSpeedKph = br.ReadByte();\r\n\r\n\t\t\t\tUseSpeedSensor = br.ReadBoolean();\r\n\t\t\t\tUseShiftSensor = br.ReadBoolean();\r\n\t\t\t\tUsePushWalk = br.ReadBoolean();\r\n\t\t\t\tUseTemperatureSensor = (TemperatureSensor)br.ReadByte();\r\n\t\t\t\tLightsMode = (LightsModeOptions)br.ReadByte();\r\n\t\t\t\tUsePretension = br.ReadBoolean();\r\n\t\t\t\tPretensionSpeedCutoffKph = br.ReadByte();\r\n\r\n\t\t\t\tWheelSizeInch = br.ReadUInt16() / 10f;\r\n\t\t\t\tNumWheelSensorSignals = br.ReadByte();\r\n\r\n\t\t\t\tPasStartDelayPulses = br.ReadByte();\r\n\t\t\t\tPasStopDelayMilliseconds = br.ReadByte() * 10u;\r\n\t\t\t\tPasKeepCurrentPercent = br.ReadByte();\r\n\t\t\t\tPasKeepCurrentCadenceRpm = br.ReadByte();\r\n\r\n\t\t\t\tThrottleStartMillivolts = br.ReadUInt16();\r\n\t\t\t\tThrottleEndMillivolts = br.ReadUInt16();\r\n\t\t\t\tThrottleStartPercent = br.ReadByte();\r\n\t\t\t\tThrottleGlobalSpeedLimit = (ThrottleGlobalSpeedLimitOptions)br.ReadByte();\r\n\t\t\t\tThrottleGlobalSpeedLimitPercent = br.ReadByte();\r\n\r\n\t\t\t\tShiftInterruptDuration = br.ReadUInt16();\r\n\t\t\t\tShiftInterruptCurrentThresholdPercent = br.ReadByte();\r\n\r\n\t\t\t\tWalkModeDataDisplay = (WalkModeData)br.ReadByte();\r\n\r\n\t\t\t\tAssistModeSelection = (AssistModeSelect)br.ReadByte();\r\n\t\t\t\tAssistStartupLevel = br.ReadByte();\r\n\r\n\t\t\t\tfor (int i = 0; i < StandardAssistLevels.Length; ++i)\r\n\t\t\t\t{\r\n\t\t\t\t\tStandardAssistLevels[i].Type = (AssistFlagsType)br.ReadByte();\r\n\t\t\t\t\tStandardAssistLevels[i].MaxCurrentPercent = br.ReadByte();\r\n\t\t\t\t\tStandardAssistLevels[i].MaxThrottlePercent = br.ReadByte();\r\n\t\t\t\t\tStandardAssistLevels[i].MaxCadencePercent = br.ReadByte();\r\n\t\t\t\t\tStandardAssistLevels[i].MaxSpeedPercent = br.ReadByte();\r\n\t\t\t\t\tStandardAssistLevels[i].TorqueAmplificationFactor = br.ReadByte() / 10f;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tfor (int i = 0; i < SportAssistLevels.Length; ++i)\r\n\t\t\t\t{\r\n\t\t\t\t\tSportAssistLevels[i].Type = (AssistFlagsType)br.ReadByte();\r\n\t\t\t\t\tSportAssistLevels[i].MaxCurrentPercent = br.ReadByte();\r\n\t\t\t\t\tSportAssistLevels[i].MaxThrottlePercent = br.ReadByte();\r\n\t\t\t\t\tSportAssistLevels[i].MaxCadencePercent = br.ReadByte();\r\n\t\t\t\t\tSportAssistLevels[i].MaxSpeedPercent = br.ReadByte();\r\n\t\t\t\t\tSportAssistLevels[i].TorqueAmplificationFactor = br.ReadByte() / 10f;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\treturn true;\r\n\t\t}\r\n\r\n\t\tpublic byte[] WriteToBuffer()\r\n\t\t{\r\n\t\t\tusing (var s = new MemoryStream())\r\n\t\t\t{\r\n\t\t\t\tvar bw = new BinaryWriter(s);\r\n\r\n\t\t\t\tbw.Write(UseFreedomUnits);\r\n\r\n\t\t\t\tbw.Write((byte)MaxCurrentAmps);\r\n\t\t\t\tbw.Write((byte)CurrentRampAmpsSecond);\r\n\t\t\t\tbw.Write((UInt16)(MaxBatteryVolts * 100));\r\n\t\t\t\tbw.Write((byte)LowCutoffVolts);\r\n\t\t\t\tbw.Write((byte)MaxSpeedKph);\r\n\r\n\t\t\t\tbw.Write(UseSpeedSensor);\r\n\t\t\t\tbw.Write(UseShiftSensor);\r\n\t\t\t\tbw.Write(UsePushWalk);\r\n\t\t\t\tbw.Write((byte)UseTemperatureSensor);\r\n\t\t\t\tbw.Write((byte)LightsMode);\r\n\t\t\t\tbw.Write(UsePretension);\r\n\t\t\t\tbw.Write((byte)PretensionSpeedCutoffKph);\r\n\r\n\t\t\t\tbw.Write((UInt16)(WheelSizeInch * 10));\r\n\t\t\t\tbw.Write((byte)NumWheelSensorSignals);\r\n\r\n\t\t\t\tbw.Write((byte)PasStartDelayPulses);\r\n\t\t\t\tbw.Write((byte)(PasStopDelayMilliseconds / 10u));\r\n\t\t\t\tbw.Write((byte)PasKeepCurrentPercent);\r\n\t\t\t\tbw.Write((byte)PasKeepCurrentCadenceRpm);\r\n\r\n\t\t\t\tbw.Write((UInt16)ThrottleStartMillivolts);\r\n\t\t\t\tbw.Write((UInt16)ThrottleEndMillivolts);\r\n\t\t\t\tbw.Write((byte)ThrottleStartPercent);\r\n\t\t\t\tbw.Write((byte)ThrottleGlobalSpeedLimit);\r\n\t\t\t\tbw.Write((byte)ThrottleGlobalSpeedLimitPercent);\r\n\r\n\t\t\t\tbw.Write((UInt16)ShiftInterruptDuration);\r\n\t\t\t\tbw.Write((byte)ShiftInterruptCurrentThresholdPercent);\r\n\r\n\t\t\t\tbw.Write((byte)WalkModeDataDisplay);\r\n\r\n\t\t\t\tbw.Write((byte)AssistModeSelection);\r\n\t\t\t\tbw.Write((byte)AssistStartupLevel);\r\n\r\n\t\t\t\tfor (int i = 0; i < StandardAssistLevels.Length; ++i)\r\n\t\t\t\t{\r\n\t\t\t\t\tbw.Write((byte)StandardAssistLevels[i].Type);\r\n\t\t\t\t\tbw.Write((byte)StandardAssistLevels[i].MaxCurrentPercent);\r\n\t\t\t\t\tbw.Write((byte)StandardAssistLevels[i].MaxThrottlePercent);\r\n\t\t\t\t\tbw.Write((byte)StandardAssistLevels[i].MaxCadencePercent);\r\n\t\t\t\t\tbw.Write((byte)StandardAssistLevels[i].MaxSpeedPercent);\r\n\t\t\t\t\tbw.Write((byte)Math.Round(StandardAssistLevels[i].TorqueAmplificationFactor * 10));\r\n\t\t\t\t}\r\n\r\n\t\t\t\tfor (int i = 0; i < SportAssistLevels.Length; ++i)\r\n\t\t\t\t{\r\n\t\t\t\t\tbw.Write((byte)SportAssistLevels[i].Type);\r\n\t\t\t\t\tbw.Write((byte)SportAssistLevels[i].MaxCurrentPercent);\r\n\t\t\t\t\tbw.Write((byte)SportAssistLevels[i].MaxThrottlePercent);\r\n\t\t\t\t\tbw.Write((byte)SportAssistLevels[i].MaxCadencePercent);\r\n\t\t\t\t\tbw.Write((byte)SportAssistLevels[i].MaxSpeedPercent);\r\n\t\t\t\t\tbw.Write((byte)Math.Round(SportAssistLevels[i].TorqueAmplificationFactor * 10));\r\n\t\t\t\t}\r\n\r\n\t\t\t\treturn s.ToArray();\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tpublic void CopyFrom(Configuration cfg)\r\n\t\t{\r\n\t\t\tTarget = cfg.Target;\r\n\r\n\t\t\tUseFreedomUnits = cfg.UseFreedomUnits;\r\n\t\t\tMaxCurrentAmps = cfg.MaxCurrentAmps;\r\n\t\t\tCurrentRampAmpsSecond = cfg.CurrentRampAmpsSecond;\r\n\t\t\tMaxBatteryVolts = cfg.MaxBatteryVolts;\r\n\t\t\tLowCutoffVolts = cfg.LowCutoffVolts;\r\n\t\t\tUseSpeedSensor = cfg.UseSpeedSensor;\r\n\t\t\tUseShiftSensor = cfg.UseShiftSensor;\r\n\t\t\tUsePushWalk = cfg.UsePushWalk;\r\n\t\t\tUsePretension = cfg.UsePretension;\r\n\t\t\tPretensionSpeedCutoffKph = cfg.PretensionSpeedCutoffKph;\r\n\t\t\tUseTemperatureSensor = cfg.UseTemperatureSensor;\r\n\t\t\tLightsMode = cfg.LightsMode;\r\n\t\t\tWheelSizeInch = cfg.WheelSizeInch;\r\n\t\t\tNumWheelSensorSignals = cfg.NumWheelSensorSignals;\r\n\t\t\tMaxSpeedKph = cfg.MaxSpeedKph;\r\n\t\t\tPasStartDelayPulses = cfg.PasStartDelayPulses;\r\n\t\t\tPasStopDelayMilliseconds = cfg.PasStopDelayMilliseconds;\r\n\t\t\tPasKeepCurrentPercent = cfg.PasKeepCurrentPercent;\r\n\t\t\tPasKeepCurrentCadenceRpm = cfg.PasKeepCurrentCadenceRpm;\r\n\t\t\tThrottleStartMillivolts = cfg.ThrottleStartMillivolts;\r\n\t\t\tThrottleEndMillivolts = cfg.ThrottleEndMillivolts;\r\n\t\t\tThrottleStartPercent = cfg.ThrottleStartPercent;\r\n\t\t\tThrottleGlobalSpeedLimit = cfg.ThrottleGlobalSpeedLimit;\r\n\t\t\tThrottleGlobalSpeedLimitPercent = cfg.ThrottleGlobalSpeedLimitPercent;\r\n\t\t\tShiftInterruptDuration = cfg.ShiftInterruptDuration;\r\n\t\t\tShiftInterruptCurrentThresholdPercent = cfg.ShiftInterruptCurrentThresholdPercent;\r\n\t\t\tWalkModeDataDisplay = cfg.WalkModeDataDisplay;\r\n\t\t\tAssistModeSelection = cfg.AssistModeSelection;\r\n\t\t\tAssistStartupLevel = cfg.AssistStartupLevel;\r\n\r\n\t\t\tfor (int i = 0; i < Math.Min(cfg.StandardAssistLevels.Length, StandardAssistLevels.Length); ++i)\r\n\t\t\t{\r\n\t\t\t\tStandardAssistLevels[i].Type = cfg.StandardAssistLevels[i].Type;\r\n\t\t\t\tStandardAssistLevels[i].MaxCurrentPercent = cfg.StandardAssistLevels[i].MaxCurrentPercent;\r\n\t\t\t\tStandardAssistLevels[i].MaxThrottlePercent = cfg.StandardAssistLevels[i].MaxThrottlePercent;\r\n\t\t\t\tStandardAssistLevels[i].MaxCadencePercent = cfg.StandardAssistLevels[i].MaxCadencePercent;\r\n\t\t\t\tStandardAssistLevels[i].MaxSpeedPercent = cfg.StandardAssistLevels[i].MaxSpeedPercent;\r\n\t\t\t\tStandardAssistLevels[i].TorqueAmplificationFactor = cfg.StandardAssistLevels[i].TorqueAmplificationFactor;\r\n\t\t\t}\r\n\r\n\t\t\tfor (int i = 0; i < Math.Min(cfg.SportAssistLevels.Length, SportAssistLevels.Length); ++i)\r\n\t\t\t{\r\n\t\t\t\tSportAssistLevels[i].Type = cfg.SportAssistLevels[i].Type;\r\n\t\t\t\tSportAssistLevels[i].MaxCurrentPercent = cfg.SportAssistLevels[i].MaxCurrentPercent;\r\n\t\t\t\tSportAssistLevels[i].MaxThrottlePercent = cfg.SportAssistLevels[i].MaxThrottlePercent;\r\n\t\t\t\tSportAssistLevels[i].MaxCadencePercent = cfg.SportAssistLevels[i].MaxCadencePercent;\r\n\t\t\t\tSportAssistLevels[i].MaxSpeedPercent = cfg.SportAssistLevels[i].MaxSpeedPercent;\r\n\t\t\t\tSportAssistLevels[i].TorqueAmplificationFactor = cfg.SportAssistLevels[i].TorqueAmplificationFactor;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tpublic void ReadFromFile(string filepath)\r\n\t\t{\r\n\t\t\tvar serializer = new XmlSerializer(typeof(Configuration));\r\n\r\n\t\t\tusing (var reader = new FileStream(filepath, FileMode.Open))\r\n\t\t\t{\r\n\t\t\t\tvar obj = serializer.Deserialize(reader) as Configuration;\r\n\t\t\t\tCopyFrom(obj);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tpublic void WriteToFile(string filepath)\r\n\t\t{\r\n\t\t\tvar serializer = new XmlSerializer(typeof(Configuration));\r\n\t\t\tvar settings = new XmlWriterSettings { Encoding = Encoding.UTF8, Indent = true };\r\n\t\t\tusing (var xmlWriter = XmlWriter.Create(new StreamWriter(filepath), settings))\r\n\t\t\t{\r\n\t\t\t\tserializer.Serialize(xmlWriter, this);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tpublic void Validate()\r\n\t\t{\r\n\t\t\tValidateLimits(MaxCurrentAmps, 5, MaxCurrentLimitAmps, \"Max Current (A)\");\r\n\t\t\tValidateLimits(CurrentRampAmpsSecond, 1, 255, \"Current Ramp (A/s)\");\r\n\t\t\tValidateLimits((uint)MaxBatteryVolts, 1, 100, \"Max Battery Voltage (V)\");\r\n\t\t\tValidateLimits(LowCutoffVolts, 1, 100, \"Low Voltage Cut Off (V)\");\r\n\r\n\t\t\tValidateLimits((uint)WheelSizeInch, 10, 40, \"Wheel Size (inch)\");\r\n\t\t\tValidateLimits(NumWheelSensorSignals, 1, 10, \"Wheel Sensor Signals\");\r\n\t\t\tValidateLimits(MaxSpeedKph, 0, 180, \"Max Speed (km/h)\");\r\n\t\t\tValidateLimits(PretensionSpeedCutoffKph, 0, 100, \"Pretension Speed Cutoff (km/h)\");\r\n\r\n\t\t\tValidateLimits(PasStartDelayPulses, 0, 24, \"Pas Delay (pulses)\");\r\n\t\t\tValidateLimits(PasStopDelayMilliseconds, 50, 1000, \"Pas Stop Delay (ms)\");\r\n\t\t\tValidateLimits(PasKeepCurrentPercent, 10, 100, \"Pas Keep Current (%)\");\r\n\t\t\tValidateLimits(PasKeepCurrentCadenceRpm, 0, 255, \"Pas Keep Current Cadence (rpm)\");\r\n\r\n\t\t\tValidateLimits(ThrottleStartMillivolts, 200, 2500, \"Throttle Start (mV)\");\r\n\t\t\tValidateLimits(ThrottleEndMillivolts, 2500, 5000, \"Throttle End (mV)\");\r\n\t\t\tValidateLimits(ThrottleStartPercent, 0, 100, \"Throttle Start (%)\");\r\n\t\t\tValidateLimits(ThrottleGlobalSpeedLimitPercent, 0, 100, \"Throttle Global Speed Limit (%)\");\r\n\r\n\t\t\tValidateLimits(ShiftInterruptDuration, 50, 2000, \"Shift Interrupt Duration (ms)\");\r\n\t\t\tValidateLimits(ShiftInterruptCurrentThresholdPercent, 0, 100, \"Shift Interrupt Current Threshold (%)\");\r\n\r\n\t\t\tValidateLimits(AssistStartupLevel, 0, 9, \"Assist Startup Level\");\r\n\r\n\t\t\tfor (int i = 0; i < StandardAssistLevels.Length; ++i)\r\n\t\t\t{\r\n\t\t\t\tValidateLimits(StandardAssistLevels[i].MaxCurrentPercent, 0, 100, $\"Standard (Level {i}): Target Power (%)\");\r\n\t\t\t\tValidateLimits(StandardAssistLevels[i].MaxThrottlePercent, 0, 100, $\"Standard (Level {i}): Max Throttle (%)\");\r\n\t\t\t\tValidateLimits(StandardAssistLevels[i].MaxCadencePercent, 0, 100, $\"Standard (Level {i}): Max Cadence (%)\");\r\n\t\t\t\tValidateLimits(StandardAssistLevels[i].MaxSpeedPercent, 0, 100, $\"Standard (Level {i}): Max Speed (%)\");\r\n\t\t\t\tValidateLimits((uint)StandardAssistLevels[i].TorqueAmplificationFactor, 0, 25, $\"Standard (Level {i}): Torque Amplification\");\r\n\t\t\t}\r\n\r\n\t\t\tfor (int i = 0; i < SportAssistLevels.Length; ++i)\r\n\t\t\t{\r\n\t\t\t\tValidateLimits(SportAssistLevels[i].MaxCurrentPercent, 0, 100, $\"Sport (Level {i}): Target Power (%)\");\r\n\t\t\t\tValidateLimits(SportAssistLevels[i].MaxThrottlePercent, 0, 100, $\"Sport (Level {i}): Max Throttle (%)\");\r\n\t\t\t\tValidateLimits(SportAssistLevels[i].MaxCadencePercent, 0, 100, $\"Sport (Level {i}): Max Cadence (%)\");\r\n\t\t\t\tValidateLimits(SportAssistLevels[i].MaxSpeedPercent, 0, 100, $\"Sport (Level {i}): Max Speed (%)\");\r\n\t\t\t\tValidateLimits((uint)SportAssistLevels[i].TorqueAmplificationFactor, 0, 25, $\"Sport (Level {i}): Torque Amplification\");\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tprivate void ValidateLimits(uint value, uint min, uint max, string name)\r\n\t\t{\r\n\t\t\tif (value < min || value > max)\r\n\t\t\t{\r\n\t\t\t\tthrow new Exception(name + \" must be in interval \" + min + \"-\" + max + \".\");\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n"
  },
  {
    "path": "src/tool/Model/EventLogEntry.cs",
    "content": "using System;\n\nnamespace BBSFW.Model\n{\n\tpublic class EventLogEntry\n\t{\n\t\tprivate int _event;\n\t\tprivate int? _data;\n\n\n\t\tprivate const int EVT_MSG_MOTOR_INIT_OK =\t\t\t\t1;\n\t\tprivate const int EVT_MSG_CONFIG_READ_DONE =\t\t\t2;\n\t\tprivate const int EVT_MSG_CONFIG_RESET =\t\t\t\t3;\n\t\tprivate const int EVT_MSG_CONFIG_WRITE_DONE =\t\t\t4;\n\t\tprivate const int EVT_MSG_CONFIG_READ_BEGIN =\t\t\t5;\n\t\tprivate const int EVT_MSG_CONFIG_WRITE_BEGIN =\t\t\t6;\n\t\tprivate const int EVT_MSG_PSTATE_READ_BEGIN =\t\t\t7;\n\t\tprivate const int EVT_MSG_PSTATE_READ_DONE =\t\t\t8;\n\t\tprivate const int EVT_MSG_PSTATE_WRITE_BEGIN =\t\t\t9;\n\t\tprivate const int EVT_MSG_PSTATE_WRITE_DONE =\t\t\t10;\n\n\t\tprivate const int EVT_ERROR_INIT_MOTOR =\t\t\t\t64;\n\t\tprivate const int EVT_ERROR_CHANGE_TARGET_SPEED =\t\t65;\n\t\tprivate const int EVT_ERROR_CHANGE_TARGET_CURRENT =\t\t66;\n\t\tprivate const int EVT_ERROR_READ_MOTOR_STATUS =\t\t\t67;\n\t\tprivate const int EVT_ERROR_READ_MOTOR_CURRENT =\t\t68;\n\t\tprivate const int EVT_ERROR_READ_MOTOR_VOLTAGE =\t\t69;\n\n\t\tprivate const int EVT_ERROR_EEPROM_READ =\t\t\t\t70;\n\t\tprivate const int EVT_ERROR_EEPROM_WRITE =\t\t\t\t71;\n\t\tprivate const int EVT_ERROR_EEPROM_ERASE =\t\t\t\t72;\n\t\tprivate const int EVT_ERROR_EEPROM_VERIFY_VERSION =\t\t73;\n\t\tprivate const int EVT_ERROR_EEPROM_VERIFY_CHECKSUM =\t74;\n\t\tprivate const int EVT_ERROR_THROTTLE_LOW_LIMIT =\t\t75;\n\t\tprivate const int EVT_ERROR_THROTTLE_HIGH_LIMIT =\t\t76;\n\t\tprivate const int EVT_ERROR_WATCHDOG_TRIGGERED =\t\t77;\n\t\tprivate const int EVT_ERROR_EXTCOM_CHECKSUM =\t\t\t78;\r\n\t\tprivate const int EVT_ERROR_EXTCOM_DISCARD =\t\t\t79;\n\n\t\tprivate const int EVT_DATA_TARGET_CURRENT =\t\t\t\t128;\n\t\tprivate const int EVT_DATA_TARGET_SPEED =\t\t\t\t129;\n\t\tprivate const int EVT_DATA_MOTOR_STATUS =\t\t\t\t130;\n\t\tprivate const int EVT_DATA_ASSIST_LEVEL =\t\t\t\t131;\n\t\tprivate const int EVT_DATA_OPERATION_MODE =\t\t\t\t132;\n\t\tprivate const int EVT_DATA_WHEEL_SPEED_PPM =\t\t\t133;\n\t\tprivate const int EVT_DATA_LIGHTS =\t\t\t\t\t\t134;\n\t\tprivate const int EVT_DATA_TEMPERATURE =\t\t\t\t135;\n\t\tprivate const int EVT_DATA_THERMAL_LIMITING =\t\t\t136;\n\t\tprivate const int EVT_DATA_SPEED_LIMITING =\t\t\t\t137;\n\t\tprivate const int EVT_DATA_MAX_CURRENT_ADC_REQUEST =\t138;\n\t\tprivate const int EVT_DATA_MAX_CURRENT_ADC_RESPONSE =\t139;\n\t\tprivate const int EVT_DATA_MAIN_LOOP_TIME =\t\t\t\t140;\n\t\tprivate const int EVT_DATA_THROTTLE_ADC =\t\t\t\t141;\n\t\tprivate const int EVT_DATA_LVC_LIMITING =\t\t\t\t142;\n\t\tprivate const int EVT_DATA_SHIFT_SENSOR =\t\t\t\t143;\n\t\tprivate const int EVT_DATA_BBSHD_THERMISTOR =\t\t\t144;\n\t\tprivate const int EVT_DATA_VOLTAGE =\t\t\t\t\t145;\n\t\tprivate const int EVT_DATA_VOLTAGE_CALIBRATION =\t\t146;\n\t\tprivate const int EVT_DATA_TORQUE_ADC =\t\t\t\t\t147;\n\t\tprivate const int EVT_DATA_TORQUE_ADC_CALIBRATED =\t\t148;\n\n\n\t\tpublic enum LogLevel\n\t\t{\n\t\t\tInfo,\n\t\t\tWarning,\n\t\t\tError\n\t\t}\n\n\n\t\tpublic DateTime Timestamp { get; private set; }\n\n\t\tpublic LogLevel Level { get; private set; }\n\n\t\tpublic string Message { get; private set; }\n\n\n\t\tpublic EventLogEntry(int evt, int? data)\n\t\t{\n\t\t\tTimestamp = DateTime.Now;\n\t\t\t_event = evt;\n\t\t\tif (evt >= 64 & evt < 128)\n\t\t\t{\n\t\t\t\tLevel = LogLevel.Error;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tLevel = LogLevel.Info;\n\t\t\t}\n\n\t\t\t_data = data;\n\t\t\tMessage = Parse();\n\t\t}\n\n\n\t\tpublic string Parse()\n\t\t{\n\t\t\tswitch (_event)\n\t\t\t{\n\t\t\t\tcase EVT_MSG_MOTOR_INIT_OK:\n\t\t\t\t\treturn \"Motor initialization successful.\";\n\t\t\t\tcase EVT_MSG_CONFIG_READ_DONE:\n\t\t\t\t\treturn \"Successfully read configuration from eeprom.\";\n\t\t\t\tcase EVT_MSG_CONFIG_RESET:\n\t\t\t\t\tLevel = LogLevel.Warning;\n\t\t\t\t\treturn \"Configuration reset performed.\";\n\t\t\t\tcase EVT_MSG_CONFIG_WRITE_DONE:\n\t\t\t\t\treturn \"Configuration successfully written to eeprom.\";\n\t\t\t\tcase EVT_MSG_CONFIG_READ_BEGIN:\n\t\t\t\t\treturn \"Reading configuration from eeprom.\";\n\t\t\t\tcase EVT_MSG_CONFIG_WRITE_BEGIN:\n\t\t\t\t\treturn \"Writing configuration to eeprom.\";\n\t\t\t\tcase EVT_MSG_PSTATE_READ_BEGIN:\n\t\t\t\t\treturn \"Reading persisted state from eeprom.\";\n\t\t\t\tcase EVT_MSG_PSTATE_READ_DONE:\n\t\t\t\t\treturn \"Successfully read persisted state from eeprom.\";\n\t\t\t\tcase EVT_MSG_PSTATE_WRITE_BEGIN:\n\t\t\t\t\treturn \"Writing persisted stated to eeprom.\";\n\t\t\t\tcase EVT_MSG_PSTATE_WRITE_DONE:\n\t\t\t\t\treturn \"Persisted state successfully written to eeprom.\";\n\n\t\t\t\tcase EVT_ERROR_INIT_MOTOR:\n\t\t\t\t\treturn \"Failed to perform motor controller initialization.\";\n\t\t\t\tcase EVT_ERROR_CHANGE_TARGET_CURRENT:\n\t\t\t\t\treturn \"Failed to set motor target current on motor controller.\";\n\t\t\t\tcase EVT_ERROR_CHANGE_TARGET_SPEED:\n\t\t\t\t\treturn \"Failed to set motor target speed on motor controller.\";\n\t\t\t\tcase EVT_ERROR_READ_MOTOR_STATUS:\n\t\t\t\t\treturn \"Failed to read status from motor controller.\";\n\t\t\t\tcase EVT_ERROR_READ_MOTOR_CURRENT:\n\t\t\t\t\treturn \"Failed to read current from motor controller.\";\n\t\t\t\tcase EVT_ERROR_READ_MOTOR_VOLTAGE:\n\t\t\t\t\treturn \"Failed to read voltage from motor controller.\";\n\t\t\t\tcase EVT_ERROR_EEPROM_READ:\n\t\t\t\t\treturn \"Failed to read data from eeprom.\";\n\t\t\t\tcase EVT_ERROR_EEPROM_WRITE:\n\t\t\t\t\treturn \"Failed to write data to eeprom.\";\n\t\t\t\tcase EVT_ERROR_EEPROM_ERASE:\n\t\t\t\t\treturn \"Failed to erase eeprom before writing data.\";\n\t\t\t\tcase EVT_ERROR_EEPROM_VERIFY_VERSION:\n\t\t\t\t\treturn \"Data read from eeprom is of the wrong version.\";\n\t\t\t\tcase EVT_ERROR_EEPROM_VERIFY_CHECKSUM:\n\t\t\t\t\treturn \"Failed to verify checksum on data read from eeprom.\";\n\t\t\t\tcase EVT_ERROR_THROTTLE_LOW_LIMIT:\n\t\t\t\t\treturn \"Invalid throttle reading, below low limit, check throttle.\";\n\t\t\t\tcase EVT_ERROR_THROTTLE_HIGH_LIMIT:\n\t\t\t\t\treturn \"Invalid throttle reading, above high limit, check throttle.\";\n\t\t\t\tcase EVT_ERROR_WATCHDOG_TRIGGERED:\n\t\t\t\t\treturn \"Software reset by watchdog, software error.\";\n\t\t\t\tcase EVT_ERROR_EXTCOM_CHECKSUM:\n\t\t\t\t\treturn \"Message received with invalid checksum.\";\r\n\t\t\t\tcase EVT_ERROR_EXTCOM_DISCARD:\r\n\t\t\t\t\treturn \"Invalid message received on serial port, discarded.\";\n\n\t\t\t\tcase EVT_DATA_TARGET_CURRENT:\n\t\t\t\t\treturn $\"Motor target current changed to {_data}%.\";\n\t\t\t\tcase EVT_DATA_TARGET_SPEED:\n\t\t\t\t\treturn $\"Motor target speed changed to {_data}%.\";\n\t\t\t\tcase EVT_DATA_MOTOR_STATUS:\n\t\t\t\t\tLevel = _data != 0 ? LogLevel.Error : LogLevel.Info;\n\t\t\t\t\treturn $\"Motor controller status changed to 0x{_data:X}.\";\n\t\t\t\tcase EVT_DATA_ASSIST_LEVEL:\n\t\t\t\t\treturn $\"Assist level changed to {_data}.\";\n\t\t\t\tcase EVT_DATA_OPERATION_MODE:\n\t\t\t\t\treturn $\"Operation mode changed to {_data}.\";\n\t\t\t\tcase EVT_DATA_WHEEL_SPEED_PPM:\n\t\t\t\t\treturn $\"Max wheel speed changed to {_data} rpm.\";\n\t\t\t\tcase EVT_DATA_LIGHTS:\n\t\t\t\t\treturn $\"Lights status changed to {_data}.\";\n\t\t\t\tcase EVT_DATA_TEMPERATURE:\n\t\t\t\t\t{\n\t\t\t\t\t\tbyte[] raw = BitConverter.GetBytes(_data.Value);\n\t\t\t\t\t\treturn $\"Temperature, motor={(sbyte)raw[1]}C, controller={(sbyte)raw[0]}C.\";\n\t\t\t\t\t}\n\t\t\t\tcase EVT_DATA_THERMAL_LIMITING:\n\t\t\t\t\tif (_data.Value != 0)\n\t\t\t\t\t{\n\t\t\t\t\t\tLevel = LogLevel.Warning;\n\t\t\t\t\t\treturn \"Thermal limiting activated, reducing power.\";\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\treturn \"Thermal limiting deactivated.\";\n\t\t\t\t\t}\n\t\t\t\tcase EVT_DATA_SPEED_LIMITING:\n\t\t\t\t\tif (_data.Value != 0)\n\t\t\t\t\t{\n\t\t\t\t\t\treturn \"Speed limiting activated.\";\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\treturn \"Speed limiting deactivated.\";\n\t\t\t\t\t}\n\t\t\t\tcase EVT_DATA_MAX_CURRENT_ADC_REQUEST:\n\t\t\t\t\treturn $\"Requesting to configure max current on motor controller mcu, adc={_data}.\";\n\t\t\t\tcase EVT_DATA_MAX_CURRENT_ADC_RESPONSE:\n\t\t\t\t\treturn $\"Max current configured on motor controller mcu, response was adc={_data}.\";\n\t\t\t\tcase EVT_DATA_MAIN_LOOP_TIME:\n\t\t\t\t\treturn $\"Main loop, interval={_data}ms.\";\n\t\t\t\tcase EVT_DATA_THROTTLE_ADC:\n\t\t\t\t\treturn $\"Throttle adc, value={_data}.\";\n\t\t\t\tcase EVT_DATA_LVC_LIMITING:\n\t\t\t\t\tif (_data.Value != 0)\n\t\t\t\t\t{\n\t\t\t\t\t\treturn $\"Low voltage limiting activated, voltage={(_data / 100f):0.0}\";\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\treturn \"Low voltage limiting deactivated.\";\n\t\t\t\t\t}\n\t\t\t\tcase EVT_DATA_SHIFT_SENSOR:\n\t\t\t\t\tif (_data.Value != 0)\n\t\t\t\t\t{\n\t\t\t\t\t\treturn $\"Shift sensor power ramp started.\";\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\treturn $\"Shift sensor power ramp ended.\";\n\t\t\t\t\t}\n\t\t\t\tcase EVT_DATA_BBSHD_THERMISTOR:\n\t\t\t\t\tif (_data.Value != 0)\n\t\t\t\t\t{\n\t\t\t\t\t\treturn \"BBSHD motor with PTC thermistor detected.\";\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\treturn \"BBSHD motor with NTC thermistor detected.\";\n\t\t\t\t\t}\n\t\t\t\tcase EVT_DATA_VOLTAGE:\n\t\t\t\t\treturn $\"Battery voltage reading, value={_data / 100f}V.\";\n\t\t\t\tcase EVT_DATA_VOLTAGE_CALIBRATION:\n\t\t\t\t\treturn $\"Battery voltage calibration updated, adc_steps_per_volt={_data / 100f}.\";\n\t\t\t\tcase EVT_DATA_TORQUE_ADC:\n\t\t\t\t\treturn $\"Torque adc, value={_data}.\";\n\t\t\t\tcase EVT_DATA_TORQUE_ADC_CALIBRATED:\n\t\t\t\t\treturn $\"Torque sensor calibrated, adc_bias={_data}.\";\n\t\t\t}\n\n\t\t\tif (_data.HasValue)\n\t\t\t{\n\t\t\t\treturn $\"Unknown ({_event}, value={_data.Value})\";\n\t\t\t}\n\n\t\t\treturn $\"Unknown ({_event})\";\n\t\t}\n\n\n\t}\n}\n"
  },
  {
    "path": "src/tool/Properties/Settings.Designer.cs",
    "content": "﻿//------------------------------------------------------------------------------\n// <auto-generated>\n//     This code was generated by a tool.\n//     Runtime Version:4.0.30319.42000\n//\n//     Changes to this file may cause incorrect behavior and will be lost if\n//     the code is regenerated.\n// </auto-generated>\n//------------------------------------------------------------------------------\n\nnamespace BBSFW.Properties {\n    \n    \n    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]\n    [global::System.CodeDom.Compiler.GeneratedCodeAttribute(\"Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator\", \"16.7.0.0\")]\n    internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {\n        \n        private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));\n        \n        public static Settings Default {\n            get {\n                return defaultInstance;\n            }\n        }\n        \n        [global::System.Configuration.UserScopedSettingAttribute()]\n        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]\n        [global::System.Configuration.DefaultSettingValueAttribute(\"False\")]\n        public bool UseFreedomUnits {\n            get {\n                return ((bool)(this[\"UseFreedomUnits\"]));\n            }\n            set {\n                this[\"UseFreedomUnits\"] = value;\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "src/tool/Properties/Settings.settings",
    "content": "﻿<?xml version='1.0' encoding='utf-8'?>\n<SettingsFile xmlns=\"http://schemas.microsoft.com/VisualStudio/2004/01/settings\" CurrentProfile=\"(Default)\" GeneratedClassNamespace=\"BBSFW.Properties\" GeneratedClassName=\"Settings\">\n  <Profiles />\n  <Settings>\n    <Setting Name=\"UseFreedomUnits\" Type=\"System.Boolean\" Scope=\"User\">\n      <Value Profile=\"(Default)\">False</Value>\n    </Setting>\n  </Settings>\n</SettingsFile>"
  },
  {
    "path": "src/tool/View/AssistLevelCruiseView.xaml",
    "content": "<UserControl x:Class=\"BBSFW.View.AssistLevelCruiseView\"\n             xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"\n             xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\"\n             xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" \n             xmlns:d=\"http://schemas.microsoft.com/expression/blend/2008\" \n             xmlns:local=\"clr-namespace:BBSFW.View\"\n             mc:Ignorable=\"d\" \n             d:DesignHeight=\"450\" d:DesignWidth=\"800\">\n    <Grid>\n\t\t<Grid.ColumnDefinitions>\n\t\t\t<ColumnDefinition />\n\t\t\t<ColumnDefinition />\n\t\t</Grid.ColumnDefinitions>\n\n\t\t<Grid.RowDefinitions>\n\t\t\t<RowDefinition Height=\"Auto\" />\n\t\t\t<RowDefinition Height=\"Auto\" />\n\t\t\t<RowDefinition Height=\"Auto\" />\n\t\t\t<RowDefinition />\n\t\t</Grid.RowDefinitions>\n\n\t\t<TextBlock Grid.Column=\"0\" Grid.Row=\"0\" Text=\"Max Current (%):\" VerticalAlignment=\"Center\" Margin=\"0 8 0 0\" />\n\t\t<TextBox Grid.Column=\"1\" Grid.Row=\"0\" Margin=\"10 8 0 0\" Text=\"{Binding TargetCurrentPercent, UpdateSourceTrigger=PropertyChanged}\" />\n\n\t\t<TextBlock Grid.Column=\"0\" Grid.Row=\"1\" Text=\"Max Cadence (%):\" VerticalAlignment=\"Center\" Margin=\"0 8 0 0\" />\n\t\t<TextBox Grid.Column=\"1\" Grid.Row=\"1\" Margin=\"10 8 0 0\" Text=\"{Binding MaxCadencePercent, UpdateSourceTrigger=PropertyChanged}\" />\n\n\t\t<TextBlock Grid.Column=\"0\" Grid.Row=\"2\" Text=\"Max Speed (%):\" VerticalAlignment=\"Center\" Margin=\"0 8 0 0\" />\n\t\t<TextBox Grid.Column=\"1\" Grid.Row=\"2\" Margin=\"10 8 0 0\" Text=\"{Binding MaxSpeedPercent, UpdateSourceTrigger=PropertyChanged}\" />\n\t\t\n\t</Grid>\n</UserControl>\n"
  },
  {
    "path": "src/tool/View/AssistLevelCruiseView.xaml.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Windows;\nusing System.Windows.Controls;\nusing System.Windows.Data;\nusing System.Windows.Documents;\nusing System.Windows.Input;\nusing System.Windows.Media;\nusing System.Windows.Media.Imaging;\nusing System.Windows.Navigation;\nusing System.Windows.Shapes;\n\nnamespace BBSFW.View\n{\n\t/// <summary>\n\t/// Interaction logic for AssistLevelCruiseView.xaml\n\t/// </summary>\n\tpublic partial class AssistLevelCruiseView : UserControl\n\t{\n\t\tpublic AssistLevelCruiseView()\n\t\t{\n\t\t\tInitializeComponent();\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/tool/View/AssistLevelPasView.xaml",
    "content": "<UserControl x:Class=\"BBSFW.View.AssistLevelPasView\"\n             xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"\n             xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\"\n             xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" \n             xmlns:d=\"http://schemas.microsoft.com/expression/blend/2008\" \n             xmlns:local=\"clr-namespace:BBSFW.View\"\n             mc:Ignorable=\"d\" \n             d:DesignHeight=\"450\" d:DesignWidth=\"800\">\n    <Grid>\n\n\t\t<Grid.ColumnDefinitions>\n\t\t\t<ColumnDefinition />\n\t\t\t<ColumnDefinition />\n\t\t</Grid.ColumnDefinitions>\n\n\t\t<Grid.RowDefinitions>\n\t\t\t<RowDefinition Height=\"Auto\" />\n\t\t\t<RowDefinition Height=\"Auto\" />\n\t\t\t<RowDefinition Height=\"Auto\" />\n\t\t\t<RowDefinition Height=\"Auto\" />\n\t\t\t<RowDefinition Height=\"Auto\" />\n\t\t\t<RowDefinition Height=\"Auto\" />\n\t\t\t<RowDefinition Height=\"Auto\" />\n\t\t\t<RowDefinition Height=\"Auto\" />\n\t\t\t<RowDefinition />\n\t\t</Grid.RowDefinitions>\n\n\t\t<TextBlock Grid.Column=\"0\" Grid.Row=\"0\" Text=\"Variant:\" VerticalAlignment=\"Center\" Margin=\"0 10 0 0\" />\n\t\t<ComboBox Grid.Column=\"1\" Grid.Row=\"0\" Margin=\"10 10 0 0\" ItemsSource=\"{Binding AssistPasVariantOptions}\" SelectedValue=\"{Binding SelectedPasVariant, UpdateSourceTrigger=PropertyChanged}\" />\n\n\n\t\t<TextBlock Grid.Column=\"0\" Grid.Row=\"1\" Text=\"Torque Amplification:\" VerticalAlignment=\"Center\" Margin=\"0 8 0 0\">\n\t\t\t<TextBlock.Style>\n\t\t\t\t<Style TargetType=\"{x:Type TextBlock}\">\n\t\t\t\t\t<Style.Triggers>\n\t\t\t\t\t\t<DataTrigger Binding=\"{Binding IsPasAssistTorqueVariant}\" Value=\"False\">\n\t\t\t\t\t\t\t<Setter Property=\"Visibility\" Value=\"Collapsed\" />\n\t\t\t\t\t\t</DataTrigger>\n\t\t\t\t\t</Style.Triggers>\n\t\t\t\t</Style>\n\t\t\t</TextBlock.Style>\n\t\t</TextBlock>\n\t\t<TextBox Grid.Column=\"1\" Grid.Row=\"1\" Margin=\"10 8 0 0\" Text=\"{Binding TorqueAmplificationFactor, UpdateSourceTrigger=LostFocus}\">\n\t\t\t<TextBox.Style>\n\t\t\t\t<Style TargetType=\"{x:Type TextBox}\">\n\t\t\t\t\t<Style.Triggers>\n\t\t\t\t\t\t<DataTrigger Binding=\"{Binding IsPasAssistTorqueVariant}\" Value=\"False\">\n\t\t\t\t\t\t\t<Setter Property=\"Visibility\" Value=\"Collapsed\" />\n\t\t\t\t\t\t</DataTrigger>\n\t\t\t\t\t</Style.Triggers>\n\t\t\t\t</Style>\n\t\t\t</TextBox.Style>\n\t\t</TextBox>\n\t\t\n\t\t<TextBlock Grid.Column=\"0\" Grid.Row=\"2\" Text=\"Max Current (%):\" VerticalAlignment=\"Center\" Margin=\"0 8 0 0\" />\n\t\t<TextBox Grid.Column=\"1\" Grid.Row=\"2\" Margin=\"10 8 0 0\" Text=\"{Binding TargetCurrentPercent, UpdateSourceTrigger=PropertyChanged}\" />\n\n\t\t<TextBlock Grid.Column=\"0\" Grid.Row=\"3\" Text=\"Max Cadence (%):\" VerticalAlignment=\"Center\" Margin=\"0 8 0 0\" />\n\t\t<TextBox Grid.Column=\"1\" Grid.Row=\"3\" Margin=\"10 8 0 0\" Text=\"{Binding MaxCadencePercent, UpdateSourceTrigger=PropertyChanged}\" />\n\n\t\t<TextBlock Grid.Column=\"0\" Grid.Row=\"4\" Text=\"Max Speed (%):\" VerticalAlignment=\"Center\" Margin=\"0 8 0 0\" />\n\t\t<TextBox Grid.Column=\"1\" Grid.Row=\"4\" Margin=\"10 8 0 0\" Text=\"{Binding MaxSpeedPercent, UpdateSourceTrigger=PropertyChanged}\" />\n\n\n\t\t<TextBlock Grid.Column=\"0\" Grid.Row=\"5\" Text=\"Enable Throttle:\" VerticalAlignment=\"Center\" Margin=\"0 16 0 0\">\n\t\t\t<TextBlock.ToolTip>\n\t\t\t\t<TextBlock Width=\"300\" TextWrapping=\"Wrap\">\n\t\t\t\t\tAllow the use of throttle while in this assist level.\n\t\t\t\t</TextBlock>\n\t\t\t</TextBlock.ToolTip>\n\t\t\t<TextBlock.Style>\n\t\t\t\t<Style TargetType=\"{x:Type TextBlock}\">\n\t\t\t\t\t<Style.Triggers>\n\t\t\t\t\t\t<DataTrigger Binding=\"{Binding IsPasAssistVariableVariant}\" Value=\"True\">\n\t\t\t\t\t\t\t<Setter Property=\"Visibility\" Value=\"Collapsed\" />\n\t\t\t\t\t\t</DataTrigger>\n\t\t\t\t\t</Style.Triggers>\n\t\t\t\t</Style>\n\t\t\t</TextBlock.Style>\n\t\t</TextBlock>\n\t\t<CheckBox Grid.Column=\"1\" Grid.Row=\"5\" IsChecked=\"{Binding IsThrottleEnabled}\" Margin=\"9 16 0 0\">\n\t\t\t<CheckBox.Style>\n\t\t\t\t<Style TargetType=\"{x:Type CheckBox}\">\n\t\t\t\t\t<Style.Triggers>\n\t\t\t\t\t\t<DataTrigger Binding=\"{Binding IsPasAssistVariableVariant}\" Value=\"True\">\n\t\t\t\t\t\t\t<Setter Property=\"Visibility\" Value=\"Collapsed\" />\n\t\t\t\t\t\t</DataTrigger>\n\t\t\t\t\t</Style.Triggers>\n\t\t\t\t</Style>\n\t\t\t</CheckBox.Style>\n\t\t</CheckBox>\n\n\t\t<TextBlock Grid.Column=\"0\" Grid.Row=\"6\" Text=\"Throttle Overrides:\" VerticalAlignment=\"Center\" Margin=\"0 8 0 0\">\n\t\t\t<TextBlock.Style>\n\t\t\t\t<Style TargetType=\"{x:Type TextBlock}\">\n\t\t\t\t\t<Style.Triggers>\n\t\t\t\t\t\t<DataTrigger Binding=\"{Binding IsPasAssistVariableVariant}\" Value=\"True\">\n\t\t\t\t\t\t\t<Setter Property=\"Visibility\" Value=\"Collapsed\" />\n\t\t\t\t\t\t</DataTrigger>\n\t\t\t\t\t</Style.Triggers>\n\t\t\t\t</Style>\n\t\t\t</TextBlock.Style>\n\t\t</TextBlock>\n\n\t\t<StackPanel Orientation=\"Horizontal\" Grid.Column=\"1\" Grid.Row=\"6\" >\n\t\t\t<CheckBox Content=\"Cadence\" IsChecked=\"{Binding IsThrottleCadenceOverrideEnabled}\" Margin=\"9 8 0 0\">\n\t\t\t\t<CheckBox.ToolTip>\n\t\t\t\t\t<TextBlock Width=\"300\" TextWrapping=\"Wrap\">\n\t\t\t\t\tOverride configured assist level cadence limit to 100% when power\n\t\t\t\t\trequested by throttle action surpasses power set by pedal assist level.\n\t\t\t\t\t</TextBlock>\n\t\t\t\t</CheckBox.ToolTip>\n\t\t\t\t<CheckBox.Style>\n\t\t\t\t\t<Style TargetType=\"{x:Type CheckBox}\">\n\t\t\t\t\t\t<Style.Triggers>\n\t\t\t\t\t\t\t<DataTrigger Binding=\"{Binding IsThrottleEnabled}\" Value=\"False\">\n\t\t\t\t\t\t\t\t<Setter Property=\"IsEnabled\" Value=\"False\" />\n\t\t\t\t\t\t\t</DataTrigger>\n\t\t\t\t\t\t\t<DataTrigger Binding=\"{Binding IsPasAssistVariableVariant}\" Value=\"True\">\n\t\t\t\t\t\t\t\t<Setter Property=\"Visibility\" Value=\"Collapsed\" />\n\t\t\t\t\t\t\t</DataTrigger>\n\t\t\t\t\t\t</Style.Triggers>\n\t\t\t\t\t</Style>\n\t\t\t\t</CheckBox.Style>\n\t\t\t</CheckBox>\n\n\t\t\t<CheckBox Content=\"Speed\" IsChecked=\"{Binding IsThrottleSpeedOverrideEnabled}\" Margin=\"16 8 0 0\">\n\t\t\t\t<CheckBox.ToolTip>\n\t\t\t\t\t<TextBlock Width=\"300\" TextWrapping=\"Wrap\">\n\t\t\t\t\tOverride configured assist level speed limit to 100% when power\n\t\t\t\t\trequested by throttle action surpasses power set by pedal assist level.\n\t\t\t\t\t</TextBlock>\n\t\t\t\t</CheckBox.ToolTip>\n\t\t\t\t<CheckBox.Style>\n\t\t\t\t\t<Style TargetType=\"{x:Type CheckBox}\">\n\t\t\t\t\t\t<Style.Triggers>\n\t\t\t\t\t\t\t<DataTrigger Binding=\"{Binding IsThrottleEnabled}\" Value=\"False\">\n\t\t\t\t\t\t\t\t<Setter Property=\"IsEnabled\" Value=\"False\" />\n\t\t\t\t\t\t\t</DataTrigger>\n\t\t\t\t\t\t\t<DataTrigger Binding=\"{Binding IsPasAssistVariableVariant}\" Value=\"True\">\n\t\t\t\t\t\t\t\t<Setter Property=\"Visibility\" Value=\"Collapsed\" />\n\t\t\t\t\t\t\t</DataTrigger>\n\t\t\t\t\t\t</Style.Triggers>\n\t\t\t\t\t</Style>\n\t\t\t\t</CheckBox.Style>\n\t\t\t</CheckBox>\n\t\t</StackPanel>\n\t\t\n\t\t\n\t\t<TextBlock Grid.Column=\"0\" Grid.Row=\"7\" Text=\"Max Throttle Current (%):\" VerticalAlignment=\"Center\" Margin=\"0 8 0 0\">\n\t\t\t<TextBlock.Style>\n\t\t\t\t<Style TargetType=\"{x:Type TextBlock}\">\n\t\t\t\t\t<Style.Triggers>\n\t\t\t\t\t\t<DataTrigger Binding=\"{Binding IsPasAssistVariableVariant}\" Value=\"True\">\n\t\t\t\t\t\t\t<Setter Property=\"Visibility\" Value=\"Collapsed\" />\n\t\t\t\t\t\t</DataTrigger>\n\t\t\t\t\t</Style.Triggers>\n\t\t\t\t</Style>\n\t\t\t</TextBlock.Style>\n\t\t</TextBlock>\n\t\t<TextBox Grid.Column=\"1\" Grid.Row=\"7\" Margin=\"10 8 0 0\" Text=\"{Binding MaxThrottlePercent, UpdateSourceTrigger=PropertyChanged}\">\n\t\t\t<TextBox.Style>\n\t\t\t\t<Style TargetType=\"{x:Type TextBox}\">\n\t\t\t\t\t<Style.Triggers>\n\t\t\t\t\t\t<DataTrigger Binding=\"{Binding IsThrottleEnabled}\" Value=\"False\">\n\t\t\t\t\t\t\t<Setter Property=\"IsEnabled\" Value=\"False\" />\n\t\t\t\t\t\t</DataTrigger>\n\t\t\t\t\t\t<DataTrigger Binding=\"{Binding IsPasAssistVariableVariant}\" Value=\"True\">\n\t\t\t\t\t\t\t<Setter Property=\"Visibility\" Value=\"Collapsed\" />\n\t\t\t\t\t\t</DataTrigger>\n\t\t\t\t\t</Style.Triggers>\n\t\t\t\t</Style>\n\t\t\t</TextBox.Style>\n\t\t</TextBox>\n\n\t</Grid>\n</UserControl>\n"
  },
  {
    "path": "src/tool/View/AssistLevelPasView.xaml.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Windows;\nusing System.Windows.Controls;\nusing System.Windows.Data;\nusing System.Windows.Documents;\nusing System.Windows.Input;\nusing System.Windows.Media;\nusing System.Windows.Media.Imaging;\nusing System.Windows.Navigation;\nusing System.Windows.Shapes;\n\nnamespace BBSFW.View\n{\n\t/// <summary>\n\t/// Interaction logic for AssistLevelPasView.xaml\n\t/// </summary>\n\tpublic partial class AssistLevelPasView : UserControl\n\t{\n\t\tpublic AssistLevelPasView()\n\t\t{\n\t\t\tInitializeComponent();\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/tool/View/AssistLevelThrottleView.xaml",
    "content": "<UserControl x:Class=\"BBSFW.View.AssistLevelThrottleView\"\n             xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"\n             xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\"\n             xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" \n             xmlns:d=\"http://schemas.microsoft.com/expression/blend/2008\" \n             xmlns:local=\"clr-namespace:BBSFW.View\"\n             mc:Ignorable=\"d\" \n             d:DesignHeight=\"450\" d:DesignWidth=\"800\">\n    <Grid>\n\n\t\t<Grid.ColumnDefinitions>\n\t\t\t<ColumnDefinition />\n\t\t\t<ColumnDefinition />\n\t\t</Grid.ColumnDefinitions>\n\t\t\n\t\t<Grid.RowDefinitions>\n\t\t\t<RowDefinition Height=\"Auto\" />\n\t\t\t<RowDefinition Height=\"Auto\" />\n\t\t\t<RowDefinition Height=\"Auto\" />\n\t\t\t<RowDefinition />\n\t\t</Grid.RowDefinitions>\n\t\t\n\t\t<TextBlock Grid.Column=\"0\" Grid.Row=\"0\" Text=\"Max Current (%):\" VerticalAlignment=\"Center\" Margin=\"0 8 0 0\" />\n\t\t<TextBox Grid.Column=\"1\" Grid.Row=\"0\" Margin=\"10 8 0 0\" Text=\"{Binding MaxThrottlePercent, UpdateSourceTrigger=PropertyChanged}\" />\n\n\t\t<TextBlock Grid.Column=\"0\" Grid.Row=\"1\" Text=\"Max Cadence (%):\" VerticalAlignment=\"Center\" Margin=\"0 8 0 0\" />\n\t\t<TextBox Grid.Column=\"1\" Grid.Row=\"1\" Margin=\"10 8 0 0\" Text=\"{Binding MaxCadencePercent, UpdateSourceTrigger=PropertyChanged}\" />\n\n\t\t<TextBlock Grid.Column=\"0\" Grid.Row=\"2\" Text=\"Max Speed (%):\" VerticalAlignment=\"Center\" Margin=\"0 8 0 0\" />\n\t\t<TextBox Grid.Column=\"1\" Grid.Row=\"2\" Margin=\"10 8 0 0\" Text=\"{Binding MaxSpeedPercent, UpdateSourceTrigger=PropertyChanged}\" />\n\n\t</Grid>\n\n</UserControl>\n"
  },
  {
    "path": "src/tool/View/AssistLevelThrottleView.xaml.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Windows;\nusing System.Windows.Controls;\nusing System.Windows.Data;\nusing System.Windows.Documents;\nusing System.Windows.Input;\nusing System.Windows.Media;\nusing System.Windows.Media.Imaging;\nusing System.Windows.Navigation;\nusing System.Windows.Shapes;\n\nnamespace BBSFW.View\n{\n\t/// <summary>\n\t/// Interaction logic for AssistLevelThrottleView.xaml\n\t/// </summary>\n\tpublic partial class AssistLevelThrottleView : UserControl\n\t{\n\t\tpublic AssistLevelThrottleView()\n\t\t{\n\t\t\tInitializeComponent();\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/tool/View/AssistLevelsView.xaml",
    "content": "<UserControl x:Class=\"BBSFW.View.AssistLevelsView\"\n\txmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"\n\txmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\"\n\txmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" \n\txmlns:d=\"http://schemas.microsoft.com/expression/blend/2008\"\n\txmlns:vm=\"clr-namespace:BBSFW.ViewModel\"\n\txmlns:local=\"clr-namespace:BBSFW.View\"\n\tmc:Ignorable=\"d\" \n\td:DesignHeight=\"450\" d:DesignWidth=\"800\">\n\n\t<Grid>\n\t\t<Grid.ColumnDefinitions>\n\t\t\t<ColumnDefinition />\n\t\t\t<ColumnDefinition Width=\"20\" />\n\t\t\t<ColumnDefinition />\n\t\t</Grid.ColumnDefinitions>\n\n\t\t<Grid.RowDefinitions>\n\t\t\t<RowDefinition />\n\t\t</Grid.RowDefinitions>\n\n\t\n\t\t<Grid Grid.Column=\"0\" Grid.Row=\"0\">\n\n\t\t\t<Grid.ColumnDefinitions>\n\t\t\t\t<ColumnDefinition Width=\"Auto\" />\n\t\t\t\t<ColumnDefinition />\n\t\t\t</Grid.ColumnDefinitions>\n\n\t\t\t\n\t\t\t<Grid.RowDefinitions>\n\t\t\t\t<RowDefinition Height=\"Auto\" />\n\t\t\t\t<RowDefinition />\n\t\t\t</Grid.RowDefinitions>\n\n\n\t\t\t<TextBlock Grid.Column=\"0\" Grid.Row=\"0\" Text=\"Operation Mode Page:\" VerticalAlignment=\"Center\" />\n\t\t\t<ComboBox Grid.Column=\"1\" Grid.Row=\"0\" Margin=\"10 0 0 0\" ItemsSource=\"{Binding OperationModes}\" SelectedValue=\"{Binding SelectedOperationModePage}\" />\n\n\t\t\t<ListView Grid.Column=\"0\" Grid.Row=\"1\" Grid.ColumnSpan=\"2\"\n\t\t\t\t\t  ItemsSource=\"{Binding ConfigVm.StandardAssistLevels}\"\n\t\t\t\t\t  SelectedItem=\"{Binding SelectedAssistLevel}\" Margin=\"0 4 0 4\">\n\t\t\t\t<ListView.Style>\n\t\t\t\t\t<Style TargetType=\"{x:Type ListView}\">\n\t\t\t\t\t\t<Setter Property=\"Visibility\" Value=\"Collapsed\" />\n\t\t\t\t\t\t<Style.Triggers>\n\t\t\t\t\t\t\t<DataTrigger Binding=\"{Binding SelectedOperationModePage.Value}\" Value=\"Standard\">\n\t\t\t\t\t\t\t\t<Setter Property=\"Visibility\" Value=\"Visible\" />\n\t\t\t\t\t\t\t</DataTrigger>\n\t\t\t\t\t\t</Style.Triggers>\n\t\t\t\t\t</Style>\n\t\t\t\t</ListView.Style>\n\t\t\t\t\n\t\t\t\t<ListView.ItemTemplate>\n\t\t\t\t\t<DataTemplate DataType=\"{x:Type vm:AssistLevelViewModel}\">\n\t\t\t\t\t\t<StackPanel Orientation=\"Vertical\">\n\t\t\t\t\t\t\t<TextBlock FontWeight=\"Bold\">\n\t\t\t\t\t\t\t<Run Text=\"Level \" />\n\t\t\t\t\t\t\t<Run Text=\"{Binding Id, Mode=OneWay}\" />\n\t\t\t\t\t\t\t</TextBlock>\n\n\t\t\t\t\t\t\t<TextBlock>\n\t\t\t\t\t\t\t<Run Text=\"{Binding SelectedType, Mode=OneWay}\" />\n\t\t\t\t\t\t\t</TextBlock>\n\t\t\t\t\t\t</StackPanel>\n\t\t\t\t\t</DataTemplate>\n\t\t\t\t</ListView.ItemTemplate>\n\t\t\t</ListView>\n\n\t\t\t<ListView Grid.Column=\"0\" Grid.Row=\"1\" Grid.ColumnSpan=\"2\"\n\t\t\t\t\t  ItemsSource=\"{Binding ConfigVm.SportAssistLevels}\"\n\t\t\t\t\t  SelectedItem=\"{Binding SelectedAssistLevel}\" Margin=\"0 4 0 4\">\n\t\t\t\t<ListView.Style>\n\t\t\t\t\t<Style TargetType=\"{x:Type ListView}\">\n\t\t\t\t\t\t<Setter Property=\"Visibility\" Value=\"Collapsed\" />\n\t\t\t\t\t\t<Style.Triggers>\n\t\t\t\t\t\t\t<DataTrigger Binding=\"{Binding SelectedOperationModePage.Value}\" Value=\"Sport\">\n\t\t\t\t\t\t\t\t<Setter Property=\"Visibility\" Value=\"Visible\" />\n\t\t\t\t\t\t\t</DataTrigger>\n\t\t\t\t\t\t</Style.Triggers>\n\t\t\t\t\t</Style>\n\t\t\t\t</ListView.Style>\n\n\t\t\t\t<ListView.ItemTemplate>\n\t\t\t\t\t<DataTemplate DataType=\"{x:Type vm:AssistLevelViewModel}\">\n\t\t\t\t\t\t<StackPanel Orientation=\"Vertical\">\n\t\t\t\t\t\t\t<TextBlock FontWeight=\"Bold\">\n\t\t\t\t\t\t\t<Run Text=\"Level \" />\n\t\t\t\t\t\t\t<Run Text=\"{Binding Id, Mode=OneWay}\" />\n\t\t\t\t\t\t\t</TextBlock>\n\n\t\t\t\t\t\t\t<TextBlock>\n\t\t\t\t\t\t\t<Run Text=\"{Binding SelectedType, Mode=OneWay}\" />\n\t\t\t\t\t\t\t</TextBlock>\n\t\t\t\t\t\t</StackPanel>\n\t\t\t\t\t</DataTemplate>\n\t\t\t\t</ListView.ItemTemplate>\n\t\t\t</ListView>\n\t\t</Grid>\n\t\t\n\t\t<Grid Grid.Column=\"2\" Grid.Row=\"0\">\n\n\n\t\t\t<Grid.RowDefinitions>\n\t\t\t\t<RowDefinition />\n\t\t\t\t<RowDefinition Height=\"Auto\" />\n\t\t\t\t<RowDefinition Height=\"Auto\" />\n\t\t\t</Grid.RowDefinitions>\n\n\t\t\t<Grid>\n\t\t\t\t<Grid.ColumnDefinitions>\n\t\t\t\t\t<ColumnDefinition />\n\t\t\t\t\t<ColumnDefinition />\n\t\t\t\t</Grid.ColumnDefinitions>\n\n\t\t\t\t<Grid.RowDefinitions>\n\t\t\t\t\t<RowDefinition Height=\"Auto\" />\n\t\t\t\t\t<RowDefinition Height=\"Auto\" />\n\t\t\t\t\t<RowDefinition Height=\"Auto\" />\n\t\t\t\t</Grid.RowDefinitions>\n\n\n\t\t\t\t<TextBlock Grid.Row=\"0\" FontSize=\"18\" FontWeight=\"Bold\">\n\t\t\t\t\t<Run Text=\"Level \" />\n\t\t\t\t\t<Run Text=\"{Binding SelectedAssistLevel.Id, Mode=OneWay}\" />\n\t\t\t\t</TextBlock>\n\n\t\t\t\t<TextBlock Grid.Column=\"0\" Grid.Row=\"1\" Text=\"Type:\" VerticalAlignment=\"Center\" Margin=\"0 10 0 0\" />\n\t\t\t\t<ComboBox Grid.Column=\"1\" Grid.Row=\"1\" Margin=\"10 10 0 0\" ItemsSource=\"{Binding SelectedAssistLevel.AssistBaseTypeOptions}\" SelectedValue=\"{Binding SelectedAssistLevel.SelectedType, UpdateSourceTrigger=PropertyChanged}\" />\n\n\t\t\t\t<ContentControl Grid.Column=\"0\" Grid.Row=\"2\" Grid.ColumnSpan=\"2\" Content=\"{Binding SelectedAssistLevel}\">\n\t\t\t\t\t<ContentControl.Resources>\n\t\t\t\t\t\t<DataTemplate x:Key=\"EmptyTemplate\" DataType=\"{x:Type vm:AssistLevelViewModel}\">\n\t\t\t\t\t\t\t<Grid />\n\t\t\t\t\t\t</DataTemplate>\n\t\t\t\t\t\t\n\t\t\t\t\t\t<DataTemplate x:Key=\"PasTemplate\" DataType=\"{x:Type vm:AssistLevelViewModel}\">\n\t\t\t\t\t\t\t<local:AssistLevelPasView />\n\t\t\t\t\t\t</DataTemplate>\n\t\t\t\t\t\t<DataTemplate x:Key=\"ThrottleTemplate\" DataType=\"{x:Type vm:AssistLevelViewModel}\">\n\t\t\t\t\t\t\t<local:AssistLevelThrottleView />\n\t\t\t\t\t\t</DataTemplate>\n\t\t\t\t\t\t<DataTemplate x:Key=\"CruiseTemplate\" DataType=\"{x:Type vm:AssistLevelViewModel}\">\n\t\t\t\t\t\t\t<local:AssistLevelCruiseView />\n\t\t\t\t\t\t</DataTemplate>\n\t\t\t\t\t</ContentControl.Resources>\n\n\t\t\t\t\t<ContentControl.Style>\n\t\t\t\t\t\t<Style TargetType=\"ContentControl\">\n\t\t\t\t\t\t\t<Setter Property=\"ContentTemplate\" Value=\"{StaticResource EmptyTemplate}\" />\n\t\t\t\t\t\t\t<Style.Triggers>\n\t\t\t\t\t\t\t\t<DataTrigger Binding=\"{Binding SelectedAssistLevel.SelectedType.Value}\" Value=\"Pas\">\n\t\t\t\t\t\t\t\t\t<Setter Property=\"ContentTemplate\" Value=\"{StaticResource PasTemplate}\" />\n\t\t\t\t\t\t\t\t</DataTrigger>\n\t\t\t\t\t\t\t\t<DataTrigger Binding=\"{Binding SelectedAssistLevel.SelectedType.Value}\" Value=\"Throttle\">\n\t\t\t\t\t\t\t\t\t<Setter Property=\"ContentTemplate\" Value=\"{StaticResource ThrottleTemplate}\" />\n\t\t\t\t\t\t\t\t</DataTrigger>\n\t\t\t\t\t\t\t\t<DataTrigger Binding=\"{Binding SelectedAssistLevel.SelectedType.Value}\" Value=\"Cruise\">\n\t\t\t\t\t\t\t\t\t<Setter Property=\"ContentTemplate\" Value=\"{StaticResource CruiseTemplate}\" />\n\t\t\t\t\t\t\t\t</DataTrigger>\n\t\t\t\t\t\t\t</Style.Triggers>\n\t\t\t\t\t\t</Style>\n\t\t\t\t\t</ContentControl.Style>\n\t\t\t\t</ContentControl>\n\n\t\t\t</Grid>\n\n\t\t\t<StackPanel Grid.Row=\"1\" Background=\"DarkGray\" Height=\"4\" />\n\n\t\t\t<Grid Grid.Row=\"2\">\n\t\t\t\t<Grid.ColumnDefinitions>\n\t\t\t\t\t<ColumnDefinition Width=\"Auto\" />\n\t\t\t\t\t<ColumnDefinition />\n\t\t\t\t</Grid.ColumnDefinitions>\n\n\t\t\t\t<Grid.RowDefinitions>\n\t\t\t\t\t<RowDefinition Height=\"Auto\" />\n\t\t\t\t\t<RowDefinition Height=\"Auto\" />\n\t\t\t\t</Grid.RowDefinitions>\n\n\t\t\t\t<TextBlock Grid.Column=\"0\" Grid.Row=\"0\" Text=\"Operation Mode Toggle:\" VerticalAlignment=\"Center\" Margin=\"0 4 0 0\" />\n\t\t\t\t<ComboBox Grid.Column=\"1\" Grid.Row=\"0\" Margin=\"10 4 0 0\" ItemsSource=\"{Binding ConfigVm.AssistModeSelectOptions}\" SelectedValue=\"{Binding ConfigVm.AssistModeSelection}\" />\n\n\t\t\t\t<TextBlock Grid.Column=\"0\" Grid.Row=\"1\" Text=\"Startup Assist Level:\" VerticalAlignment=\"Center\"  Margin=\"0 8 0 0\" />\n\t\t\t\t<ComboBox Grid.Column=\"1\" Grid.Row=\"1\" Margin=\"10 8 0 0\" ItemsSource=\"{Binding ConfigVm.StartupAssistLevelOptions}\" SelectedValue=\"{Binding ConfigVm.StartupAssistLevel}\"  />\n\n\t\t\t</Grid>\n\t\t</Grid>\n\n\t</Grid>\n\n\n</UserControl>\n"
  },
  {
    "path": "src/tool/View/AssistLevelsView.xaml.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Windows;\nusing System.Windows.Controls;\nusing System.Windows.Data;\nusing System.Windows.Documents;\nusing System.Windows.Input;\nusing System.Windows.Media;\nusing System.Windows.Media.Imaging;\nusing System.Windows.Navigation;\nusing System.Windows.Shapes;\n\nnamespace BBSFW.View\n{\n\t/// <summary>\n\t/// Interaction logic for AssistLevelsView.xaml\n\t/// </summary>\n\tpublic partial class AssistLevelsView : UserControl\n\t{\n\t\tpublic AssistLevelsView()\n\t\t{\n\t\t\tInitializeComponent();\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/tool/View/CalibrationView.xaml",
    "content": "<UserControl x:Class=\"BBSFW.View.CalibrationView\"\n             xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"\n             xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\"\n             xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" \n             xmlns:d=\"http://schemas.microsoft.com/expression/blend/2008\" \n             xmlns:local=\"clr-namespace:BBSFW.View\"\n             mc:Ignorable=\"d\" \n             d:DesignHeight=\"450\" d:DesignWidth=\"800\">\n\t<Grid>\n\t\t<Grid.ColumnDefinitions>\n\t\t\t<ColumnDefinition Width=\"1*\" />\n\t\t\t<ColumnDefinition Width=\"10\" />\n\t\t\t<ColumnDefinition Width=\"Auto\" />\n\t\t\t<ColumnDefinition Width=\"10\" />\n\t\t\t<ColumnDefinition Width=\"Auto\" />\n\t\t\t<ColumnDefinition Width=\"2*\"/>\n\t\t</Grid.ColumnDefinitions>\n\n\t\t<Grid.RowDefinitions>\n\t\t\t<RowDefinition Height=\"Auto\" />\n\t\t\t<RowDefinition Height=\"Auto\" />\n\t\t</Grid.RowDefinitions>\n\n\t\t<TextBlock Grid.Column=\"0\" Grid.Row=\"0\" Margin=\"0 10 0 0\" Text=\"Measured Battery Voltage (V):\" FontWeight=\"Bold\" />\n\t\t<TextBox Grid.Column=\"2\" Grid.Row=\"0\" Margin=\"0 10 0 0\" Width=\"60\" HorizontalAlignment=\"Right\" Text=\"{Binding MeasuredBatteryVolts, UpdateSourceTrigger=LostFocus}\" />\n\t\t<StackPanel Orientation=\"Horizontal\" Grid.Column=\"4\" Grid.Row=\"0\" Margin=\"0 10 0 0\">\n\t\t\t<Button Width=\"60\" Content=\"Save\" Command=\"{Binding SaveVoltageCommand}\" />\n\t\t\t<Button Width=\"60\" Content=\"Reset\" Margin=\"10 0 0 0\" Command=\"{Binding ResetVoltageCommand}\" />\n\t\t</StackPanel>\n\n\t\t<TextBlock Grid.Row=\"1\" Grid.ColumnSpan=\"5\" Margin=\"0 40 0 0\" TextWrapping=\"Wrap\">\n\t\t\tCalibrate you controller battery voltage reading in order to have an accurate low voltage limit.\n\t\t\tThe voltage measurement circuitry on the Bafang controllers is of low quality and a measurement error\n\t\t\tof up to 2V can be present if not calibrated.\n\t\t\t<LineBreak />\n\t\t\t<LineBreak />\n\t\t\tMeasure you battery voltage using a multi meter or use the reading from you display or bms and enter the value\n\t\t\tin \"Measured Battery Voltage (V)\" above, then press save. Check the event log to confirm that the battery voltage \n\t\t\treading is now accurate.\n\t\t</TextBlock>\n\t\t\n\t</Grid>\n</UserControl>\n"
  },
  {
    "path": "src/tool/View/CalibrationView.xaml.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Windows;\nusing System.Windows.Controls;\nusing System.Windows.Data;\nusing System.Windows.Documents;\nusing System.Windows.Input;\nusing System.Windows.Media;\nusing System.Windows.Media.Imaging;\nusing System.Windows.Navigation;\nusing System.Windows.Shapes;\n\nnamespace BBSFW.View\n{\n\t/// <summary>\n\t/// Interaction logic for CalibrationView.xaml\n\t/// </summary>\n\tpublic partial class CalibrationView : UserControl\n\t{\n\t\tpublic CalibrationView()\n\t\t{\n\t\t\tInitializeComponent();\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/tool/View/ConnectionView.xaml",
    "content": "<UserControl x:Class=\"BBSFW.View.ConnectionView\"\n             xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"\n             xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\"\n             xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" \n             xmlns:d=\"http://schemas.microsoft.com/expression/blend/2008\" \n             xmlns:local=\"clr-namespace:BBSFW.View\"\n             mc:Ignorable=\"d\" \n             d:DesignHeight=\"450\" d:DesignWidth=\"800\">\n\n\t<UserControl.Resources>\n\t\t<BooleanToVisibilityConverter x:Key=\"BoolToVis\" />\n\t</UserControl.Resources>\n\t\n    <Grid>\n\n\t\t<Grid.ColumnDefinitions>\n\t\t\t<ColumnDefinition />\n\t\t\t<ColumnDefinition Width=\"20\" />\n\t\t\t<ColumnDefinition />\n\t\t</Grid.ColumnDefinitions>\n\n\t\t<Grid.RowDefinitions>\n\t\t\t<RowDefinition Height=\"Auto\" />\n\t\t\t<RowDefinition />\n\t\t</Grid.RowDefinitions>\n\n\t\t<TextBlock Text=\"Com Ports\" Grid.Column=\"0\" Grid.Row=\"0\" FontWeight=\"Bold\" VerticalAlignment=\"Center\"/>\n\n\t\t<Button Grid.Column=\"0\" Grid.Row=\"0\" Content=\"Refresh\" Height=\"22\" Width=\"80\" HorizontalAlignment=\"Right\" Margin=\"0 0 0 2\" Command=\"{Binding RefreshCommand}\" />\n\n\t\t<ListView Grid.Column=\"0\" Grid.Row=\"1\" x:Name=\"PortList\" ItemsSource=\"{Binding ComPorts}\" SelectedItem=\"{Binding SelectedComPort}\">\n\t\t\t<ListView.ItemTemplate>\n\t\t\t\t<DataTemplate>\n\t\t\t\t\t<StackPanel Orientation=\"Vertical\">\n\t\t\t\t\t\t<TextBlock Text=\"{Binding Name}\" FontWeight=\"Bold\" />\n\t\t\t\t\t\t<TextBlock Text=\"{Binding Description}\" />\n\t\t\t\t\t</StackPanel>\n\t\t\t\t</DataTemplate>\n\t\t\t</ListView.ItemTemplate>\n\t\t</ListView>\n\n\t\t<StackPanel Grid.Column=\"2\" Grid.Row=\"0\" Grid.RowSpan=\"2\" Height=\"80\" Orientation=\"Vertical\" VerticalAlignment=\"Center\" HorizontalAlignment=\"Center\" Visibility=\"{Binding IsDisconnected, Converter={StaticResource BoolToVis}}\">\n\n\t\t\t<Button Content=\"Connect\" Width=\"120\" Command=\"{Binding ConnectCommand}\">\n\t\t\t\t<Button.Style>\n\t\t\t\t\t<Style TargetType=\"{x:Type Button}\">\n\t\t\t\t\t\t<Setter Property=\"IsEnabled\" Value=\"True\" />\n\t\t\t\t\t\t<Setter Property=\"Visibility\" Value=\"Visible\" />\n\t\t\t\t\t\t<Style.Triggers>\n\t\t\t\t\t\t\t<DataTrigger Binding=\"{Binding SelectedComPort}\" Value=\"{x:Null}\">\n\t\t\t\t\t\t\t\t<Setter Property=\"IsEnabled\" Value=\"False\" />\n\t\t\t\t\t\t\t</DataTrigger>\n\t\t\t\t\t\t\t<DataTrigger Binding=\"{Binding IsConnecting}\" Value=\"True\">\n\t\t\t\t\t\t\t\t<Setter Property=\"Visibility\" Value=\"Collapsed\" />\n\t\t\t\t\t\t\t</DataTrigger>\n\t\t\t\t\t\t</Style.Triggers>\n\t\t\t\t\t</Style>\n\t\t\t\t</Button.Style>\n\t\t\t</Button>\n\t\t\t<Button Content=\"Cancel\" Width=\"120\" Command=\"{Binding DisconnectCommand}\" Visibility=\"{Binding IsConnecting, Converter={StaticResource BoolToVis}}\" />\n\t\t\t<ProgressBar IsIndeterminate=\"True\" Width=\"120\" Margin=\"0 10 0 0\" Height=\"16\" Visibility=\"{Binding IsConnecting, Converter={StaticResource BoolToVis}}\" />\n\t\t</StackPanel>\n\n\t\t<StackPanel Grid.Column=\"2\" Grid.Row=\"0\" Grid.RowSpan=\"2\" Height=\"80\" Orientation=\"Vertical\" VerticalAlignment=\"Center\" HorizontalAlignment=\"Center\" Visibility=\"{Binding IsConnected, Converter={StaticResource BoolToVis}}\">\n\t\t\t<Button Content=\"Disconnect\" Width=\"120\" Command=\"{Binding DisconnectCommand}\" />\n\n\t\t\t<Grid Width=\"120\" Margin=\"0 10 0 0\">\n\t\t\t\t<Grid.ColumnDefinitions>\n\t\t\t\t\t<ColumnDefinition />\n\t\t\t\t\t<ColumnDefinition Width=\"Auto\" />\n\t\t\t\t</Grid.ColumnDefinitions>\n\n\t\t\t\t<Grid.RowDefinitions>\n\t\t\t\t\t<RowDefinition Height=\"Auto\" />\n\t\t\t\t\t<RowDefinition Height=\"Auto\" />\n\t\t\t\t\t<RowDefinition Height=\"Auto\" />\n\t\t\t\t</Grid.RowDefinitions>\n\n\t\t\t\t<TextBlock Text=\"Connected:\" Grid.Column=\"0\" Grid.Row=\"0\" FontWeight=\"Bold\" />\n\t\t\t\t<TextBlock Text=\"Yes\" Grid.Column=\"1\" Grid.Row=\"0\" HorizontalAlignment=\"Right\" />\n\n\t\t\t\t<TextBlock Text=\"Model:\" Grid.Column=\"0\" Grid.Row=\"1\" FontWeight=\"Bold\" />\n\t\t\t\t<TextBlock Text=\"{Binding Controller}\" Grid.Column=\"1\" Grid.Row=\"1\" HorizontalAlignment=\"Right\" />\n\n\t\t\t\t<TextBlock Text=\"Version:\" Grid.Column=\"0\" Grid.Row=\"2\" FontWeight=\"Bold\" />\n\t\t\t\t<TextBlock Text=\"{Binding FirmwareVersion}\" Grid.Column=\"1\" Grid.Row=\"2\" HorizontalAlignment=\"Right\" />\n\t\t\t</Grid>\n\t\t\t\n\t\t</StackPanel>\n\n\t</Grid>\n</UserControl>\n"
  },
  {
    "path": "src/tool/View/ConnectionView.xaml.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Windows;\nusing System.Windows.Controls;\nusing System.Windows.Data;\nusing System.Windows.Documents;\nusing System.Windows.Input;\nusing System.Windows.Media;\nusing System.Windows.Media.Imaging;\nusing System.Windows.Navigation;\nusing System.Windows.Shapes;\n\nnamespace BBSFW.View\n{\n\t/// <summary>\n\t/// Interaction logic for ConnectionView.xaml\n\t/// </summary>\n\tpublic partial class ConnectionView : UserControl\n\t{\n\t\tpublic ConnectionView()\n\t\t{\n\t\t\tInitializeComponent();\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/tool/View/Converter/TimestampConverter.cs",
    "content": "using System;\nusing System.Globalization;\nusing System.Windows.Data;\n\nnamespace BBSFW.View.Converter\n{\n\tpublic class TimestampConverter : IValueConverter\n\t{\n\t\tpublic object Convert(object value, Type targetType, object parameter, CultureInfo culture)\n\t\t{\n\t\t\tif (value is DateTime)\n\t\t\t{\n\t\t\t\tvar dt = (DateTime)value;\n\n\t\t\t\treturn dt.ToString(\"yyyy-MM-dd HH:mm:ss.fff\");\n\t\t\t}\n\n\t\t\treturn null;\n\t\t}\n\n\t\tpublic object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)\n\t\t{\n\t\t\tthrow new NotImplementedException();\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/tool/View/EventLogView.xaml",
    "content": "<UserControl x:Class=\"BBSFW.View.EventLogView\"\n\txmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"\n\txmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\"\n\txmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" \n\txmlns:d=\"http://schemas.microsoft.com/expression/blend/2008\" \n\txmlns:local=\"clr-namespace:BBSFW.View\"\n\txmlns:ext=\"clr-namespace:BBSFW.View.Extension\"\n\txmlns:conv=\"clr-namespace:BBSFW.View.Converter\"\n\tmc:Ignorable=\"d\" \n\td:DesignHeight=\"450\" d:DesignWidth=\"800\">\n\n\t<UserControl.Resources>\n\t\t<conv:TimestampConverter x:Key=\"TimestampConverter\" />\n\t</UserControl.Resources>\n\n\t<Grid>\n\n\t\t<Grid.RowDefinitions>\n\t\t\t<RowDefinition Height=\"Auto\" />\n\t\t\t<RowDefinition />\n\t\t</Grid.RowDefinitions>\n\n\t\t<Grid Grid.Row=\"0\" Grid.Column=\"0\">\n\n\t\t\t<Grid.ColumnDefinitions>\n\t\t\t\t<ColumnDefinition Width=\"Auto\" />\n\t\t\t\t<ColumnDefinition Width=\"Auto\" />\n\t\t\t\t<ColumnDefinition Width=\"Auto\" />\n\t\t\t\t<ColumnDefinition Width=\"Auto\" />\n\t\t\t\t<ColumnDefinition />\n\t\t\t</Grid.ColumnDefinitions>\n\n\t\t\t<Button\n\t\t\t\t\tGrid.Column=\"0\"\n\t\t\t\t\tGrid.Row=\"0\"\n\t\t\t\t\tWidth=\"80\"\n\t\t\t\t\tContent=\"Clear\"\n\t\t\t\t\tCommand=\"{Binding ClearCommand}\" />\n\n\t\t\t<ComboBox \n\t\t\t\t\tGrid.Column=\"1\" \n\t\t\t\t\tGrid.Row=\"0\" \n\t\t\t\t\tWidth=\"100\"\n\t\t\t\t\tMargin=\"10 0 0 0\"\n\t\t\t\t\tItemsSource=\"{Binding AvailableLogLevels}\" \n\t\t\t\t\tSelectedItem=\"{Binding SelectedLogLevel}\"\n\t\t\t\t\tVerticalAlignment=\"Center\" />\n\n\t\t\t<TextBox\n\t\t\t\t\tGrid.Column=\"2\"\n\t\t\t\t\tGrid.Row=\"0\"\n\t\t\t\t\tWidth=\"200\"\n\t\t\t\t\tHeight=\"22\"\n\t\t\t\t\tMargin=\"10 0 0 0\"\n\t\t\t\t\tText=\"{Binding FilterText, UpdateSourceTrigger=PropertyChanged}\"\n\t\t\t\t\tVerticalAlignment=\"Center\"\n\t\t\t\t\tVerticalContentAlignment=\"Center\" />\n\n\t\t\t<CheckBox\n\t\t\t\t\tGrid.Column=\"3\"\n\t\t\t\t\tGrid.Row=\"0\"\n\t\t\t\t\tContent=\"Tail Log\"\n\t\t\t\t\tMargin=\"10 0 0 0\"\n\t\t\t\t\tVerticalAlignment=\"Center\"\n\t\t\t\t\tIsChecked=\"{Binding TailLog}\" />\n\n\t\t\t<TextBlock \n\t\t\t\t\tGrid.Column=\"4\" \n\t\t\t\t\tGrid.Row=\"0\" \n\t\t\t\t\tMargin=\"0 0 4 0\"\n\t\t\t\t\tFontWeight=\"Bold\" \n\t\t\t\t\tVerticalAlignment=\"Center\" \n\t\t\t\t\tHorizontalAlignment=\"Right\" \n\t\t\t\t\tText=\"{Binding ElementName=LogEventGrid, Path=Items.Count}\" />\n\n\t\t</Grid>\n\n\n\t\t<DataGrid x:Name=\"LogEventGrid\" Grid.Row=\"1\" Grid.Column=\"0\" ItemsSource=\"{Binding FilteredLogEvents}\" Margin=\"0 2 0 0\" \n\t\t\tBackground=\"White\"\n\t\t\tHeadersVisibility=\"Column\" AutoGenerateColumns=\"False\" CanUserAddRows=\"False\" CanUserDeleteRows=\"True\"\n\t\t\tSelectionMode=\"Single\" SelectionUnit=\"FullRow\"\n\t\t\tVerticalScrollBarVisibility=\"Visible\"\n\t\t\text:DataGridExtension.AutoScrollToEnd=\"{Binding TailLog}\">\n\n\t\t\t<DataGrid.Resources>\n\t\t\t\t<SolidColorBrush x:Key=\"{x:Static SystemColors.HighlightBrushKey}\" Color=\"#e9e9e9e9\"/>\n\t\t\t\t<SolidColorBrush x:Key=\"{x:Static SystemColors.HighlightTextBrushKey}\" Color=\"#000000\"/>\n\t\t\t</DataGrid.Resources>\n\n\t\t\t<DataGrid.RowStyle>\n\t\t\t\t<Style TargetType=\"{x:Type DataGridRow}\">\n\t\t\t\t\t<Style.Triggers>\n\t\t\t\t\t\t<DataTrigger Binding=\"{Binding Level}\" Value=\"Info\">\n\t\t\t\t\t\t\t<Setter Property=\"Background\" Value=\"#ffffff\" />\n\t\t\t\t\t\t</DataTrigger>\n\t\t\t\t\t\t<DataTrigger Binding=\"{Binding Level}\" Value=\"Warning\">\n\t\t\t\t\t\t\t<Setter Property=\"Background\" Value=\"#ffe9b3\" />\n\t\t\t\t\t\t</DataTrigger>\n\t\t\t\t\t\t<DataTrigger Binding=\"{Binding Level}\" Value=\"Error\">\n\t\t\t\t\t\t\t<Setter Property=\"Background\" Value=\"#ffdede\" />\n\t\t\t\t\t\t</DataTrigger>\n\t\t\t\t\t</Style.Triggers>\n\t\t\t\t</Style>\n\t\t\t</DataGrid.RowStyle>\n\t\t\t<DataGrid.CellStyle>\n\t\t\t\t<Style TargetType=\"{x:Type DataGridCell}\">\n\t\t\t\t\t<Setter Property=\"Padding\" Value=\"5 2 5 2\"/>\n\t\t\t\t\t<Setter Property=\"FocusVisualStyle\" Value=\"{x:Null}\" />\n\t\t\t\t\t<Setter Property=\"BorderThickness\" Value=\"0\" />\n\t\t\t\t\t<Setter Property=\"Template\">\n\t\t\t\t\t\t<Setter.Value>\n\t\t\t\t\t\t\t<ControlTemplate TargetType=\"{x:Type DataGridCell}\">\n\t\t\t\t\t\t\t\t<Border Padding=\"{TemplateBinding Padding}\" BorderBrush=\"{TemplateBinding BorderBrush}\" BorderThickness=\"{TemplateBinding BorderThickness}\" Background=\"{TemplateBinding Background}\" SnapsToDevicePixels=\"True\">\n\t\t\t\t\t\t\t\t\t<ContentPresenter SnapsToDevicePixels=\"{TemplateBinding SnapsToDevicePixels}\"/>\n\t\t\t\t\t\t\t\t</Border>\n\t\t\t\t\t\t\t</ControlTemplate>\n\t\t\t\t\t\t</Setter.Value>\n\t\t\t\t\t</Setter>\n\t\t\t\t</Style>\n\t\t\t</DataGrid.CellStyle>\n\t\t\t<DataGrid.Columns>\n\t\t\t\t<DataGridTextColumn Header=\"Timestamp\" Binding=\"{Binding Timestamp, Converter={StaticResource TimestampConverter}}\" IsReadOnly=\"True\" Width=\"Auto\" />\n\t\t\t\t<DataGridTextColumn Header=\"Level\" Binding=\"{Binding Level}\" IsReadOnly=\"True\" Width=\"Auto\" />\n\t\t\t\t<DataGridTextColumn Header=\"Message\" IsReadOnly=\"True\" Width=\"*\" Binding=\"{Binding Message}\" />\n\t\t\t</DataGrid.Columns>\n\t\t</DataGrid>\n\n\t</Grid>\n</UserControl>\n"
  },
  {
    "path": "src/tool/View/EventLogView.xaml.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Windows;\nusing System.Windows.Controls;\nusing System.Windows.Data;\nusing System.Windows.Documents;\nusing System.Windows.Input;\nusing System.Windows.Media;\nusing System.Windows.Media.Imaging;\nusing System.Windows.Navigation;\nusing System.Windows.Shapes;\n\nnamespace BBSFW.View\n{\n\t/// <summary>\n\t/// Interaction logic for EventLogView.xaml\n\t/// </summary>\n\tpublic partial class EventLogView : UserControl\n\t{\n\t\tpublic EventLogView()\n\t\t{\n\t\t\tInitializeComponent();\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/tool/View/Extension/DataGridExtension.cs",
    "content": "using System;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\nusing System.Windows;\nusing System.Windows.Controls;\n\nnamespace BBSFW.View.Extension\n{\n\tpublic static class DataGridExtension\n\t{\n\n\t\tpublic static readonly DependencyProperty AutoScrollToEndProperty = DependencyProperty.RegisterAttached(\n\t\t\t\"AutoScrollToEnd\", typeof(bool), typeof(DataGridExtension), new PropertyMetadata(default(bool), AutoScrollToEndChangedCallback));\n\n\t\tprivate static readonly Dictionary<DataGrid, NotifyCollectionChangedEventHandler> handlersDict = new Dictionary<DataGrid, NotifyCollectionChangedEventHandler>();\n\n\t\tprivate static void AutoScrollToEndChangedCallback(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs args)\n\t\t{\n\t\t\tvar dataGrid = dependencyObject as DataGrid;\n\t\t\tif (dataGrid == null)\n\t\t\t{\n\t\t\t\tthrow new InvalidOperationException(\"Dependency object is not DataGrid.\");\n\t\t\t}\n\n\t\t\tif ((bool)args.NewValue)\n\t\t\t{\n\t\t\t\tSubscribe(dataGrid);\n\t\t\t\tdataGrid.Unloaded += DataGridOnUnloaded;\n\t\t\t\tdataGrid.Loaded += DataGridOnLoaded;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tUnsubscribe(dataGrid);\n\t\t\t\tdataGrid.Unloaded -= DataGridOnUnloaded;\n\t\t\t\tdataGrid.Loaded -= DataGridOnLoaded;\n\t\t\t}\n\t\t}\n\n\t\tprivate static void Subscribe(DataGrid dataGrid)\n\t\t{\n\t\t\tvar handler = new NotifyCollectionChangedEventHandler((sender, eventArgs) => ScrollToEnd(dataGrid));\n\t\t\thandlersDict.Add(dataGrid, handler);\n\t\t\t((INotifyCollectionChanged)dataGrid.Items).CollectionChanged += handler;\n\t\t\tScrollToEnd(dataGrid);\n\t\t}\n\n\t\tprivate static void Unsubscribe(DataGrid dataGrid)\n\t\t{\n\t\t\tNotifyCollectionChangedEventHandler handler;\n\t\t\thandlersDict.TryGetValue(dataGrid, out handler);\n\t\t\tif (handler == null)\n\t\t\t{\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t((INotifyCollectionChanged)dataGrid.Items).CollectionChanged -= handler;\n\t\t\thandlersDict.Remove(dataGrid);\n\t\t}\n\n\t\tprivate static void DataGridOnLoaded(object sender, RoutedEventArgs routedEventArgs)\n\t\t{\n\t\t\tvar dataGrid = (DataGrid)sender;\n\t\t\tif (GetAutoScrollToEnd(dataGrid))\n\t\t\t{\n\t\t\t\tSubscribe(dataGrid);\n\t\t\t}\n\t\t}\n\n\t\tprivate static void DataGridOnUnloaded(object sender, RoutedEventArgs routedEventArgs)\n\t\t{\n\t\t\tvar dataGrid = (DataGrid)sender;\n\t\t\tif (GetAutoScrollToEnd(dataGrid))\n\t\t\t{\n\t\t\t\tUnsubscribe(dataGrid);\n\t\t\t}\n\t\t}\n\n\t\tprivate static void ScrollToEnd(DataGrid datagrid)\n\t\t{\n\t\t\tif (datagrid.Items.Count == 0)\n\t\t\t{\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tdatagrid.ScrollIntoView(datagrid.Items[datagrid.Items.Count - 1]);\n\t\t}\n\n\t\tpublic static void SetAutoScrollToEnd(DependencyObject element, bool value)\n\t\t{\n\t\t\telement.SetValue(AutoScrollToEndProperty, value);\n\t\t}\n\n\t\tpublic static bool GetAutoScrollToEnd(DependencyObject element)\n\t\t{\n\t\t\treturn (bool)element.GetValue(AutoScrollToEndProperty);\n\t\t}\n\n\t}\n}\n"
  },
  {
    "path": "src/tool/View/MainWindow.xaml",
    "content": "<Window x:Class=\"BBSFW.MainWindow\"\n        xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"\n        xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\"\n        xmlns:d=\"http://schemas.microsoft.com/expression/blend/2008\"\n        xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\"\n        xmlns:local=\"clr-namespace:BBSFW\"\n\t\txmlns:vm=\"clr-namespace:BBSFW.ViewModel\"\n\t\txmlns:vw=\"clr-namespace:BBSFW.View\"\n        mc:Ignorable=\"d\"\n        Title=\"BBS-FW Tool\" Height=\"640\" Width=\"860\"\n\t\tBackground=\"#FFE8E8E8\">\n\n\t<Window.DataContext>\n\t\t<vm:MainViewModel />\n\t</Window.DataContext>\n\n\t<Grid>\n\n\t\t<Grid.RowDefinitions>\n\t\t\t<RowDefinition Height=\"Auto\" />\n\t\t\t<RowDefinition />\n\t\t</Grid.RowDefinitions>\n\t\t\n\t\t<Menu Grid.Row=\"0\">\n\t\t\t<MenuItem Header=\"File\" Height=\"22\" VerticalContentAlignment=\"Center\">\n\t\t\t\t<MenuItem Header=\"Open...\" Command=\"{Binding OpenConfigCommand}\" />\n\t\t\t\t<MenuItem Header=\"Save As...\" Command=\"{Binding SaveConfigCommand}\" />\n\t\t\t\t<Separator />\n\t\t\t\t<MenuItem Header=\"Save Log...\" Command=\"{Binding SaveLogCommand}\" />\n\t\t\t\t<Separator />\n\t\t\t\t<MenuItem Header=\"Exit\" Command=\"{Binding ExitCommand}\" />\n\t\t\t</MenuItem>\n\t\t\t<MenuItem Header=\"Flash\" Height=\"22\" VerticalContentAlignment=\"Center\">\n\t\t\t\t<MenuItem Header=\"Read\" IsEnabled=\"{Binding ConnectionVm.IsConnected}\" Command=\"{Binding ReadFlashCommand}\" />\n\t\t\t\t<MenuItem Header=\"Write\" IsEnabled=\"{Binding ConnectionVm.IsConnected}\" Command=\"{Binding WriteFlashCommand}\" />\n\t\t\t\t<Separator />\n\t\t\t\t<MenuItem Header=\"Reset\" IsEnabled=\"{Binding ConnectionVm.IsConnected}\" Command=\"{Binding ResetFlashCommand}\" />\n\t\t\t</MenuItem>\n\t\t\t<MenuItem Header=\"Options\" Height=\"22\" VerticalContentAlignment=\"Center\">\n\t\t\t\t<MenuItem Header=\"Units\">\n\t\t\t\t\t<MenuItem Header=\"Metric\" IsCheckable=\"True\" IsChecked=\"{Binding ConfigVm.UseMetricUnits}\" />\n\t\t\t\t\t<MenuItem Header=\"Imperial\" IsCheckable=\"True\" IsChecked=\"{Binding ConfigVm.UseImperialUnits}\" />\n\t\t\t\t</MenuItem>\n\t\t\t</MenuItem>\n\t\t\t<MenuItem Header=\"Help\" Height=\"22\" VerticalContentAlignment=\"Center\">\n\t\t\t\t<MenuItem Header=\"About\" Command=\"{Binding ShowAboutCommand}\" />\n\t\t\t</MenuItem>\n\t\t</Menu>\n\n\t\t<TabControl Margin=\"4 8 4 4\" Grid.Row=\"1\">\n\t\t\t<TabItem Header=\"Connection\">\n\t\t\t\t<vw:ConnectionView Margin=\"10\" DataContext=\"{Binding ConnectionVm}\" />\n\t\t\t</TabItem>\n\t\t\t<TabItem Header=\"System\">\n\t\t\t\t<vw:SystemView Margin=\"10\" />\n\t\t\t</TabItem>\n\t\t\t<TabItem Header=\"Assist Levels\">\n\t\t\t\t<vw:AssistLevelsView Margin=\"10\" DataContext=\"{Binding AssistLevelsVm}\" />\n\t\t\t</TabItem>\n\t\t\t<TabItem Header=\"Calibration\" DataContext=\"{Binding CalibrationVm}\">\n\t\t\t\t<vw:CalibrationView Margin=\"10\" />\n\t\t\t</TabItem>\n\t\t\t<TabItem Header=\"Event Log\" DataContext=\"{Binding EventLogVm}\">\n\t\t\t\t<vw:EventLogView Margin=\"10\" />\n\t\t\t</TabItem>\n\t\t</TabControl>\n\t\t\n\t</Grid>\n</Window>\n"
  },
  {
    "path": "src/tool/View/MainWindow.xaml.cs",
    "content": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Windows;\nusing System.Windows.Controls;\nusing System.Windows.Data;\nusing System.Windows.Documents;\nusing System.Windows.Input;\nusing System.Windows.Media;\nusing System.Windows.Media.Imaging;\nusing System.Windows.Navigation;\nusing System.Windows.Shapes;\n\nnamespace BBSFW\n{\n\t/// <summary>\n\t/// Interaction logic for MainWindow.xaml\n\t/// </summary>\n\tpublic partial class MainWindow : Window\n\t{\n\t\tpublic MainWindow()\n\t\t{\n\t\t\tInitializeComponent();\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/tool/View/SystemView.xaml",
    "content": "<UserControl x:Class=\"BBSFW.View.SystemView\"\n             xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"\n             xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\"\n             xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" \n             xmlns:d=\"http://schemas.microsoft.com/expression/blend/2008\" \n             xmlns:local=\"clr-namespace:BBSFW.View\"\n             mc:Ignorable=\"d\" \n             d:DesignHeight=\"500\" d:DesignWidth=\"850\">\n\n\t<UserControl.Resources>\n\t\t<BooleanToVisibilityConverter x:Key=\"BoolToVis\" />\n\t</UserControl.Resources>\n\t\n\t<Grid>\n\n\t\t<Grid.ColumnDefinitions>\n\t\t\t<ColumnDefinition />\n\t\t\t<ColumnDefinition Width=\"20\" />\n\t\t\t<ColumnDefinition />\n\t\t</Grid.ColumnDefinitions>\n\n\t\t<Grid.RowDefinitions>\n\t\t\t<RowDefinition Height=\"Auto\" />\n\t\t</Grid.RowDefinitions>\n\n\t\t<StackPanel Grid.Column=\"0\" Grid.Row=\"0\" >\n\t\t\t\n\t\t\t<Grid>\n\n\t\t\t\t<Grid.ColumnDefinitions>\n\t\t\t\t\t<ColumnDefinition />\n\t\t\t\t\t<ColumnDefinition Width=\"10\" />\n\t\t\t\t\t<ColumnDefinition />\n\t\t\t\t</Grid.ColumnDefinitions>\n\n\t\t\t\t<Grid.RowDefinitions>\n\t\t\t\t\t<RowDefinition Height=\"Auto\" />\n\t\t\t\t\t<RowDefinition Height=\"Auto\" />\n\t\t\t\t\t<RowDefinition Height=\"Auto\" />\n\t\t\t\t\t<RowDefinition Height=\"Auto\" />\n\t\t\t\t\t<RowDefinition Height=\"Auto\" />\n\t\t\t\t\t<RowDefinition Height=\"Auto\" />\n\t\t\t\t</Grid.RowDefinitions>\n\n\t\t\t\t<TextBlock Grid.Row=\"0\" Text=\"Global\" FontSize=\"18\" FontWeight=\"Bold\" />\n\n\t\t\t\t<TextBlock Grid.Column=\"0\" Grid.Row=\"1\" Margin=\"0 10 0 0\" Text=\"Max Current (A):\" />\n\t\t\t\t<TextBox Grid.Column=\"2\" Grid.Row=\"1\" Margin=\"0 10 0 0\" Width=\"60\" HorizontalAlignment=\"Right\" Text=\"{Binding ConfigVm.MaxCurrentAmps, UpdateSourceTrigger=PropertyChanged}\" />\n\n\t\t\t\t<TextBlock Grid.Column=\"0\" Grid.Row=\"2\" Margin=\"0 10 0 0\" Text=\"Current Ramp (A/s):\" />\n\t\t\t\t<TextBox Grid.Column=\"2\" Grid.Row=\"2\" Margin=\"0 10 0 0\" Width=\"60\" HorizontalAlignment=\"Right\" Text=\"{Binding ConfigVm.CurrentRampAmpsSecond, UpdateSourceTrigger=PropertyChanged}\" />\n\n\t\t\t\t<TextBlock Grid.Column=\"0\" Grid.Row=\"3\" Margin=\"0 10 0 0\" Text=\"Max Battery Voltage (V):\" />\n\t\t\t\t<TextBox Grid.Column=\"2\" Grid.Row=\"3\" Margin=\"0 10 0 0\" Width=\"60\" HorizontalAlignment=\"Right\" Text=\"{Binding ConfigVm.MaxBatteryVolts, UpdateSourceTrigger=LostFocus}\" />\n\n\t\t\t\t<TextBlock Grid.Column=\"0\" Grid.Row=\"4\" Margin=\"0 8 0 0\" Text=\"Low Voltage Cutoff (V):\" />\n\t\t\t\t<TextBox Grid.Column=\"2\" Grid.Row=\"4\" Margin=\"0 8 0 0\" Width=\"60\" HorizontalAlignment=\"Right\" Text=\"{Binding ConfigVm.LowCutoffVolts, UpdateSourceTrigger=PropertyChanged}\" />\n\n\t\t\t\t<TextBlock Grid.Column=\"0\" Grid.Row=\"5\" Margin=\"0 10 0 0\" Text=\"Max Speed (km/h):\" Visibility=\"{Binding ConfigVm.UseMetricUnits, Converter={StaticResource BoolToVis}}\" />\n\t\t\t\t<TextBox Grid.Column=\"2\" Grid.Row=\"5\" Margin=\"0 10 0 0\" Width=\"60\" HorizontalAlignment=\"Right\" Text=\"{Binding ConfigVm.MaxSpeedKph, UpdateSourceTrigger=PropertyChanged}\" Visibility=\"{Binding ConfigVm.UseMetricUnits, Converter={StaticResource BoolToVis}}\" />\n\n\t\t\t\t<TextBlock Grid.Column=\"0\" Grid.Row=\"5\" Margin=\"0 10 0 0\" Text=\"Max Speed (mph):\" Visibility=\"{Binding ConfigVm.UseImperialUnits, Converter={StaticResource BoolToVis}}\" />\n\t\t\t\t<TextBox Grid.Column=\"2\" Grid.Row=\"5\" Margin=\"0 10 0 0\" Width=\"60\" HorizontalAlignment=\"Right\" Text=\"{Binding ConfigVm.MaxSpeedMph, UpdateSourceTrigger=PropertyChanged}\" Visibility=\"{Binding ConfigVm.UseImperialUnits, Converter={StaticResource BoolToVis}}\" />\n\t\t\t</Grid>\n\n\t\t\t<Grid Margin=\"0 20 0 0\">\n\t\t\t\t<Grid.ColumnDefinitions>\n\t\t\t\t\t<ColumnDefinition />\n\t\t\t\t\t<ColumnDefinition Width=\"10\" />\n\t\t\t\t\t<ColumnDefinition />\n\t\t\t\t</Grid.ColumnDefinitions>\n\n\t\t\t\t<Grid.RowDefinitions>\n\t\t\t\t\t<RowDefinition Height=\"Auto\" />\n\t\t\t\t\t<RowDefinition Height=\"Auto\" />\n\t\t\t\t\t<RowDefinition Height=\"Auto\" />\n\t\t\t\t\t<RowDefinition Height=\"Auto\" />\n\t\t\t\t\t<RowDefinition Height=\"Auto\" />\n\t\t\t\t\t<RowDefinition Height=\"Auto\" />\n\t\t\t\t</Grid.RowDefinitions>\n\n\t\t\t\t<TextBlock Grid.Row=\"0\" Text=\"Throttle\" FontSize=\"18\" FontWeight=\"Bold\" />\n\n\t\t\t\t<TextBlock Grid.Column=\"0\" Grid.Row=\"1\" Margin=\"0 10 0 0\" Text=\"Start Voltage (mV):\" />\n\t\t\t\t<TextBox Grid.Column=\"2\" Grid.Row=\"1\" Margin=\"0 10 0 0\" Width=\"60\" HorizontalAlignment=\"Right\" Text=\"{Binding ConfigVm.ThrottleStartVoltageMillivolts, UpdateSourceTrigger=PropertyChanged}\" />\n\n\t\t\t\t<TextBlock Grid.Column=\"0\" Grid.Row=\"2\" Margin=\"0 8 0 0\" Text=\"End Voltage (mV):\" />\n\t\t\t\t<TextBox Grid.Column=\"2\" Grid.Row=\"2\" Margin=\"0 8 0 0\" Width=\"60\" HorizontalAlignment=\"Right\" Text=\"{Binding ConfigVm.ThrottleEndVoltageMillivolts, UpdateSourceTrigger=PropertyChanged}\" />\n\n\t\t\t\t<TextBlock Grid.Column=\"0\" Grid.Row=\"3\" Margin=\"0 8 0 0\" Text=\"Start Current (%):\" />\n\t\t\t\t<TextBox Grid.Column=\"2\" Grid.Row=\"3\" Margin=\"0 8 0 0\" Width=\"60\" HorizontalAlignment=\"Right\" Text=\"{Binding ConfigVm.ThrottleStartCurrentPercent, UpdateSourceTrigger=PropertyChanged}\" />\n\n\t\t\t\t<TextBlock Grid.Column=\"0\" Grid.Row=\"4\" Margin=\"0 8 0 0\" Text=\"Global Speed Limit Options:\">\n\t\t\t\t\t<TextBlock.ToolTip>\n\t\t\t\t\t\t<TextBlock Width=\"400\" TextWrapping=\"Wrap\">\n\t\t\t\t\t\tEnable global speed limit when throttle is used. Some countries have laws\n\t\t\t\t\t\tthat only permits use of throttle up to a specific speed. This option can\n\t\t\t\t\t\tbe used in order to comply with such laws.\n\t\t\t\t\t\t<LineBreak />\n\t\t\t\t\t\t<LineBreak />\n\t\t\t\t\t\tWhen this option is enabled the configured global throttle speed limit will override the \n\t\t\t\t\t\tassist level speed limit while using throttle and not pedaling. Throttle must still\r\n\t\t\t\t\t\tbe enabled on each individual assist level for this option to apply.\n\t\t\t\t\t\t<LineBreak />\n\t\t\t\t\t\t<LineBreak />\n\t\t\t\t\t\t<Run FontWeight=\"Bold\">Disabled</Run> - No global speed limit.\n\t\t\t\t\t\t<LineBreak />\n\t\t\t\t\t\t<Run FontWeight=\"Bold\">Enabled</Run> - Global speed limit applies to all assist levels.\n\t\t\t\t\t\t<LineBreak />\n\t\t\t\t\t\t<Run FontWeight=\"Bold\">Standard Levels</Run> - Global speed limit applies to standard assist levels only.\n\t\t\t\t\t\t</TextBlock>\n\t\t\t\t\t</TextBlock.ToolTip>\n\t\t\t\t</TextBlock>\n\t\t\t\t<ComboBox Grid.Column=\"2\" Grid.Row=\"4\" Margin=\"0 8 0 0\" Padding=\"6 2 6 0\" Width=\"120\" Height=\"20\" HorizontalAlignment=\"Right\" ItemsSource=\"{Binding ConfigVm.ThrottleGlobalSpeedLimitOptions}\" SelectedItem=\"{Binding ConfigVm.ThrottleGlobalSpeedLimit, UpdateSourceTrigger=PropertyChanged}\" />\n\n\t\t\t\t<TextBlock Grid.Column=\"0\" Grid.Row=\"5\" Margin=\"0 8 0 0\" Text=\"Global Speed Limit (%):\">\n\t\t\t\t\t<TextBlock.ToolTip>\n\t\t\t\t\tSet speed limit in % of configured max speed when global throttle speed limit is enabled.\n\t\t\t\t\t</TextBlock.ToolTip>\n\t\t\t\t</TextBlock>\n\t\t\t\t<TextBox Grid.Column=\"2\" Grid.Row=\"5\" Margin=\"0 8 0 0\" Width=\"60\" HorizontalAlignment=\"Right\" Text=\"{Binding ConfigVm.ThrottleGlobalSpeedLimitPercent, UpdateSourceTrigger=PropertyChanged}\">\n\t\t\t\t\t<TextBox.Style>\n\t\t\t\t\t\t<Style TargetType=\"{x:Type TextBox}\">\n\t\t\t\t\t\t\t<Setter Property=\"IsEnabled\" Value=\"True\" />\n\t\t\t\t\t\t\t<Style.Triggers>\n\t\t\t\t\t\t\t\t<DataTrigger Binding=\"{Binding ConfigVm.ThrottleGlobalSpeedLimitOpt.Value}\" Value=\"Disabled\">\n\t\t\t\t\t\t\t\t\t<Setter Property=\"IsEnabled\" Value=\"False\" />\n\t\t\t\t\t\t\t\t</DataTrigger>\n\t\t\t\t\t\t\t</Style.Triggers>\n\t\t\t\t\t\t</Style>\n\t\t\t\t\t</TextBox.Style>\n\t\t\t\t</TextBox>\n\n\t\t\t</Grid>\n\n\t\t\t<Grid Margin=\"0 20 0 0\">\n\t\t\t\t<Grid.ColumnDefinitions>\n\t\t\t\t\t<ColumnDefinition />\n\t\t\t\t\t<ColumnDefinition Width=\"10\" />\n\t\t\t\t\t<ColumnDefinition />\n\t\t\t\t</Grid.ColumnDefinitions>\n\n\t\t\t\t<Grid.RowDefinitions>\n\t\t\t\t\t<RowDefinition Height=\"Auto\" />\n\t\t\t\t\t<RowDefinition Height=\"Auto\" />\n\t\t\t\t\t<RowDefinition Height=\"Auto\" />\n\t\t\t\t\t<RowDefinition Height=\"Auto\" />\n\t\t\t\t\t<RowDefinition Height=\"Auto\" />\n\t\t\t\t</Grid.RowDefinitions>\n\n\t\t\t\t<TextBlock Grid.Row=\"0\" Text=\"Pedal Assist\" FontSize=\"18\" FontWeight=\"Bold\" />\n\n\t\t\t\t<TextBlock Grid.Column=\"0\" Grid.Row=\"1\" Margin=\"0 10 0 0\" Text=\"Start Delay (°):\" />\n\t\t\t\t<ComboBox Grid.Column=\"2\" Grid.Row=\"1\" Margin=\"0 10 0 0\" Padding=\"6 2 6 0\" Width=\"60\" Height=\"20\" HorizontalAlignment=\"Right\" ItemsSource=\"{Binding ConfigVm.PasStartDelayOptions, UpdateSourceTrigger=PropertyChanged}\" SelectedItem=\"{Binding ConfigVm.PasStartDelayDegrees}\" />\n\n\t\t\t\t<TextBlock Grid.Column=\"0\" Grid.Row=\"2\" Margin=\"0 8 0 0\" Text=\"Stop Delay (ms):\" />\n\t\t\t\t<TextBox Grid.Column=\"2\" Grid.Row=\"2\" Margin=\"0 8 0 0\" Width=\"60\" HorizontalAlignment=\"Right\" Text=\"{Binding ConfigVm.PasStopDelayMilliseconds, UpdateSourceTrigger=PropertyChanged}\" />\n\n\t\t\t\t<TextBlock Grid.Column=\"0\" Grid.Row=\"3\" Margin=\"0 8 0 0\" Text=\"Keep Current (%):\">\n\t\t\t\t\t<TextBlock.ToolTip>\n\t\t\t\t\t\t<TextBlock Width=\"300\" TextWrapping=\"Wrap\">\n\t\t\t\t\t\tKeep this motor current in percent of assist level target current when target cadence of assist level has been reached.\n\t\t\t\t\t\tThe assist level current will start ramp down towards this value when cadence hits the limit configured in 'Keep Current Cadence (rpm)'.\n\t\t\t\t\t\t</TextBlock>\n\t\t\t\t\t</TextBlock.ToolTip>\n\t\t\t</TextBlock>\n\t\t\t\t<TextBox Grid.Column=\"2\" Grid.Row=\"3\" Margin=\"0 8 0 0\" Width=\"60\" HorizontalAlignment=\"Right\" Text=\"{Binding ConfigVm.PasKeepCurrentPercent, UpdateSourceTrigger=PropertyChanged}\" />\n\n\t\t\t\t<TextBlock Grid.Column=\"0\" Grid.Row=\"4\" Margin=\"0 8 0 0\" Text=\"Keep Current Cadence (rpm):\">\n\t\t\t\t\t<TextBlock.ToolTip>\n\t\t\t\t\t\t<TextBlock Width=\"300\" TextWrapping=\"Wrap\">\n\t\t\t\t\t\tLower cadence limit for when 'Keep Current %' ramp starts, configured in rpm.\n\t\t\t\t\t\tWhen cadence gets above this value the motor current will decrease towards the current calculated using configured value of 'Keep Current %'.\n\t\t\t\t\t\t</TextBlock>\n\t\t\t\t\t</TextBlock.ToolTip>\n\t\t\t</TextBlock>\n\t\t\t\t<TextBox Grid.Column=\"2\" Grid.Row=\"4\" Margin=\"0 8 0 0\" Width=\"60\" HorizontalAlignment=\"Right\" Text=\"{Binding ConfigVm.PasKeepCurrentCadenceRpm, UpdateSourceTrigger=PropertyChanged}\" />\n\n\t\t\t</Grid>\n\n\t\t</StackPanel>\n\n\t\t<StackPanel Grid.Column=\"2\" Grid.Row=\"0\">\n\n\t\t\t<Grid>\n\n\t\t\t\t<Grid.ColumnDefinitions>\n\t\t\t\t\t<ColumnDefinition />\n\t\t\t\t\t<ColumnDefinition Width=\"10\" />\n\t\t\t\t\t<ColumnDefinition />\n\t\t\t\t</Grid.ColumnDefinitions>\n\n\t\t\t\t<Grid.RowDefinitions>\n\t\t\t\t\t<RowDefinition Height=\"Auto\" />\n\t\t\t\t\t<RowDefinition Height=\"Auto\" />\n\t\t\t\t\t<RowDefinition Height=\"Auto\" />\n\t\t\t\t\t<RowDefinition Height=\"Auto\" />\n\t\t\t\t\t<RowDefinition Height=\"Auto\" />\n\t\t\t\t\t<RowDefinition Height=\"Auto\" />\n\t\t\t\t\t<RowDefinition Height=\"Auto\" />\n\t\t\t\t\t<RowDefinition Height=\"Auto\" />\n\t\t\t\t</Grid.RowDefinitions>\n\n\t\t\t\t<TextBlock Grid.Row=\"0\" Text=\"Features\" FontSize=\"18\" FontWeight=\"Bold\" />\n\n\t\t\t\t<TextBlock Grid.Column=\"0\" Grid.Row=\"1\" Margin=\"0 8 0 0\" Text=\"Speed Sensor:\" />\n\t\t\t\t<CheckBox Grid.Column=\"2\" Grid.Row=\"1\" Margin=\"0 8 0 0\" HorizontalAlignment=\"Right\"  IsChecked=\"{Binding ConfigVm.UseSpeedSensor, UpdateSourceTrigger=PropertyChanged}\" />\n\n\t\t\t\t<TextBlock Grid.Column=\"0\" Grid.Row=\"2\" Margin=\"0 8 0 0\" Text=\"Shift Sensor:\" />\n\t\t\t\t<CheckBox Grid.Column=\"2\" Grid.Row=\"2\" Margin=\"0 8 0 0\" HorizontalAlignment=\"Right\"  IsChecked=\"{Binding ConfigVm.UseShiftSensor, UpdateSourceTrigger=PropertyChanged}\" IsEnabled=\"{Binding ConfigVm.IsShiftSensorSupported}\" />\n\n\t\t\t\t<TextBlock Grid.Column=\"0\" Grid.Row=\"3\" Margin=\"0 8 0 0\" Text=\"Walk Mode:\" />\n\t\t\t\t<CheckBox Grid.Column=\"2\" Grid.Row=\"3\" Margin=\"0 8 0 0\" HorizontalAlignment=\"Right\"  IsChecked=\"{Binding ConfigVm.UsePushWalk, UpdateSourceTrigger=PropertyChanged}\" />\n\n\t\t\t\t<TextBlock Grid.Column=\"0\" Grid.Row=\"4\" Margin=\"0 8 0 0\" Text=\"Temperature Sensor:\">\n\t\t\t\t\t<TextBlock.ToolTip>\n\t\t\t\t\t\t<TextBlock Width=\"300\" TextWrapping=\"Wrap\">\n\t\t\t\t\t\tSelect which temperature sensors to use for thermal limiting if motor/controller gets to hot.\n\t\t\t\t\t\tNormally you should have this set to \"All\" but if you have a motor or controller with a broken\n\t\t\t\t\t\ttemperature sensor it could be usuful to select only the sensors that are working. This will let\n\t\t\t\t\t\tyou continue to use your motor/controller even though temperature monitoring is not working.\n\t\t\t\t\t\t</TextBlock>\n\t\t\t\t\t</TextBlock.ToolTip>\n\t\t\t\t</TextBlock>\n\t\t\t\t<ComboBox Grid.Column=\"2\" Grid.Row=\"4\" Margin=\"0 8 0 0\" Padding=\"6 2 6 0\" Width=\"80\" Height=\"20\" HorizontalAlignment=\"Right\" ItemsSource=\"{Binding ConfigVm.TemperatureSensorOptions}\" SelectedItem=\"{Binding ConfigVm.UseTemperatureSensor, UpdateSourceTrigger=PropertyChanged}\" />\n\n\t\t\t\t<TextBlock Grid.Column=\"0\" Grid.Row=\"5\" Margin=\"0 8 0 0\" Text=\"Lights Mode:\">\n\t\t\t\t\t<TextBlock.ToolTip>\n\t\t\t\t\t\t<TextBlock Width=\"400\" TextWrapping=\"Wrap\">\n\t\t\t\t\t\tOptions for controlling external lights output.\n\t\t\t\t\t\t<LineBreak />\n\t\t\t\t\t\t<LineBreak />\n\t\t\t\t\t\t<Run FontWeight=\"Bold\">Default</Run> - Controlled by display.\n\t\t\t\t\t\t<LineBreak />\n\t\t\t\t\t\t<Run FontWeight=\"Bold\">Disabled</Run> - Lights output disabled.\n\t\t\t\t\t\t<LineBreak />\n\t\t\t\t\t\t<Run FontWeight=\"Bold\">Always On</Run> - Lights output always on.\n\t\t\t\t\t\t<LineBreak />\n\t\t\t\t\t\t<Run FontWeight=\"Bold\">Brake Light</Run> - Lights output enabled while braking.\n\t\t\t\t\t\t</TextBlock>\n\t\t\t\t\t</TextBlock.ToolTip>\n\t\t\t\t</TextBlock>\n\t\t\t\t<ComboBox Grid.Column=\"2\" Grid.Row=\"5\" Margin=\"0 8 0 0\" Padding=\"6 2 6 0\" Width=\"100\" Height=\"20\" HorizontalAlignment=\"Right\" ItemsSource=\"{Binding ConfigVm.LightsModeOptions}\" SelectedItem=\"{Binding ConfigVm.LightsMode, UpdateSourceTrigger=PropertyChanged}\" />\n\n\t\t\t\t<TextBlock Grid.Column=\"0\" Grid.Row=\"6\" Margin=\"0 8 0 0\" Text=\"Pretension Chain:\">\n\t\t\t\t\t<TextBlock.ToolTip>\n\t\t\t\t\t\t<TextBlock Width=\"300\" TextWrapping=\"Wrap\">\n\t\t\t\t\t\t\tApply 1% of Max Current when above a threshold road speed to pre-tension the drivetrain.\n\t\t\t\t\t\t\tThis makes it nicer for more aggressive PAS / throttle settings since freewheel pawls\n\t\t\t\t\t\t\twill not get smacked if there is play in the drivetrain system.\n\t\t\t\t\t\t</TextBlock>\n\t\t\t\t\t</TextBlock.ToolTip>\n\t\t\t\t</TextBlock>\n\t\t\t\t<CheckBox Grid.Column=\"2\" Grid.Row=\"6\" Margin=\"0 8 0 0\" HorizontalAlignment=\"Right\"  IsChecked=\"{Binding ConfigVm.UsePretension, UpdateSourceTrigger=PropertyChanged}\" IsEnabled=\"{Binding ConfigVm.UseSpeedSensor}\" />\n\n\t\t\t\t<TextBlock Grid.Column=\"0\" Grid.Row=\"7\" Margin=\"0 10 0 0\" Text=\"Pretension Speed Cutoff (km/h):\" Visibility=\"{Binding ConfigVm.UseMetricUnits, Converter={StaticResource BoolToVis}}\">\n\t\t\t\t\t<TextBlock.ToolTip>\n\t\t\t\t\t\t<TextBlock Width=\"300\" TextWrapping=\"Wrap\">\n\t\t\t\t\t\t\tPretension will not be applied at and below this roadspeed. Take caution setting this to zero, as\n\t\t\t\t\t\t\tyour bike will roll forward as soon as it is powered on and pushed. Recommended to start with ~16kph\n\t\t\t\t\t\t\tand lower if necessary once comfortable with the feature.\n\t\t\t\t\t</TextBlock>\n\t\t\t\t</TextBlock.ToolTip>\n\t\t\t\t</TextBlock>\n\t\t\t\t<TextBox Grid.Column=\"2\" Grid.Row=\"7\" Margin=\"0 10 0 0\" Width=\"60\" HorizontalAlignment=\"Right\" Text=\"{Binding ConfigVm.PretensionSpeedCutoffKph, UpdateSourceTrigger=PropertyChanged}\" Visibility=\"{Binding ConfigVm.UseMetricUnits, Converter={StaticResource BoolToVis}}\" IsEnabled=\"{Binding ConfigVm.UseSpeedSensor}\" />\n\n\t\t\t\t<TextBlock Grid.Column=\"0\" Grid.Row=\"7\" Margin=\"0 10 0 0\" Text=\"Pretension Speed Cutoff (mph):\" Visibility=\"{Binding ConfigVm.UseImperialUnits, Converter={StaticResource BoolToVis}}\" >\n\t\t\t\t\t<TextBlock.ToolTip>\n\t\t\t\t\t\t<TextBlock Width=\"300\" TextWrapping=\"Wrap\">\n\t\t\t\t\t\t\tPretension will not be applied at and below this roadspeed. Take caution setting this to zero, as\n\t\t\t\t\t\t\tyour bike will roll forward as soon as it is powered on and pushed. Recommended to start with ~10mph\n\t\t\t\t\t\t\tand lower if necessary once comfortable with the feature.\n\t\t\t\t\t</TextBlock>\n\t\t\t\t</TextBlock.ToolTip>\n\t\t\t\t</TextBlock>\n\t\t\t\t<TextBox Grid.Column=\"2\" Grid.Row=\"7\" Margin=\"0 10 0 0\" Width=\"60\" HorizontalAlignment=\"Right\" Text=\"{Binding ConfigVm.PretensionSpeedCutoffMph, UpdateSourceTrigger=PropertyChanged}\" Visibility=\"{Binding ConfigVm.UseImperialUnits, Converter={StaticResource BoolToVis}}\" IsEnabled=\"{Binding ConfigVm.UseSpeedSensor}\" />\n\n\t\t\t</Grid>\n\n\t\t\t<Grid Margin=\"0 20 0 0\">\n\t\t\t\t<Grid.ColumnDefinitions>\n\t\t\t\t\t<ColumnDefinition />\n\t\t\t\t\t<ColumnDefinition Width=\"10\" />\n\t\t\t\t\t<ColumnDefinition />\n\t\t\t\t</Grid.ColumnDefinitions>\n\n\t\t\t\t<Grid.RowDefinitions>\n\t\t\t\t\t<RowDefinition Height=\"Auto\" />\n\t\t\t\t\t<RowDefinition Height=\"Auto\" />\n\t\t\t\t\t<RowDefinition Height=\"Auto\" />\n\t\t\t\t\t<RowDefinition Height=\"Auto\" />\n\t\t\t\t</Grid.RowDefinitions>\n\n\t\t\t\t<TextBlock Grid.Row=\"0\" Text=\"Speed Sensor\" FontSize=\"18\" FontWeight=\"Bold\" />\n\n\t\t\t\t<TextBlock Grid.Column=\"0\" Grid.Row=\"2\" Margin=\"0 8 0 0\" Text=\"Wheel Size (inch):\" />\n\t\t\t\t<TextBox Grid.Column=\"2\" Grid.Row=\"2\" Margin=\"0 8 0 0\" Width=\"60\" HorizontalAlignment=\"Right\" Text=\"{Binding ConfigVm.WheelSizeInch, UpdateSourceTrigger=LostFocus}\" />\n\n\t\t\t\t<TextBlock Grid.Column=\"0\" Grid.Row=\"3\" Margin=\"0 8 0 0\" Text=\"Signals (per rotation):\" />\n\t\t\t\t<TextBox Grid.Column=\"2\" Grid.Row=\"3\" Margin=\"0 8 0 0\" Width=\"60\" HorizontalAlignment=\"Right\" Text=\"{Binding ConfigVm.SpeedSensorSignals, UpdateSourceTrigger=PropertyChanged}\" />\n\n\t\t\t</Grid>\n\n\t\t\t<Grid Margin=\"0 20 0 0\">\n\n\t\t\t\t<Grid.ColumnDefinitions>\n\t\t\t\t\t<ColumnDefinition />\n\t\t\t\t\t<ColumnDefinition Width=\"10\" />\n\t\t\t\t\t<ColumnDefinition Width=\"Auto\" />\n\t\t\t\t</Grid.ColumnDefinitions>\n\n\t\t\t\t<Grid.RowDefinitions>\n\t\t\t\t\t<RowDefinition Height=\"Auto\" />\n\t\t\t\t\t<RowDefinition Height=\"Auto\" />\n\t\t\t\t\t<RowDefinition Height=\"Auto\" />\n\t\t\t\t</Grid.RowDefinitions>\n\t\t\t\t\n\t\t\t\t<TextBlock Grid.Row=\"0\" Text=\"Shift Sensor\" FontSize=\"18\" FontWeight=\"Bold\" />\n\n\t\t\t\t<TextBlock Grid.Column=\"0\" Grid.Row=\"1\" Margin=\"0 8 0 0\" Text=\"Shift Interrupt Duration (ms):\">\n\t\t\t\t\t<TextBlock.ToolTip>\n\t\t\t\t\t\t<TextBlock Width=\"300\" TextWrapping=\"Wrap\">\n\t\t\t\t\t\tDuration of the power interrupt when the shift sensor is triggered.\n\t\t\t\t\t\t</TextBlock>\n\t\t\t\t\t</TextBlock.ToolTip>\n\t\t\t\t</TextBlock>\n\t\t\t\t<TextBox Grid.Column=\"2\" Grid.Row=\"1\" Margin=\"0 8 0 0\" Width=\"60\" HorizontalAlignment=\"Right\"\n\t\t\t\t\t IsEnabled=\"{Binding ConfigVm.IsShiftSensorSupported}\"\n\t\t\t\t\t Text=\"{Binding ConfigVm.ShiftInterruptDuration, UpdateSourceTrigger=PropertyChanged}\" />\n\n\t\t\t\t<TextBlock Grid.Column=\"0\" Grid.Row=\"2\" Margin=\"0 8 0 0\" Text=\"Shift Current Threshold (%):\">\n\t\t\t\t\t<TextBlock.ToolTip>\n\t\t\t\t\t\t<TextBlock Width=\"300\" TextWrapping=\"Wrap\">\n\t\t\t\t\t\tMaximum motor current during shifting expressed as a percentage of \"Max Current (A)\".\n\t\t\t\t\t\tIf motor current is below this threshold, then no power cut will happen.\n\t\t\t\t\t\tIf motor current is higher than this threshold, then current will be reduced to this value during the shift.\n\t\t\t\t\t\t<LineBreak />\n\t\t\t\t\t\tFor example, if Max Current is 30 amps, and Shift Current Threshold is 10%, then current through the motor during\n\t\t\t\t\t\tshifts will be limited to 3 amps.\n\t\t\t\t\t\t</TextBlock>\n\t\t\t\t\t</TextBlock.ToolTip>\n\t\t\t\t</TextBlock>\n\t\t\t\t<TextBox Grid.Column=\"2\" Grid.Row=\"2\" Margin=\"0 8 0 0\" Width=\"60\" HorizontalAlignment=\"Right\"\n\t\t\t\t\t IsEnabled=\"{Binding ConfigVm.IsShiftSensorSupported}\"\n\t\t\t\t\t Text=\"{Binding ConfigVm.ShiftInterruptCurrentThresholdPercent, UpdateSourceTrigger=PropertyChanged}\" />\n\n\t\t\t</Grid>\n\t\t\t\n\t\t\t<Grid Margin=\"0 20 0 0\">\n\t\t\t\t<Grid.ColumnDefinitions>\n\t\t\t\t\t<ColumnDefinition />\n\t\t\t\t\t<ColumnDefinition Width=\"10\" />\n\t\t\t\t\t<ColumnDefinition Width=\"Auto\" />\n\t\t\t\t</Grid.ColumnDefinitions>\n\n\t\t\t\t<Grid.RowDefinitions>\n\t\t\t\t\t<RowDefinition Height=\"Auto\" />\n\t\t\t\t\t<RowDefinition Height=\"Auto\" />\n\t\t\t\t\t<RowDefinition Height=\"Auto\" />\n\t\t\t\t</Grid.RowDefinitions>\n\n\t\t\t\t<TextBlock Grid.Row=\"0\" Text=\"Miscellaneous\" FontSize=\"18\" FontWeight=\"Bold\" />\n\n\t\t\t\t<TextBlock Grid.Column=\"0\" Grid.Row=\"1\" Margin=\"0 10 0 0\" Text=\"Walk Mode Data Display:\">\n\t\t\t\t\t<TextBlock.ToolTip>\n\t\t\t\t\t\t<TextBlock Width=\"400\" TextWrapping=\"Wrap\">\n\t\t\t\t\t\tSelect what data to show in the speed field on the display. Walk mode is usually engaged by long press on the minus button of the display.\n\t\t\t\t\t\t<LineBreak />\n\t\t\t\t\t\t<LineBreak />\n\t\t\t\t\t\t<Run FontWeight=\"Bold\">Speed</Run> - Default setting, continue to display road speed.\n\t\t\t\t\t\t<LineBreak />\n\t\t\t\t\t\t<Run FontWeight=\"Bold\">Temperature</Run> - Display max value of motor/controller temperature in °C.\n\t\t\t\t\t\t<LineBreak />\n\t\t\t\t\t\t<Run FontWeight=\"Bold\">Requested Power</Run> - Display requested motor power in percent.\n\t\t\t\t\t\t<LineBreak />\n\t\t\t\t\t\t<Run FontWeight=\"Bold\">Battery Level</Run> - Display computed battery level in percent.\n\t\t\t\t\t\t</TextBlock>\n\t\t\t\t\t</TextBlock.ToolTip>\n\t\t\t\t</TextBlock>\n\t\t\t\t<ComboBox Grid.Column=\"2\" Grid.Row=\"1\" Margin=\"0 8 0 0\" Padding=\"6 2 6 0\" Width=\"120\" Height=\"20\" HorizontalAlignment=\"Right\" ItemsSource=\"{Binding ConfigVm.WalkModeDataDisplayOptions}\" SelectedItem=\"{Binding ConfigVm.WalkModeDataDisplay, UpdateSourceTrigger=PropertyChanged}\" />\n\n\t\t\t</Grid>\n\n\t\t</StackPanel>\n\n\t</Grid>\n</UserControl>\n"
  },
  {
    "path": "src/tool/View/SystemView.xaml.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Windows;\nusing System.Windows.Controls;\nusing System.Windows.Data;\nusing System.Windows.Documents;\nusing System.Windows.Input;\nusing System.Windows.Media;\nusing System.Windows.Media.Imaging;\nusing System.Windows.Navigation;\nusing System.Windows.Shapes;\n\nnamespace BBSFW.View\n{\n\t/// <summary>\n\t/// Interaction logic for SystemView.xaml\n\t/// </summary>\n\tpublic partial class SystemView : UserControl\n\t{\n\t\tpublic SystemView()\n\t\t{\n\t\t\tInitializeComponent();\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/tool/ViewModel/AssistLevelViewModel.cs",
    "content": "using BBSFW.Model;\nusing BBSFW.ViewModel.Base;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace BBSFW.ViewModel\n{\n\tpublic class AssistLevelViewModel : ObservableObject\n\t{\n\t\tprivate ConfigurationViewModel _configVm;\n\t\tprivate Configuration.AssistLevel _level;\n\n\n\t\tpublic enum AssistBaseType\n\t\t{\n\t\t\tDisabled,\n\t\t\tPas,\n\t\t\tThrottle,\n\t\t\tCruise\n\t\t}\n\n\t\tpublic enum AssistPasVariant\n\t\t{\n\t\t\tCadence,\n\t\t\tTorque,\n\t\t\tVariable\n\t\t}\n\n\n\t\tpublic List<ValueItemViewModel<AssistBaseType>> AssistBaseTypeOptions { get; } =\n\t\t\tnew List<ValueItemViewModel<AssistBaseType>>()\n\t\t\t{\n\t\t\t\tnew ValueItemViewModel<AssistBaseType>(AssistBaseType.Disabled, \"Motor Disabled\"),\n\t\t\t\tnew ValueItemViewModel<AssistBaseType>(AssistBaseType.Pas, \"PAS\"),\n\t\t\t\tnew ValueItemViewModel<AssistBaseType>(AssistBaseType.Throttle, \"Throttle\"),\n\t\t\t\tnew ValueItemViewModel<AssistBaseType>(AssistBaseType.Cruise, \"Cruise\")\n\t\t\t};\n\n\t\tpublic List<ValueItemViewModel<AssistPasVariant>> AssistPasVariantOptions\n\t\t{\n\t\t\tget\n\t\t\t{\n\t\t\t\tvar variants = new List<ValueItemViewModel<AssistPasVariant>>\n\t\t\t\t{\n\t\t\t\t\tnew ValueItemViewModel<AssistPasVariant>(AssistPasVariant.Cadence, \"Cadence\")\n\t\t\t\t};\n\n\t\t\t\tif (_configVm.IsTorqueSensorSupported)\n\t\t\t\t{\n\t\t\t\t\tvariants.Add(new ValueItemViewModel<AssistPasVariant>(AssistPasVariant.Torque, \"Torque\"));\n\t\t\t\t}\n\n\t\t\t\tvariants.Add(new ValueItemViewModel<AssistPasVariant>(AssistPasVariant.Variable, \"Variable\"));\n\n\t\t\t\treturn variants;\n\t\t\t}\n\t\t}\n\t\t\t\n\n\n\n\t\tprivate int _id;\n\t\tpublic int Id\n\t\t{\n\t\t\tget { return _id; }\n\t\t}\n\n\n\t\tpublic ValueItemViewModel<AssistBaseType> SelectedType\n\t\t{\n\t\t\tget\n\t\t\t{\n\t\t\t\tvar type = AssistBaseType.Disabled;\n\n\t\t\t\tif (_level.Type.HasFlag(Configuration.AssistFlagsType.Pas))\n\t\t\t\t{\n\t\t\t\t\ttype = AssistBaseType.Pas;\n\t\t\t\t}\n\t\t\t\telse if (_level.Type.HasFlag(Configuration.AssistFlagsType.Throttle))\n\t\t\t\t{\n\t\t\t\t\ttype = AssistBaseType.Throttle;\n\t\t\t\t}\n\t\t\t\telse if (_level.Type.HasFlag(Configuration.AssistFlagsType.Cruise))\n\t\t\t\t{\n\t\t\t\t\ttype = AssistBaseType.Cruise;\n\t\t\t\t}\n\n\t\t\t\treturn AssistBaseTypeOptions.FirstOrDefault((e) => e.Value == type);\n\t\t\t}\n\t\t\tset\n\t\t\t{\n\t\t\t\tif (value.Value != SelectedType.Value)\n\t\t\t\t{\n\t\t\t\t\t_level.Type = ApplyBaseTypeFlag(value.Value, _level.Type);\n\t\t\t\t\tOnPropertyChanged(nameof(SelectedType));\n\n\t\t\t\t\tswitch (value.Value)\n\t\t\t\t\t{\n\t\t\t\t\t\tcase AssistBaseType.Disabled:\n\t\t\t\t\t\t\tTargetCurrentPercent = 0;\n\t\t\t\t\t\t\tMaxThrottlePercent = 0;\n\t\t\t\t\t\t\tMaxSpeedPercent = 0;\n\t\t\t\t\t\t\tTorqueAmplificationFactor = 0;\n\t\t\t\t\t\t\t_level.Type = ClearThrottleFlag(_level.Type);\n\t\t\t\t\t\t\t_level.Type = ClearPasVariantFlag(_level.Type);\n\t\t\t\t\t\t\tIsThrottleCadenceOverrideEnabled = false;\n\t\t\t\t\t\t\tIsThrottleSpeedOverrideEnabled = false;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase AssistBaseType.Throttle:\n\t\t\t\t\t\t\tTargetCurrentPercent = 0;\n\t\t\t\t\t\t\tTorqueAmplificationFactor = 0;\n\t\t\t\t\t\t\tTargetCurrentPercent = 0;\n\t\t\t\t\t\t\t_level.Type = ClearPasVariantFlag(_level.Type);\n\t\t\t\t\t\t\tIsThrottleCadenceOverrideEnabled = false;\n\t\t\t\t\t\t\tIsThrottleSpeedOverrideEnabled = false;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase AssistBaseType.Pas:\n\t\t\t\t\t\t\tMaxThrottlePercent = 0;\n\t\t\t\t\t\t\t_level.Type = ClearThrottleFlag(_level.Type);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tpublic ValueItemViewModel<AssistPasVariant> SelectedPasVariant\n\t\t{\n\t\t\tget\n\t\t\t{\n\t\t\t\tvar variant = AssistPasVariant.Cadence;\n\t\t\t\tif (_level.Type.HasFlag(Configuration.AssistFlagsType.PasTorque))\n\t\t\t\t{\n\t\t\t\t\tvariant = AssistPasVariant.Torque;\n\t\t\t\t}\n\t\t\t\telse if (_level.Type.HasFlag(Configuration.AssistFlagsType.PasVariable))\n\t\t\t\t{\n\t\t\t\t\tvariant = AssistPasVariant.Variable;\n\t\t\t\t}\n\n\t\t\t\treturn AssistPasVariantOptions.FirstOrDefault((e) => e.Value == variant);\n\t\t\t}\n\t\t\tset\n\t\t\t{\n\t\t\t\tif (value.Value != SelectedPasVariant.Value)\n\t\t\t\t{\n\t\t\t\t\t_level.Type = ApplyPasVariantFlag(value.Value, _level.Type);\n\t\t\t\t\tOnPropertyChanged(nameof(SelectedPasVariant));\n\t\t\t\t\tOnPropertyChanged(nameof(IsPasAssistVariableVariant));\n\t\t\t\t\tOnPropertyChanged(nameof(IsPasAssistTorqueVariant));\n\n\t\t\t\t\tswitch(value.Value)\n\t\t\t\t\t{\n\t\t\t\t\t\tcase AssistPasVariant.Variable:\n\t\t\t\t\t\t\tTorqueAmplificationFactor = 0;\n\t\t\t\t\t\t\tIsThrottleEnabled = false;\n\t\t\t\t\t\t\tIsThrottleCadenceOverrideEnabled = false;\n\t\t\t\t\t\t\tIsThrottleSpeedOverrideEnabled = false;\n\t\t\t\t\t\t\tMaxThrottlePercent = 0;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase AssistPasVariant.Cadence:\n\t\t\t\t\t\t\tTorqueAmplificationFactor = 0;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tpublic bool IsThrottleEnabled\n\t\t{\n\t\t\tget { return _level.Type.HasFlag(Configuration.AssistFlagsType.Throttle); }\n\t\t\tset\n\t\t\t{\n\t\t\t\tif (value != IsThrottleEnabled)\n\t\t\t\t{\n\t\t\t\t\t_level.Type = ApplyThrottleFlag(value, _level.Type);\n\t\t\t\t\tOnPropertyChanged(nameof(IsThrottleEnabled));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tpublic bool IsThrottleCadenceOverrideEnabled\n\t\t{\n\t\t\tget { return _level.Type.HasFlag(Configuration.AssistFlagsType.CadenceOverride); }\n\t\t\tset\n\t\t\t{\n\t\t\t\tif (value != IsThrottleCadenceOverrideEnabled)\n\t\t\t\t{\n\t\t\t\t\t_level.Type = ApplyThrottleCadenceOverrideFlag(value, _level.Type);\n\t\t\t\t\tOnPropertyChanged(nameof(IsThrottleCadenceOverrideEnabled));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tpublic bool IsThrottleSpeedOverrideEnabled\n\t\t{\n\t\t\tget { return _level.Type.HasFlag(Configuration.AssistFlagsType.SpeedOverride); }\n\t\t\tset\n\t\t\t{\n\t\t\t\tif (value != IsThrottleSpeedOverrideEnabled)\n\t\t\t\t{\n\t\t\t\t\t_level.Type = ApplyThrottleSpeedOverrideFlag(value, _level.Type);\n\t\t\t\t\tOnPropertyChanged(nameof(IsThrottleSpeedOverrideEnabled));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tpublic bool IsPasAssistVariableVariant\n\t\t{\n\t\t\tget { return _level.Type.HasFlag(Configuration.AssistFlagsType.PasVariable); }\n\t\t}\n\n\t\tpublic bool IsPasAssistTorqueVariant\n\t\t{\n\t\t\tget { return _level.Type.HasFlag(Configuration.AssistFlagsType.PasTorque); }\n\t\t}\n\n\n\n\t\tpublic uint TargetCurrentPercent\n\t\t{\n\t\t\tget { return _level.MaxCurrentPercent; }\n\t\t\tset\n\t\t\t{\n\t\t\t\tif (_level.MaxCurrentPercent != value)\n\t\t\t\t{\n\t\t\t\t\t_level.MaxCurrentPercent = value;\n\t\t\t\t\tOnPropertyChanged(nameof(TargetCurrentPercent));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tpublic uint MaxThrottlePercent\n\t\t{\n\t\t\tget { return _level.MaxThrottlePercent; }\n\t\t\tset\n\t\t\t{\n\t\t\t\tif (_level.MaxThrottlePercent != value)\n\t\t\t\t{\n\t\t\t\t\t_level.MaxThrottlePercent = value;\n\t\t\t\t\tOnPropertyChanged(nameof(MaxThrottlePercent));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tpublic uint MaxCadencePercent\n\t\t{\n\t\t\tget { return _level.MaxCadencePercent; }\n\t\t\tset\n\t\t\t{\n\t\t\t\tif (_level.MaxCadencePercent != value)\n\t\t\t\t{\n\t\t\t\t\t_level.MaxCadencePercent = value;\n\t\t\t\t\tOnPropertyChanged(nameof(MaxCadencePercent));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tpublic uint MaxSpeedPercent\n\t\t{\n\t\t\tget { return _level.MaxSpeedPercent; }\n\t\t\tset\n\t\t\t{\n\t\t\t\tif (_level.MaxSpeedPercent != value)\n\t\t\t\t{\n\t\t\t\t\t_level.MaxSpeedPercent = value;\n\t\t\t\t\tOnPropertyChanged(nameof(MaxSpeedPercent));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tpublic float TorqueAmplificationFactor\n\t\t{\n\t\t\tget { return _level.TorqueAmplificationFactor; }\n\t\t\tset\n\t\t\t{\n\t\t\t\tif (_level.TorqueAmplificationFactor != value)\n\t\t\t\t{\n\t\t\t\t\t_level.TorqueAmplificationFactor = value;\n\t\t\t\t\tOnPropertyChanged(nameof(TorqueAmplificationFactor));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\n\t\tpublic AssistLevelViewModel(ConfigurationViewModel configVm, int id, Configuration.AssistLevel level)\n\t\t{\n\t\t\t_configVm = configVm;\n\t\t\t_id = id;\n\t\t\t_level = level;\n\t\t}\n\n\n\t\tprivate static Configuration.AssistFlagsType ApplyBaseTypeFlag(AssistBaseType baseType, Configuration.AssistFlagsType flags)\n\t\t{\n\t\t\tbyte f = (byte)flags;\n\t\t\tf &= (byte)~(Configuration.AssistFlagsType.Pas | Configuration.AssistFlagsType.Throttle | Configuration.AssistFlagsType.Cruise);\n\n\t\t\tvar result = (Configuration.AssistFlagsType)f;\n\t\t\tswitch (baseType)\n\t\t\t{\n\t\t\t\tcase AssistBaseType.Pas:\n\t\t\t\t\tresult |= Configuration.AssistFlagsType.Pas;\n\t\t\t\t\tbreak;\n\t\t\t\tcase AssistBaseType.Throttle:\n\t\t\t\t\tresult |= Configuration.AssistFlagsType.Throttle;\n\t\t\t\t\tbreak;\n\t\t\t\tcase AssistBaseType.Cruise:\n\t\t\t\t\tresult |= Configuration.AssistFlagsType.Cruise;\n\t\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\treturn result;\n\t\t}\n\n\t\tprivate static Configuration.AssistFlagsType ClearPasVariantFlag(Configuration.AssistFlagsType flags)\n\t\t{\n\t\t\tbyte f = (byte)flags;\n\t\t\tf &= (byte)~(Configuration.AssistFlagsType.PasTorque | Configuration.AssistFlagsType.PasVariable);\n\n\t\t\treturn (Configuration.AssistFlagsType)f;\n\t\t}\n\n\t\tprivate static Configuration.AssistFlagsType ApplyPasVariantFlag(AssistPasVariant pasVariant, Configuration.AssistFlagsType flags)\n\t\t{\n\t\t\tvar result = ClearPasVariantFlag(flags);\n\t\t\tswitch (pasVariant)\n\t\t\t{\n\t\t\t\tcase AssistPasVariant.Torque:\n\t\t\t\t\tresult |= Configuration.AssistFlagsType.PasTorque;\n\t\t\t\t\tbreak;\n\t\t\t\tcase AssistPasVariant.Variable:\n\t\t\t\t\tresult |= Configuration.AssistFlagsType.PasVariable;\n\t\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\treturn result;\n\t\t}\n\n\t\tprivate static Configuration.AssistFlagsType ClearThrottleFlag(Configuration.AssistFlagsType flags)\n\t\t{\n\t\t\tbyte f = (byte)flags;\n\t\t\tf &= (byte)~(Configuration.AssistFlagsType.Throttle);\n\n\t\t\treturn (Configuration.AssistFlagsType)f;\n\t\t}\n\n\t\tprivate static Configuration.AssistFlagsType ApplyThrottleFlag(bool enabled, Configuration.AssistFlagsType flags)\n\t\t{\n\t\t\tvar result = ClearThrottleFlag(flags);\n\t\t\tif (enabled)\n\t\t\t{\n\t\t\t\tresult |= Configuration.AssistFlagsType.Throttle;\n\t\t\t}\n\n\t\t\treturn result;\n\t\t}\n\n\t\tprivate static Configuration.AssistFlagsType ClearThrottleCadenceOverrideFlag(Configuration.AssistFlagsType flags)\n\t\t{\n\t\t\tbyte f = (byte)flags;\n\t\t\tf &= (byte)~(Configuration.AssistFlagsType.CadenceOverride);\n\n\t\t\treturn (Configuration.AssistFlagsType)f;\n\t\t}\n\n\t\tprivate static Configuration.AssistFlagsType ApplyThrottleCadenceOverrideFlag(bool enabled, Configuration.AssistFlagsType flags)\n\t\t{\n\t\t\tvar result = ClearThrottleCadenceOverrideFlag(flags);\n\t\t\tif (enabled)\n\t\t\t{\n\t\t\t\tresult |= Configuration.AssistFlagsType.CadenceOverride;\n\t\t\t}\n\n\t\t\treturn result;\n\t\t}\n\n\t\tprivate static Configuration.AssistFlagsType ClearThrottleSpeedOverrideFlag(Configuration.AssistFlagsType flags)\n\t\t{\n\t\t\tbyte f = (byte)flags;\n\t\t\tf &= (byte)~(Configuration.AssistFlagsType.SpeedOverride);\n\n\t\t\treturn (Configuration.AssistFlagsType)f;\n\t\t}\n\n\t\tprivate static Configuration.AssistFlagsType ApplyThrottleSpeedOverrideFlag(bool enabled, Configuration.AssistFlagsType flags)\n\t\t{\n\t\t\tvar result = ClearThrottleSpeedOverrideFlag(flags);\n\t\t\tif (enabled)\n\t\t\t{\n\t\t\t\tresult |= Configuration.AssistFlagsType.SpeedOverride;\n\t\t\t}\n\n\t\t\treturn result;\n\t\t}\n\n\t}\n}\n"
  },
  {
    "path": "src/tool/ViewModel/AssistLevelsViewModel.cs",
    "content": "using BBSFW.ViewModel.Base;\nusing System.Collections.Generic;\n\n\nnamespace BBSFW.ViewModel\n{\n\tpublic class AssistLevelsViewModel : ObservableObject\n\t{\n\n\t\tpublic enum OperationMode\n\t\t{\n\t\t\tStandard,\n\t\t\tSport\n\t\t}\n\n\n\t\tpublic static List<ValueItemViewModel<OperationMode>> OperationModes { get; } =\n\t\t\tnew List<ValueItemViewModel<OperationMode>>\n\t\t\t{\n\t\t\t\tnew ValueItemViewModel<OperationMode>(OperationMode.Standard, \"Standard\"),\n\t\t\t\tnew ValueItemViewModel<OperationMode>(OperationMode.Sport, \"Sport\")\n\t\t\t};\n\n\n\t\tprivate ConfigurationViewModel _configVm;\n\t\tpublic ConfigurationViewModel ConfigVm\n\t\t{\n\t\t\tget { return _configVm; }\n\t\t}\n\n\n\t\tprivate ValueItemViewModel<OperationMode> _selectedOperationModePage;\n\t\tpublic ValueItemViewModel<OperationMode> SelectedOperationModePage\n\t\t{\n\t\t\tget { return _selectedOperationModePage; }\n\t\t\tset\n\t\t\t{\n\t\t\t\tif (_selectedOperationModePage != value)\n\t\t\t\t{\n\t\t\t\t\t_selectedOperationModePage = value;\n\t\t\t\t\tOnPropertyChanged(nameof(SelectedOperationModePage));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tprivate AssistLevelViewModel _selectedAssistLevel;\n\t\tpublic AssistLevelViewModel SelectedAssistLevel\n\t\t{\n\t\t\tget { return _selectedAssistLevel; }\n\t\t\tset\n\t\t\t{\n\t\t\t\tif (_selectedAssistLevel != value)\n\t\t\t\t{\n\t\t\t\t\t_selectedAssistLevel = value;\n\t\t\t\t\tOnPropertyChanged(nameof(SelectedAssistLevel));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tpublic AssistLevelsViewModel(ConfigurationViewModel config)\n\t\t{\n\t\t\t_configVm = config;\n\t\t\tSelectedOperationModePage = OperationModes[0];\n\t\t}\n\n\t}\n}\n"
  },
  {
    "path": "src/tool/ViewModel/Base/DelegateCommand.cs",
    "content": "using System;\nusing System.Windows.Input;\n\nnamespace BBSFW.ViewModel.Base\n{\n\tpublic class DelegateCommand : ICommand\n\t{\n\t\tprivate readonly Action _action;\n\t\tprivate readonly Action<object> _actionWithParam;\n\n\t\tpublic event EventHandler CanExecuteChanged;\n\n\t\tpublic DelegateCommand(Action action)\n\t\t{\n\t\t\t_action = action;\n\t\t\t_actionWithParam = null;\n\t\t}\n\n\t\tpublic DelegateCommand(Action<object> action)\n\t\t{\n\t\t\t_actionWithParam = action;\n\t\t\t_action = null;\n\t\t}\n\n\t\tpublic bool CanExecute(object parameter)\n\t\t{\n\t\t\treturn true;\n\t\t}\n\n\t\tpublic void Execute(object parameter)\n\t\t{\n\t\t\t_action?.Invoke();\n\t\t\t_actionWithParam?.Invoke(parameter);\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/tool/ViewModel/Base/ObservableObject.cs",
    "content": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.ComponentModel;\n\nnamespace BBSFW.ViewModel.Base\n{\n\tpublic class ObservableObject : INotifyPropertyChanged, INotifyDataErrorInfo\n\t{\n\n\t\t#region Private Members\n\n\t\tprivate Dictionary<string, string> _errors = new Dictionary<string, string>();\n\n\t\t#endregion\n\n\t\t#region Public Properties\n\n\t\tpublic bool HasErrors\n\t\t{\n\t\t\tget\n\t\t\t{\n\t\t\t\treturn _errors.Count > 0;\n\t\t\t}\n\t\t}\n\n\t\t#endregion\n\n\t\t#region Public events\n\n\t\tpublic event EventHandler<DataErrorsChangedEventArgs> ErrorsChanged;\n\t\tpublic event PropertyChangedEventHandler PropertyChanged;\n\n\t\t#endregion\n\n\t\t#region Public Functions\n\n\t\tpublic void AddError(string propertyName, string error)\n\t\t{\n\t\t\tif (!_errors.ContainsKey(propertyName) || _errors[propertyName] != error)\n\t\t\t{\n\t\t\t\t_errors[propertyName] = error;\n\t\t\t\tErrorsChanged?.Invoke(this, new DataErrorsChangedEventArgs(propertyName));\n\t\t\t}\n\t\t}\n\n\t\tpublic void RemoveError(string propertyName)\n\t\t{\n\t\t\tif (_errors.Remove(propertyName))\n\t\t\t{\n\t\t\t\tErrorsChanged?.Invoke(this, new DataErrorsChangedEventArgs(propertyName));\n\t\t\t}\n\t\t}\n\n\t\tpublic string GetError(string propertyName)\n\t\t{\n\t\t\tif (_errors.ContainsKey(propertyName))\n\t\t\t{\n\t\t\t\treturn _errors[propertyName];\n\t\t\t}\n\n\t\t\treturn null;\n\t\t}\n\n\t\tpublic bool HasError(string propertyName)\n\t\t{\n\t\t\treturn _errors.ContainsKey(propertyName);\n\t\t}\n\n\t\tpublic IEnumerable GetErrors(string propertyName)\n\t\t{\n\t\t\tif (propertyName == null)\n\t\t\t\treturn null;\n\n\t\t\tList<string> err = new List<string>();\n\t\t\tif (_errors.ContainsKey(propertyName))\n\t\t\t{\n\t\t\t\terr.Add(_errors[propertyName]);\n\t\t\t}\n\n\t\t\treturn err;\n\t\t}\n\n\t\t#endregion\n\n\t\t#region Protected Functions\n\n\t\tprotected void OnPropertyChanged(string propertyName)\n\t\t{\n\t\t\tPropertyChanged?.Invoke(this,\n\t\t\t\tnew PropertyChangedEventArgs(propertyName));\n\t\t}\n\n\t\t#endregion\n\n\t}\n}\n"
  },
  {
    "path": "src/tool/ViewModel/CalibrationViewModel.cs",
    "content": "using BBSFW.ViewModel.Base;\nusing System;\nusing System.Windows;\nusing System.Windows.Input;\n\nnamespace BBSFW.ViewModel\n{\n\tpublic class CalibrationViewModel : ObservableObject\n\t{\n\t\tprivate ConnectionViewModel _connectionVm;\n\n\t\tprivate float _batteryStatusVolts;\n\t\tpublic float BatteryStatusVolts\n\t\t{\n\t\t\tget { return _batteryStatusVolts; }\n\t\t\tset\n\t\t\t{\n\t\t\t\tif (_batteryStatusVolts != value)\n\t\t\t\t{\n\t\t\t\t\t_batteryStatusVolts = value;\n\t\t\t\t\tOnPropertyChanged(nameof(BatteryStatusVolts));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tprivate float _measuredBatteryVolts;\n\t\tpublic float MeasuredBatteryVolts\n\t\t{\n\t\t\tget { return _measuredBatteryVolts; }\n\t\t\tset\n\t\t\t{\n\t\t\t\tif (_measuredBatteryVolts != value)\n\t\t\t\t{\n\t\t\t\t\t_measuredBatteryVolts = value;\n\t\t\t\t\tOnPropertyChanged(nameof(MeasuredBatteryVolts));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\n\t\tpublic ICommand SaveVoltageCommand\n\t\t{\n\t\t\tget { return new DelegateCommand(OnSaveVoltageCalibration); }\n\t\t}\n\n\t\tpublic ICommand ResetVoltageCommand\n\t\t{\n\t\t\tget { return new DelegateCommand(OnResetVoltageCalibration); }\n\t\t}\n\n\n\t\tpublic CalibrationViewModel(ConnectionViewModel connectionVm)\n\t\t{\n\t\t\t_connectionVm = connectionVm;\n\t\t}\n\n\n\t\tprivate async void OnSaveVoltageCalibration()\n\t\t{\n\t\t\tif (!_connectionVm.IsConnected)\n\t\t\t{\n\t\t\t\tMessageBox.Show(\"Not Connected!\", \"Error\", MessageBoxButton.OK, MessageBoxImage.Error);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (MeasuredBatteryVolts < 1 || MeasuredBatteryVolts > 100)\n\t\t\t{\n\t\t\t\tMessageBox.Show(\"Measured Battery Voltage must be in range [1, 100]\", \"Error\", MessageBoxButton.OK, MessageBoxImage.Error);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tvar res = await _connectionVm.GetConnection().CalibrateBatteryVoltage(MeasuredBatteryVolts, TimeSpan.FromSeconds(3));\n\t\t\tif (!res.Timeout)\n\t\t\t{\n\t\t\t\tif (res.Result)\n\t\t\t\t{\n\t\t\t\t\tMessageBox.Show(\"Voltage calibration saved!\", \"Success\", MessageBoxButton.OK, MessageBoxImage.Information);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tMessageBox.Show(\"Failed to save voltage calibration, check log.\", \"Error\", MessageBoxButton.OK, MessageBoxImage.Error);\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tMessageBox.Show(\"Failed to save voltage calibration, timeout occured.\", \"Error\", MessageBoxButton.OK, MessageBoxImage.Error);\n\t\t\t}\n\t\t}\n\n\t\tprivate async void OnResetVoltageCalibration()\n\t\t{\n\t\t\tif (!_connectionVm.IsConnected)\n\t\t\t{\n\t\t\t\tMessageBox.Show(\"Not Connected!\", \"Error\", MessageBoxButton.OK, MessageBoxImage.Error);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tvar res = await _connectionVm.GetConnection().CalibrateBatteryVoltage(0f, TimeSpan.FromSeconds(3));\n\t\t\tif (!res.Timeout)\n\t\t\t{\n\t\t\t\tif (res.Result)\n\t\t\t\t{\n\t\t\t\t\tMessageBox.Show(\"Voltage calibration reset!\", \"Success\", MessageBoxButton.OK, MessageBoxImage.Information);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tMessageBox.Show(\"Failed to reset voltage calibration, check log.\", \"Error\", MessageBoxButton.OK, MessageBoxImage.Error);\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tMessageBox.Show(\"Failed to reset voltage calibration, timeout occured.\", \"Error\", MessageBoxButton.OK, MessageBoxImage.Error);\n\t\t\t}\n\t\t}\n\n\t}\n}\n"
  },
  {
    "path": "src/tool/ViewModel/ConfigurationViewModel.cs",
    "content": "using BBSFW.Model;\nusing BBSFW.ViewModel.Base;\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace BBSFW.ViewModel\n{\n\tpublic class ConfigurationViewModel : ObservableObject\n\t{\n\t\tprivate Configuration _config;\n\n\t\tpublic static List<uint> PasStartDelayOptions { get; } =\n\t\t\tnew List<uint>() {\n\t\t\t\t0, 15, 30, 45, 60, 75, 90, 105, 120, 135, 150, 165, 180,\n\t\t\t\t195, 210, 225, 240, 255, 270, 285, 300, 315, 330, 345, 360\n\t\t\t};\n\n\t\tpublic static List<Configuration.TemperatureSensor> TemperatureSensorOptions\n\t\t{\n\t\t\tget\n\t\t\t{\n\t\t\t\treturn Enum.GetValues<Configuration.TemperatureSensor>().ToList();\n\t\t\t}\n\t\t}\n\n\t\tpublic static List<uint> StartupAssistLevelOptions { get; } =\n\t\t\tnew List<uint>() { 0, 1, 2, 3, 4, 5, 6, 7 ,8, 9 };\n\n\t\tpublic static List<ValueItemViewModel<Configuration.AssistModeSelect>> AssistModeSelectOptions { get; } =\n\t\t\tnew List<ValueItemViewModel<Configuration.AssistModeSelect>>\n\t\t\t{\n\t\t\t\tnew ValueItemViewModel<Configuration.AssistModeSelect>(Configuration.AssistModeSelect.Off, \"Off\"),\n\t\t\t\tnew ValueItemViewModel<Configuration.AssistModeSelect>(Configuration.AssistModeSelect.Standard, \"Sport Button\"),\n\t\t\t\tnew ValueItemViewModel<Configuration.AssistModeSelect>(Configuration.AssistModeSelect.Lights, \"Lights Button\"),\n\t\t\t\tnew ValueItemViewModel<Configuration.AssistModeSelect>(Configuration.AssistModeSelect.BrakesOnBoot, \"Brakes @ Power On\"),\n\t\t\t\tnew ValueItemViewModel<Configuration.AssistModeSelect>(Configuration.AssistModeSelect.Pas0AndLights, \"PAS 0 + Lights Button\"),\n\t\t\t\tnew ValueItemViewModel<Configuration.AssistModeSelect>(Configuration.AssistModeSelect.Pas1AndLights, \"PAS 1 + Lights Button\"),\n\t\t\t\tnew ValueItemViewModel<Configuration.AssistModeSelect>(Configuration.AssistModeSelect.Pas2AndLights, \"PAS 2 + Lights Button\"),\n\t\t\t\tnew ValueItemViewModel<Configuration.AssistModeSelect>(Configuration.AssistModeSelect.Pas3AndLights, \"PAS 3 + Lights Button\"),\n\t\t\t\tnew ValueItemViewModel<Configuration.AssistModeSelect>(Configuration.AssistModeSelect.Pas4AndLights, \"PAS 4 + Lights Button\"),\n\t\t\t\tnew ValueItemViewModel<Configuration.AssistModeSelect>(Configuration.AssistModeSelect.Pas5AndLights, \"PAS 5 + Lights Button\"),\n\t\t\t\tnew ValueItemViewModel<Configuration.AssistModeSelect>(Configuration.AssistModeSelect.Pas6AndLights, \"PAS 6 + Lights Button\"),\n\t\t\t\tnew ValueItemViewModel<Configuration.AssistModeSelect>(Configuration.AssistModeSelect.Pas7AndLights, \"PAS 7 + Lights Button\"),\n\t\t\t\tnew ValueItemViewModel<Configuration.AssistModeSelect>(Configuration.AssistModeSelect.Pas8AndLights, \"PAS 8 + Lights Button\"),\n\t\t\t\tnew ValueItemViewModel<Configuration.AssistModeSelect>(Configuration.AssistModeSelect.Pas9AndLights, \"PAS 9 + Lights Button\"),\n\t\t\t};\n\n\t\tpublic static List<ValueItemViewModel<Configuration.WalkModeData>> WalkModeDataDisplayOptions { get; } =\n\t\t\tnew List<ValueItemViewModel<Configuration.WalkModeData>>\n\t\t\t{\n\t\t\t\tnew ValueItemViewModel<Configuration.WalkModeData>(Configuration.WalkModeData.Speed, \"Speed\"),\n\t\t\t\tnew ValueItemViewModel<Configuration.WalkModeData>(Configuration.WalkModeData.Temperature, \"Temperature (C)\"),\n\t\t\t\tnew ValueItemViewModel<Configuration.WalkModeData>(Configuration.WalkModeData.RequestedPower, \"Requested Power (%)\"),\n\t\t\t\tnew ValueItemViewModel<Configuration.WalkModeData>(Configuration.WalkModeData.BatteryPercent, \"Battery Level (%)\")\n\t\t\t};\n\n\t\tpublic static List<ValueItemViewModel<Configuration.ThrottleGlobalSpeedLimitOptions>> ThrottleGlobalSpeedLimitOptions { get; } =\n\t\t\tnew List<ValueItemViewModel<Configuration.ThrottleGlobalSpeedLimitOptions>>\n\t\t\t{\n\t\t\t\tnew ValueItemViewModel<Configuration.ThrottleGlobalSpeedLimitOptions>(Configuration.ThrottleGlobalSpeedLimitOptions.Disabled, \"Disabled\"),\n\t\t\t\tnew ValueItemViewModel<Configuration.ThrottleGlobalSpeedLimitOptions>(Configuration.ThrottleGlobalSpeedLimitOptions.Enabled, \"Enabled\"),\n\t\t\t\tnew ValueItemViewModel<Configuration.ThrottleGlobalSpeedLimitOptions>(Configuration.ThrottleGlobalSpeedLimitOptions.StandardLevels, \"Standard Levels\"),\n\t\t\t};\n\n\t\tpublic static List<ValueItemViewModel<Configuration.LightsModeOptions>> LightsModeOptions { get; } =\n\t\t\tnew List<ValueItemViewModel<Configuration.LightsModeOptions>>\n\t\t\t{\n\t\t\t\tnew ValueItemViewModel<Configuration.LightsModeOptions>(Configuration.LightsModeOptions.Default, \"Default\"),\n\t\t\t\tnew ValueItemViewModel<Configuration.LightsModeOptions>(Configuration.LightsModeOptions.Disabled, \"Disabled\"),\n\t\t\t\tnew ValueItemViewModel<Configuration.LightsModeOptions>(Configuration.LightsModeOptions.AlwaysOn, \"Always On\"),\n\t\t\t\tnew ValueItemViewModel<Configuration.LightsModeOptions>(Configuration.LightsModeOptions.BrakeLight, \"Brake Light\"),\n\t\t\t};\n\n\n\t\t// support \n\n\t\tpublic bool IsTorqueSensorSupported\n\t\t{\n\t\t\tget { return _config.IsFeatureSupported(Configuration.Feature.TorqueSensor); }\n\t\t}\n\n\t\tpublic bool IsShiftSensorSupported\n\t\t{\n\t\t\tget { return _config.IsFeatureSupported(Configuration.Feature.ShiftSensor); }\n\t\t}\n\n\n\t\t// configuration\n\n\t\tpublic bool UseMetricUnits\n\t\t{\n\t\t\tget\n\t\t\t{\n\t\t\t\treturn !_config.UseFreedomUnits;\n\t\t\t}\n\t\t\tset\n\t\t\t{\n\t\t\t\tif (_config.UseFreedomUnits == value)\n\t\t\t\t{\n\t\t\t\t\t_config.UseFreedomUnits = !value;\n\n\t\t\t\t\tProperties.Settings.Default.UseFreedomUnits = _config.UseFreedomUnits;\n\t\t\t\t\tProperties.Settings.Default.Save();\n\n\t\t\t\t\tOnPropertyChanged(nameof(UseImperialUnits));\n\t\t\t\t\tOnPropertyChanged(nameof(UseMetricUnits));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tpublic bool UseImperialUnits\n\t\t{\n\t\t\tget\n\t\t\t{\n\t\t\t\treturn _config.UseFreedomUnits;\n\t\t\t}\n\t\t\tset\n\t\t\t{\n\t\t\t\tif (_config.UseFreedomUnits != value)\n\t\t\t\t{\n\t\t\t\t\t_config.UseFreedomUnits = value;\n\n\t\t\t\t\tProperties.Settings.Default.UseFreedomUnits = _config.UseFreedomUnits;\n\t\t\t\t\tProperties.Settings.Default.Save();\n\n\t\t\t\t\tOnPropertyChanged(nameof(UseImperialUnits));\n\t\t\t\t\tOnPropertyChanged(nameof(UseMetricUnits));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tpublic uint MaxCurrentAmps\n\t\t{\n\t\t\tget { return _config.MaxCurrentAmps; }\n\t\t\tset\n\t\t\t{\n\t\t\t\tif (_config.MaxCurrentAmps != value)\n\t\t\t\t{\n\t\t\t\t\t_config.MaxCurrentAmps = value;\n\t\t\t\t\tOnPropertyChanged(nameof(MaxCurrentAmps));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tpublic uint CurrentRampAmpsSecond\n\t\t{\n\t\t\tget { return _config.CurrentRampAmpsSecond; }\n\t\t\tset\n\t\t\t{\n\t\t\t\tif (_config.CurrentRampAmpsSecond != value)\n\t\t\t\t{\n\t\t\t\t\t_config.CurrentRampAmpsSecond = value;\n\t\t\t\t\tOnPropertyChanged(nameof(CurrentRampAmpsSecond));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tpublic float MaxBatteryVolts\n\t\t{\n\t\t\tget { return _config.MaxBatteryVolts; }\n\t\t\tset\n\t\t\t{\n\t\t\t\tif (_config.MaxBatteryVolts != value)\n\t\t\t\t{\n\t\t\t\t\t_config.MaxBatteryVolts = value;\n\t\t\t\t\tOnPropertyChanged(nameof(MaxBatteryVolts));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tpublic uint LowCutoffVolts\n\t\t{\n\t\t\tget { return _config.LowCutoffVolts; }\n\t\t\tset\n\t\t\t{\n\t\t\t\tif (_config.LowCutoffVolts != value)\n\t\t\t\t{\n\t\t\t\t\t_config.LowCutoffVolts = value;\n\t\t\t\t\tOnPropertyChanged(nameof(LowCutoffVolts));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tpublic uint MaxSpeedKph\n\t\t{\n\t\t\tget { return _config.MaxSpeedKph; }\n\t\t\tset\n\t\t\t{\n\t\t\t\tif (_config.MaxSpeedKph != value)\n\t\t\t\t{\n\t\t\t\t\t_config.MaxSpeedKph = value;\n\t\t\t\t\tOnPropertyChanged(nameof(MaxSpeedKph));\n\t\t\t\t\tOnPropertyChanged(nameof(MaxSpeedMph));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tpublic uint MaxSpeedMph\n\t\t{\n\t\t\tget { return KphToMph(_config.MaxSpeedKph); }\n\t\t\tset\n\t\t\t{\n\t\t\t\tif (_config.MaxSpeedKph != MphToKph(value))\n\t\t\t\t{\n\t\t\t\t\t_config.MaxSpeedKph = MphToKph(value);\n\t\t\t\t\tOnPropertyChanged(nameof(MaxSpeedKph));\n\t\t\t\t\tOnPropertyChanged(nameof(MaxSpeedMph));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tpublic bool UseSpeedSensor\n\t\t{\n\t\t\tget { return _config.UseSpeedSensor; }\n\t\t\tset\n\t\t\t{\n\t\t\t\tif (_config.UseSpeedSensor != value)\n\t\t\t\t{\n\t\t\t\t\t_config.UseSpeedSensor = value;\n\t\t\t\t\tOnPropertyChanged(nameof(UseSpeedSensor));\n\t\t\t\t}\n\n\t\t\t\t// Require use of speed sensor for pretension feature.\n\t\t\t\tif (_config.UseSpeedSensor == false)\n\t\t\t\t{\n\t\t\t\t\t_config.UsePretension = false;\n\t\t\t\t\tOnPropertyChanged(nameof(UsePretension));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tpublic bool UseShiftSensor\n\t\t{\n\t\t\tget { return _config.UseShiftSensor; }\n\t\t\tset\n\t\t\t{\n\t\t\t\tif (_config.UseShiftSensor != value)\n\t\t\t\t{\n\t\t\t\t\t_config.UseShiftSensor = value;\n\t\t\t\t\tOnPropertyChanged(nameof(UseShiftSensor));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tpublic bool UsePushWalk\n\t\t{\n\t\t\tget { return _config.UsePushWalk; }\n\t\t\tset\n\t\t\t{\n\t\t\t\tif (_config.UsePushWalk != value)\n\t\t\t\t{\n\t\t\t\t\t_config.UsePushWalk = value;\n\t\t\t\t\tOnPropertyChanged(nameof(UsePushWalk));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tpublic bool UsePretension\n\t\t{\n\t\t\tget { return _config.UsePretension; }\n\t\t\tset\n\t\t\t{\n\t\t\t\tif (_config.UsePretension != value)\n\t\t\t\t{\n\t\t\t\t\t_config.UsePretension = value;\n\t\t\t\t\tOnPropertyChanged(nameof(UsePretension));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tpublic uint PretensionSpeedCutoffKph\n\t\t{\n\t\t\tget { return _config.PretensionSpeedCutoffKph; }\n\t\t\tset\n\t\t\t{\n\t\t\t\tif (_config.PretensionSpeedCutoffKph != value)\n\t\t\t\t{\n\t\t\t\t\t_config.PretensionSpeedCutoffKph = value;\n\t\t\t\t\tOnPropertyChanged(nameof(PretensionSpeedCutoffKph));\n\t\t\t\t\tOnPropertyChanged(nameof(PretensionSpeedCutoffMph));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tpublic uint PretensionSpeedCutoffMph\n\t\t{\n\t\t\tget { return KphToMph(_config.PretensionSpeedCutoffKph); }\n\t\t\tset\n\t\t\t{\n\t\t\t\tif (_config.PretensionSpeedCutoffKph != MphToKph(value))\n\t\t\t\t{\n\t\t\t\t\t_config.PretensionSpeedCutoffKph = MphToKph(value);\n\t\t\t\t\tOnPropertyChanged(nameof(PretensionSpeedCutoffKph));\n\t\t\t\t\tOnPropertyChanged(nameof(PretensionSpeedCutoffMph));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tpublic Configuration.TemperatureSensor UseTemperatureSensor\n\t\t{\n\t\t\tget { return _config.UseTemperatureSensor; }\n\t\t\tset\n\t\t\t{\n\t\t\t\tif (_config.UseTemperatureSensor != value)\n\t\t\t\t{\n\t\t\t\t\t_config.UseTemperatureSensor = value;\n\t\t\t\t\tOnPropertyChanged(nameof(UseTemperatureSensor));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tpublic ValueItemViewModel<Configuration.LightsModeOptions> LightsMode\n\t\t{\n\t\t\tget\n\t\t\t{\n\t\t\t\treturn LightsModeOptions.FirstOrDefault((e) => e.Value == _config.LightsMode);\n\t\t\t}\n\t\t\tset\n\t\t\t{\n\t\t\t\tif (_config.LightsMode != value.Value)\n\t\t\t\t{\n\t\t\t\t\t_config.LightsMode = value.Value;\n\t\t\t\t\tOnPropertyChanged(nameof(LightsMode));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tpublic uint ThrottleStartVoltageMillivolts\n\t\t{\n\t\t\tget { return _config.ThrottleStartMillivolts; }\n\t\t\tset\n\t\t\t{\n\t\t\t\tif (_config.ThrottleStartMillivolts != value)\n\t\t\t\t{\n\t\t\t\t\t_config.ThrottleStartMillivolts = value;\n\t\t\t\t\tOnPropertyChanged(nameof(ThrottleStartVoltageMillivolts));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tpublic uint ThrottleEndVoltageMillivolts\n\t\t{\n\t\t\tget { return _config.ThrottleEndMillivolts; }\n\t\t\tset\n\t\t\t{\n\t\t\t\tif (_config.ThrottleEndMillivolts != value)\n\t\t\t\t{\n\t\t\t\t\t_config.ThrottleEndMillivolts = value;\n\t\t\t\t\tOnPropertyChanged(nameof(ThrottleEndVoltageMillivolts));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tpublic uint ThrottleStartCurrentPercent\n\t\t{\n\t\t\tget { return _config.ThrottleStartPercent; }\n\t\t\tset\n\t\t\t{\n\t\t\t\tif (_config.ThrottleStartPercent != value)\n\t\t\t\t{\n\t\t\t\t\t_config.ThrottleStartPercent = value;\n\t\t\t\t\tOnPropertyChanged(nameof(ThrottleStartCurrentPercent));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tpublic ValueItemViewModel<Configuration.ThrottleGlobalSpeedLimitOptions> ThrottleGlobalSpeedLimit\n\t\t{\n\t\t\tget\n\t\t\t{\n\t\t\t\treturn ThrottleGlobalSpeedLimitOptions.FirstOrDefault((e) => e.Value == _config.ThrottleGlobalSpeedLimit);\n\t\t\t}\n\t\t\tset\n\t\t\t{\n\t\t\t\tif (_config.ThrottleGlobalSpeedLimit != value.Value)\n\t\t\t\t{\n\t\t\t\t\t_config.ThrottleGlobalSpeedLimit = value.Value;\n\t\t\t\t\tOnPropertyChanged(nameof(ThrottleGlobalSpeedLimit));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tpublic uint ThrottleGlobalSpeedLimitPercent\n\t\t{\n\t\t\tget { return _config.ThrottleGlobalSpeedLimitPercent; }\n\t\t\tset\n\t\t\t{\n\t\t\t\tif (_config.ThrottleGlobalSpeedLimitPercent != value)\n\t\t\t\t{\n\t\t\t\t\t_config.ThrottleGlobalSpeedLimitPercent = value;\n\t\t\t\t\tOnPropertyChanged(nameof(ThrottleGlobalSpeedLimitPercent));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\n\n\t\tpublic uint PasStartDelayDegrees\n\t\t{\n\t\t\tget { return _config.PasStartDelayPulses * 15; }\n\t\t\tset\n\t\t\t{\n\t\t\t\tif (_config.PasStartDelayPulses * 15 != value)\n\t\t\t\t{\n\t\t\t\t\t_config.PasStartDelayPulses = value / 15;\n\t\t\t\t\tOnPropertyChanged(nameof(PasStartDelayDegrees));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tpublic uint PasStopDelayMilliseconds\n\t\t{\n\t\t\tget { return _config.PasStopDelayMilliseconds; }\n\t\t\tset\n\t\t\t{\n\t\t\t\tif (_config.PasStopDelayMilliseconds != value)\n\t\t\t\t{\n\t\t\t\t\t_config.PasStopDelayMilliseconds = value;\n\t\t\t\t\tOnPropertyChanged(nameof(PasStopDelayMilliseconds));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tpublic uint PasKeepCurrentPercent\n\t\t{\n\t\t\tget { return _config.PasKeepCurrentPercent; }\n\t\t\tset\n\t\t\t{\n\t\t\t\tif (_config.PasKeepCurrentPercent != value)\n\t\t\t\t{\n\t\t\t\t\t_config.PasKeepCurrentPercent = value;\n\t\t\t\t\tOnPropertyChanged(nameof(PasKeepCurrentPercent));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tpublic uint PasKeepCurrentCadenceRpm\n\t\t{\n\t\t\tget { return _config.PasKeepCurrentCadenceRpm; }\n\t\t\tset\n\t\t\t{\n\t\t\t\tif (_config.PasKeepCurrentCadenceRpm != value)\n\t\t\t\t{\n\t\t\t\t\t_config.PasKeepCurrentCadenceRpm = value;\n\t\t\t\t\tOnPropertyChanged(nameof(PasKeepCurrentCadenceRpm));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tpublic float WheelSizeInch\n\t\t{\n\t\t\tget { return _config.WheelSizeInch; }\n\t\t\tset\n\t\t\t{\n\t\t\t\tif (_config.WheelSizeInch != value)\n\t\t\t\t{\n\t\t\t\t\t_config.WheelSizeInch = value;\n\t\t\t\t\tOnPropertyChanged(nameof(WheelSizeInch));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tpublic uint SpeedSensorSignals\n\t\t{\n\t\t\tget { return _config.NumWheelSensorSignals; }\n\t\t\tset\n\t\t\t{\n\t\t\t\tif (_config.NumWheelSensorSignals != value)\n\t\t\t\t{\n\t\t\t\t\t_config.NumWheelSensorSignals = value;\n\t\t\t\t\tOnPropertyChanged(nameof(SpeedSensorSignals));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tpublic uint ShiftInterruptDuration\n\t\t{\n\t\t\tget { return _config.ShiftInterruptDuration; }\n\t\t\tset\n\t\t\t{\n\t\t\t\tif (_config.ShiftInterruptDuration != value)\n\t\t\t\t{\n\t\t\t\t\t_config.ShiftInterruptDuration = value;\n\t\t\t\t\tOnPropertyChanged(nameof(ShiftInterruptDuration));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tpublic uint ShiftInterruptCurrentThresholdPercent\n\t\t{\n\t\t\tget { return _config.ShiftInterruptCurrentThresholdPercent; }\n\t\t\tset\n\t\t\t{\n\t\t\t\tif (_config.ShiftInterruptCurrentThresholdPercent != value)\n\t\t\t\t{\n\t\t\t\t\t_config.ShiftInterruptCurrentThresholdPercent = value;\n\t\t\t\t\tOnPropertyChanged(nameof(ShiftInterruptCurrentThresholdPercent));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tpublic ValueItemViewModel<Configuration.WalkModeData> WalkModeDataDisplay\n\t\t{\n\t\t\tget\n\t\t\t{\n\t\t\t\treturn WalkModeDataDisplayOptions.FirstOrDefault((e) => e.Value == _config.WalkModeDataDisplay);\n\t\t\t}\n\t\t\tset\n\t\t\t{\n\t\t\t\tif (_config.WalkModeDataDisplay != value.Value)\n\t\t\t\t{\n\t\t\t\t\t_config.WalkModeDataDisplay = value.Value;\n\t\t\t\t\tOnPropertyChanged(nameof(WalkModeDataDisplay));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\n\t\tpublic uint StartupAssistLevel\n\t\t{\n\t\t\tget { return _config.AssistStartupLevel; }\n\t\t\tset\n\t\t\t{\n\t\t\t\tif (_config.AssistStartupLevel != value)\n\t\t\t\t{\n\t\t\t\t\t_config.AssistStartupLevel = value;\n\t\t\t\t\tOnPropertyChanged(nameof(StartupAssistLevel));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tpublic ValueItemViewModel<Configuration.AssistModeSelect> AssistModeSelection\n\t\t{\n\t\t\tget\n\t\t\t{\n\t\t\t\treturn AssistModeSelectOptions.FirstOrDefault((e) => e.Value ==  _config.AssistModeSelection);\n\t\t\t}\n\t\t\tset\n\t\t\t{\n\t\t\t\tif (_config.AssistModeSelection != value.Value)\n\t\t\t\t{\n\t\t\t\t\t_config.AssistModeSelection = value.Value;\n\t\t\t\t\tOnPropertyChanged(nameof(AssistModeSelection));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tprivate List<AssistLevelViewModel> _standardAssistLevels;\n\t\tpublic List<AssistLevelViewModel> StandardAssistLevels\n\t\t{\n\t\t\tget { return _standardAssistLevels; }\n\t\t\tprivate set\n\t\t\t{\n\t\t\t\tif (_standardAssistLevels != value)\n\t\t\t\t{\n\t\t\t\t\t_standardAssistLevels = value;\n\t\t\t\t\tOnPropertyChanged(nameof(StandardAssistLevels));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tprivate List<AssistLevelViewModel> _sportAssistLevels;\n\n\t\tpublic List<AssistLevelViewModel> SportAssistLevels\n\t\t{\n\t\t\tget { return _sportAssistLevels; }\n\t\t\tprivate set\n\t\t\t{\n\t\t\t\tif (_sportAssistLevels != value)\n\t\t\t\t{\n\t\t\t\t\t_sportAssistLevels = value;\n\t\t\t\t\tOnPropertyChanged(nameof(SportAssistLevels));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tpublic ConfigurationViewModel()\n\t\t{\n\t\t\t_config = new Configuration(BbsfwConnection.Controller.Unknown);\n\n\t\t\tStandardAssistLevels = new List<AssistLevelViewModel>();\n\t\t\tSportAssistLevels = new List<AssistLevelViewModel>();\n\t\t\t\n\t\t\tfor (int i = 0; i < _config.StandardAssistLevels.Length; ++i)\n\t\t\t{\n\t\t\t\t_standardAssistLevels.Add(new AssistLevelViewModel(this, i, _config.StandardAssistLevels[i]));\n\t\t\t}\n\n\t\t\tfor (int i = 0; i < _config.SportAssistLevels.Length; ++i)\n\t\t\t{\n\t\t\t\t_sportAssistLevels.Add(new AssistLevelViewModel(this, i, _config.SportAssistLevels[i]));\n\t\t\t}\n\t\t}\n\n\t\tpublic void ReadConfiguration(string filepath)\n\t\t{\n\t\t\t_config.ReadFromFile(filepath);\n\t\t\tTriggerPropertyChanges();\n\t\t}\n\n\t\tpublic void WriteConfiguration(string filepath)\n\t\t{\n\t\t\t_config.WriteToFile(filepath);\n\t\t}\n\n\t\tpublic void UpdateFrom(Configuration config)\n\t\t{\n\t\t\t_config.CopyFrom(config);\n\t\t\tTriggerPropertyChanges();\n\t\t}\n\n\t\tpublic Configuration GetConfig()\n\t\t{\n\t\t\treturn _config;\n\t\t}\n\n\t\tprivate static uint KphToMph(uint kph)\n\t\t{\n\t\t\treturn (uint)Math.Round(kph * 0.621371192);\n\t\t}\n\n\t\tprivate static uint MphToKph(uint mph)\n\t\t{\n\t\t\treturn (uint)Math.Round(mph * 1.609344);\n\t\t}\n\n\t\tprivate void TriggerPropertyChanges()\n\t\t{\n\t\t\tforeach (var prop in typeof(ConfigurationViewModel).GetProperties())\n\t\t\t{\n\t\t\t\tif (prop.GetGetMethod(false) != null)\n\t\t\t\t{\n\t\t\t\t\tOnPropertyChanged(prop.Name);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// force update by creating new list\n\t\t\tStandardAssistLevels = StandardAssistLevels.ToList();\n\t\t\tSportAssistLevels = SportAssistLevels.ToList();\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/tool/ViewModel/ConnectionViewModel.cs",
    "content": "using BBSFW.Model;\nusing BBSFW.ViewModel.Base;\nusing System;\nusing System.Collections.Generic;\nusing System.Windows;\nusing System.Windows.Input;\n\nnamespace BBSFW.ViewModel\n{\n\tpublic class ConnectionViewModel : ObservableObject\n\t{\n\n\t\tprivate BbsfwConnection _connection;\n\n\t\tprivate List<ComPort> _comPorts;\n\t\tpublic List<ComPort> ComPorts\n\t\t{\n\t\t\tget { return _comPorts; }\n\t\t\tset\n\t\t\t{\n\t\t\t\tif (_comPorts != value)\n\t\t\t\t{\n\t\t\t\t\t_comPorts = value;\n\t\t\t\t\tOnPropertyChanged(nameof(ComPorts));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tprivate ComPort _selectedComPort;\n\t\tpublic ComPort SelectedComPort\n\t\t{\n\t\t\tget { return _selectedComPort; }\n\t\t\tset\n\t\t\t{\n\t\t\t\tif (_selectedComPort != value)\n\t\t\t\t{\n\t\t\t\t\t_selectedComPort = value;\n\t\t\t\t\tOnPropertyChanged(nameof(SelectedComPort));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tprivate bool _isConnected;\n\t\tpublic bool IsConnected\n\t\t{\n\t\t\tget { return _isConnected; }\n\t\t\tset\n\t\t\t{\n\t\t\t\tif (_isConnected != value)\n\t\t\t\t{\n\t\t\t\t\t_isConnected = value;\n\t\t\t\t\tOnPropertyChanged(nameof(IsConnected));\n\t\t\t\t\tOnPropertyChanged(nameof(IsDisconnected));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tpublic bool IsDisconnected\n\t\t{\n\t\t\tget\n\t\t\t{\n\t\t\t\treturn !IsConnected;\n\t\t\t}\n\t\t}\n\n\t\tprivate bool _isConnecting;\n\t\tpublic bool IsConnecting\n\t\t{\n\t\t\tget { return _isConnecting; }\n\t\t\tset\n\t\t\t{\n\t\t\t\tif (_isConnecting != value)\n\t\t\t\t{\n\t\t\t\t\t_isConnecting = value;\n\t\t\t\t\tOnPropertyChanged(nameof(IsConnecting));\n\t\t\t\t}\t \n\t\t\t}\n\t\t}\n\n\n\t\tprivate BbsfwConnection.Controller _controller;\n\t\tpublic BbsfwConnection.Controller Controller\n\t\t{\n\t\t\tget { return _controller; }\n\t\t\tset\n\t\t\t{\n\t\t\t\tif (_controller != value)\n\t\t\t\t{\n\t\t\t\t\t_controller = value;\n\t\t\t\t\tOnPropertyChanged(nameof(Controller));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tprivate string _firmwareVersion = \"N/A\";\n\t\tpublic string FirmwareVersion\n\t\t{\n\t\t\tget\n\t\t\t{\n\t\t\t\treturn _firmwareVersion;\n\t\t\t}\n\t\t\tprivate set\n\t\t\t{\n\t\t\t\tif (_firmwareVersion != value)\n\t\t\t\t{\n\t\t\t\t\t_firmwareVersion = value;\n\t\t\t\t\tOnPropertyChanged(nameof(FirmwareVersion));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tprivate int _configVersion = 0;\n\t\tpublic int ConfigVersion\n\t\t{\n\t\t\tget\n\t\t\t{\n\t\t\t\treturn _configVersion;\n\t\t\t}\n\t\t\tprivate set\n\t\t\t{\n\t\t\t\tif (_configVersion != value)\n\t\t\t\t{\n\t\t\t\t\t_configVersion = value;\n\t\t\t\t\tOnPropertyChanged(nameof(ConfigVersion));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\n\t\tpublic event Action<EventLogEntry> EventLogReceived;\n\n\t\tpublic ICommand RefreshCommand\n\t\t{\n\t\t\tget\n\t\t\t{\n\t\t\t\treturn new DelegateCommand(OnRefresh);\n\t\t\t}\n\t\t}\n\n\n\t\tpublic ICommand ConnectCommand\n\t\t{\n\t\t\tget\n\t\t\t{\n\t\t\t\treturn new DelegateCommand(OnConnect);\n\t\t\t}\n\t\t}\n\n\t\tpublic ICommand DisconnectCommand\n\t\t{\n\t\t\tget\n\t\t\t{\n\t\t\t\treturn new DelegateCommand(OnDisconnect);\n\t\t\t}\n\t\t}\n\n\t\tpublic ConnectionViewModel()\n\t\t{\n\t\t\t_connection = new BbsfwConnection();\n\n\t\t\t_connection.Connected += OnConnected;\n\t\t\t_connection.Disconnected += OnDisconnected;\n\t\t\t_connection.EventLog += (e) =>\n\t\t\t{\n\t\t\t\tEventLogReceived?.Invoke(e);\n\t\t\t};\n\n\n\t\t\tComPorts = BbsfwConnection.GetComPorts();\n\t\t}\n\n\n\t\tpublic BbsfwConnection GetConnection()\n\t\t{\n\t\t\treturn _connection;\n\t\t}\n\n\n\t\tprivate void OnConnected(BbsfwConnection.Controller controller, string fwversion, int configVersion)\n\t\t{\n\t\t\tIsConnected = true;\n\t\t\tIsConnecting = false;\n\n\t\t\tController = controller;\n\t\t\tFirmwareVersion = fwversion;\n\t\t\tConfigVersion = configVersion;\n\t\t}\n\n\t\tprivate void OnDisconnected()\n\t\t{\n\t\t\tIsConnected = false;\n\t\t\tIsConnecting = false;\n\t\t\tFirmwareVersion = \"N/A\";\n\t\t\tConfigVersion = 0;\n\t\t}\n\n\t\tprivate void OnRefresh()\n\t\t{\n\t\t\tComPorts = BbsfwConnection.GetComPorts();\n\t\t\tOnPropertyChanged(nameof(ComPorts));\n\t\t}\n\n\t\tprivate async void OnConnect()\n\t\t{\n\t\t\tif (SelectedComPort != null)\n\t\t\t{\n\t\t\t\tIsConnecting = true;\n\n\t\t\t\ttry\n\t\t\t\t{\n\t\t\t\t\tvar connected = await _connection.Connect(SelectedComPort, TimeSpan.FromSeconds(120));\n\n\t\t\t\t\tif (!connected)\n\t\t\t\t\t{\n\t\t\t\t\t\tMessageBox.Show(\"Failed to connect, timeout occured.\", \"Error\", MessageBoxButton.OK, MessageBoxImage.Error);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcatch (Exception ex)\n\t\t\t\t{\n\t\t\t\t\tMessageBox.Show(ex.Message, \"Error\", MessageBoxButton.OK, MessageBoxImage.Error);\n\t\t\t\t\tIsConnected = false;\n\t\t\t\t\tIsConnecting = false;\n\t\t\t\t}\t\n\t\t\t}\n\t\t}\n\n\t\tprivate void OnDisconnect()\n\t\t{\n\t\t\t_connection.Close();\n\t\t}\n\n\t}\n}\n"
  },
  {
    "path": "src/tool/ViewModel/EventLogViewModel.cs",
    "content": "using BBSFW.Model;\nusing BBSFW.ViewModel.Base;\nusing System;\nusing System.Collections.Generic;\nusing System.Collections.ObjectModel;\nusing System.ComponentModel;\nusing System.IO;\nusing System.Windows;\nusing System.Windows.Data;\nusing System.Windows.Input;\n\nnamespace BBSFW.ViewModel\n{\n\tpublic class EventLogViewModel : ObservableObject\n\t{\n\n\t\tprivate ObservableCollection<EventLogEntry> _events = new ObservableCollection<EventLogEntry>();\n\t\tpublic ObservableCollection<EventLogEntry> LogEvents\n\t\t{\n\t\t\tget { return _events; }\n\t\t\tset\n\t\t\t{\n\t\t\t\tif (_events != value)\n\t\t\t\t{\n\t\t\t\t\t_events = value;\n\t\t\t\t\tOnPropertyChanged(nameof(LogEvents));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tprivate ICollectionView _filtedLogEvents;\n\t\tpublic ICollectionView FilteredLogEvents\n\t\t{\n\t\t\tget { return _filtedLogEvents; }\n\t\t}\n\n\n\t\tpublic IEnumerable<EventLogEntry.LogLevel> AvailableLogLevels\n\t\t{\n\t\t\tget { return new[] { EventLogEntry.LogLevel.Info, EventLogEntry.LogLevel.Warning, EventLogEntry.LogLevel.Error }; }\n\t\t}\n\n\t\tprivate EventLogEntry.LogLevel _selectedLogLevel;\n\t\tpublic EventLogEntry.LogLevel SelectedLogLevel\n\t\t{\n\t\t\tget { return _selectedLogLevel; }\n\t\t\tset\n\t\t\t{\n\t\t\t\tif (_selectedLogLevel != value)\n\t\t\t\t{\n\t\t\t\t\t_selectedLogLevel = value;\n\t\t\t\t\tOnPropertyChanged(nameof(SelectedLogLevel));\n\n\t\t\t\t\tFilteredLogEvents.Refresh();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tprivate string _filterText;\n\t\tpublic string FilterText\n\t\t{\n\t\t\tget { return _filterText; }\n\t\t\tset\n\t\t\t{\n\t\t\t\tif (_filterText != value)\n\t\t\t\t{\n\t\t\t\t\t_filterText = value;\n\t\t\t\t\tOnPropertyChanged(nameof(FilterText));\n\t\t\t\t\t_filtedLogEvents.Refresh();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\n\t\tprivate bool _tailLog;\n\t\tpublic bool TailLog\n\t\t{\n\t\t\tget { return _tailLog; }\n\t\t\tset\n\t\t\t{\n\t\t\t\tif (_tailLog != value)\n\t\t\t\t{\n\t\t\t\t\t_tailLog = value;\n\t\t\t\t\tOnPropertyChanged(nameof(TailLog));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\n\n\t\tpublic ICommand ClearCommand\n\t\t{\n\t\t\tget { return new DelegateCommand(OnClear); }\n\t\t}\n\n\n\t\tpublic EventLogViewModel()\n\t\t{\n\t\t\t_filtedLogEvents = (CollectionView)CollectionViewSource.GetDefaultView(LogEvents);\n\t\t\t_filtedLogEvents.Filter += OnFilterTriggered;\n\t\t}\n\n\n\n\t\tpublic void AddEvent(EventLogEntry e)\n\t\t{\n\t\t\tApplication.Current.Dispatcher.InvokeAsync(() => LogEvents.Add(e));\n\t\t}\n\n\t\tpublic void ExportLog(string filepath)\n\t\t{\n\t\t\tusing (var writer = new StreamWriter(filepath))\n\t\t\t{\n\t\t\t\tforeach (var e in LogEvents)\n\t\t\t\t{\n\t\t\t\t\twriter.WriteLine($\"{e.Timestamp.ToString(\"yyyy-MM-dd HH:mm:ss.fff\")}    {e.Level}    {e.Message}\");\n\t\t\t\t}\n\t\t\t}\t\n\t\t}\n\n\n\n\t\tprivate bool OnFilterTriggered(object obj)\n\t\t{\n\t\t\tvar e = obj as EventLogEntry;\n\n\t\t\tif (e != null)\n\t\t\t{\n\t\t\t\tif (e.Level >= SelectedLogLevel)\n\t\t\t\t{\n\t\t\t\t\tif (String.IsNullOrEmpty(FilterText))\n\t\t\t\t\t{\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (e.Message.IndexOf(FilterText, StringComparison.OrdinalIgnoreCase) >= 0)\n\t\t\t\t\t{\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn false;\n\t\t}\n\n\n\t\tprivate void OnClear()\n\t\t{\n\t\t\tLogEvents.Clear();\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/tool/ViewModel/MainViewModel.cs",
    "content": "using BBSFW.Model;\nusing BBSFW.ViewModel.Base;\nusing Microsoft.Win32;\nusing System;\nusing System.Reflection;\nusing System.Windows;\nusing System.Windows.Input;\n\nnamespace BBSFW.ViewModel\n{\n\n\tpublic class MainViewModel : ObservableObject\n\t{\n\n\t\tpublic ConfigurationViewModel ConfigVm { get; private set; }\n\n\t\tpublic ConnectionViewModel ConnectionVm { get; private set; }\n\n\t\tpublic SystemViewModel SystemVm { get; private set; }\n\n\t\tpublic AssistLevelsViewModel AssistLevelsVm { get; private set; }\n\n\t\tpublic CalibrationViewModel CalibrationVm { get; private set; }\n\n\t\tpublic EventLogViewModel EventLogVm { get; private set; }\n\n\n\n\t\tpublic ICommand OpenConfigCommand\n\t\t{\n\t\t\tget { return new DelegateCommand(OnOpenConfig); }\n\t\t}\n\n\t\tpublic ICommand SaveConfigCommand\n\t\t{\n\t\t\tget { return new DelegateCommand(OnSaveConfig); }\n\t\t}\n\n\t\tpublic ICommand SaveLogCommand\n\t\t{\n\t\t\tget { return new DelegateCommand(OnSaveLog); }\n\t\t}\n\n\t\tpublic ICommand ReadFlashCommand\n\t\t{\n\t\t\tget { return new DelegateCommand(OnReadFlash); }\n\t\t}\n\n\t\tpublic ICommand WriteFlashCommand\n\t\t{\n\t\t\tget { return new DelegateCommand(OnWriteFlash); }\n\t\t}\n\n\t\tpublic ICommand ResetFlashCommand\n\t\t{\n\t\t\tget { return new DelegateCommand(OnResetFlash); }\n\t\t}\n\n\t\tpublic ICommand ExitCommand\n\t\t{\n\t\t\tget { return new DelegateCommand(OnExit); }\n\t\t}\n\n\t\tpublic ICommand ShowAboutCommand\n\t\t{\n\t\t\tget { return new DelegateCommand(OnShowAbout); }\n\t\t}\n\n\n\n\t\tpublic MainViewModel()\n\t\t{\n\t\t\tConfigVm = new ConfigurationViewModel();\n\n\t\t\tConnectionVm = new ConnectionViewModel();\n\t\t\tSystemVm = new SystemViewModel(ConfigVm);\n\t\t\tAssistLevelsVm = new AssistLevelsViewModel(ConfigVm);\n\t\t\tCalibrationVm = new CalibrationViewModel(ConnectionVm);\n\t\t\tEventLogVm = new EventLogViewModel();\n\n\n\t\t\tConnectionVm.EventLogReceived += EventLogVm.AddEvent;\n\t\t}\n\n\n\t\tprivate void OnSaveLog()\n\t\t{\n\t\t\tvar dialog = new SaveFileDialog();\n\n\t\t\tdialog.Filter = \"Log File|*.log\";\n\t\t\tdialog.Title = \"Save Log\";\n\t\t\tdialog.FileName = \"bbsfw.log\";\n\n\t\t\tvar result = dialog.ShowDialog();\n\t\t\tif (result.HasValue && result.Value)\n\t\t\t{\n\t\t\t\ttry\n\t\t\t\t{\n\t\t\t\t\tEventLogVm.ExportLog(dialog.FileName);\n\t\t\t\t}\n\t\t\t\tcatch(Exception e)\n\t\t\t\t{\n\t\t\t\t\tMessageBox.Show(e.Message, \"Error\", MessageBoxButton.OK, MessageBoxImage.Error);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tprivate void OnOpenConfig()\n\t\t{\n\t\t\tvar dialog = new OpenFileDialog();\n\t\t\tdialog.Filter = \"XML File|*.xml\";\n\t\t\tdialog.Title = \"Open Configuration\";\n\n\t\t\tvar result = dialog.ShowDialog();\n\t\t\tif (result.HasValue && result.Value)\n\t\t\t{\n\t\t\t\ttry\n\t\t\t\t{\n\t\t\t\t\tConfigVm.ReadConfiguration(dialog.FileName);\n\t\t\t\t}\n\t\t\t\tcatch (Exception e)\n\t\t\t\t{\n\t\t\t\t\tMessageBox.Show(e.Message, \"Error\", MessageBoxButton.OK, MessageBoxImage.Error);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tprivate void OnSaveConfig()\n\t\t{\n\t\t\tif (!ValidateConfig())\n\t\t\t{\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tvar dialog = new SaveFileDialog();\n\n\t\t\tdialog.Filter = \"XML File|*.xml\";\n\t\t\tdialog.Title = \"Save Configuration\";\n\t\t\tdialog.FileName = \"bbsfw.xml\";\n\n\t\t\tvar result = dialog.ShowDialog();\n\t\t\tif (result.HasValue && result.Value)\n\t\t\t{\n\t\t\t\ttry\n\t\t\t\t{\n\t\t\t\t\tConfigVm.WriteConfiguration(dialog.FileName);\n\t\t\t\t}\n\t\t\t\tcatch (Exception e)\n\t\t\t\t{\n\t\t\t\t\tMessageBox.Show(e.Message, \"Error\", MessageBoxButton.OK, MessageBoxImage.Error);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tprivate async void OnReadFlash()\n\t\t{\n\t\t\tif (!ConnectionVm.IsConnected)\n\t\t\t{\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (!VerifyConfigVersionForRead())\n\t\t\t{\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tvar res = await ConnectionVm.GetConnection().ReadConfiguration(TimeSpan.FromSeconds(5));\n\t\t\tif (!res.Timeout && res.Result != null)\n\t\t\t{\n\t\t\t\tConfigVm.UpdateFrom(res.Result);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tMessageBox.Show(\"Failed to read configuration from flash, timeout occured.\", \"Error\", MessageBoxButton.OK, MessageBoxImage.Error);\n\t\t\t}\n\t\t}\n\n\t\tprivate async void OnWriteFlash()\n\t\t{\n\t\t\tif (!ConnectionVm.IsConnected)\n\t\t\t{\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (!ValidateConfig())\n\t\t\t{\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (!VerifyConfigVersionForWrite())\n\t\t\t{\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tvar res = await ConnectionVm.GetConnection().WriteConfiguration(ConfigVm.GetConfig(), TimeSpan.FromSeconds(5));\n\t\t\tif (!res.Timeout)\n\t\t\t{\n\t\t\t\tif (res.Result)\n\t\t\t\t{\n\t\t\t\t\tMessageBox.Show(\"Configuration Written!\", \"Success\", MessageBoxButton.OK, MessageBoxImage.Information);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tMessageBox.Show(\"Failed to write configuration to flash, try again.\", \"Error\", MessageBoxButton.OK, MessageBoxImage.Error);\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tMessageBox.Show(\"Failed to write configuration to flash, timeout occured.\", \"Error\", MessageBoxButton.OK, MessageBoxImage.Error);\n\t\t\t}\n\t\t}\n\n\t\tprivate async void OnResetFlash()\n\t\t{\n\t\t\tif (!ConnectionVm.IsConnected)\n\t\t\t{\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tvar res = await ConnectionVm.GetConnection().ResetConfiguration(TimeSpan.FromSeconds(5));\n\t\t\tif (!res.Timeout)\n\t\t\t{\n\t\t\t\tif (res.Result)\n\t\t\t\t{\n\t\t\t\t\tOnReadFlash();\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tMessageBox.Show(\"Failed to reset configuration, try again.\", \"Error\", MessageBoxButton.OK, MessageBoxImage.Error);\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tMessageBox.Show(\"Failed to reset configuration, timeout occured.\", \"Error\", MessageBoxButton.OK, MessageBoxImage.Error);\n\t\t\t}\n\t\t}\n\n\n\t\tprivate void OnShowAbout()\n\t\t{\n\t\t\tvar version = Assembly.GetExecutingAssembly().GetName().Version;\n\t\t\tMessageBox.Show($\"Version: {version.Major}.{version.Minor}.{version.Build}\\nAuthor: Daniel Nilsson\", \"BBS-FW Tool\", MessageBoxButton.OK, MessageBoxImage.Information);\n\t\t}\n\n\t\tprivate void OnExit()\n\t\t{\n\t\t\tApplication.Current.Shutdown();\n\t\t}\n\n\t\tprivate bool VerifyConfigVersionForRead()\n\t\t{\n\t\t\tif (ConnectionVm.ConfigVersion < Configuration.MinVersion || ConnectionVm.ConfigVersion > Configuration.MaxVersion)\n\t\t\t{\n\t\t\t\tMessageBox.Show(\"Unsupported firmware config version. Please use BBS-FW Config Tool for firmware version \" + ConnectionVm.FirmwareVersion + \" to read configuration from flash.\", \"Error\", MessageBoxButton.OK, MessageBoxImage.Error);\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\treturn true;\n\t\t}\n\n\t\tprivate bool VerifyConfigVersionForWrite()\n\t\t{\n\t\t\tif (ConnectionVm.ConfigVersion != Configuration.CurrentVersion)\n\t\t\t{\n\t\t\t\tMessageBox.Show(\"Unsupported firmware config version. Please use BBS-FW Config Tool for firmware version \" + ConnectionVm.FirmwareVersion + \" in order to write configuration to flash, or upgrade firmware to latest version.\", \"Error\", MessageBoxButton.OK, MessageBoxImage.Error);\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\treturn true;\n\t\t}\n\n\t\tprivate bool ValidateConfig()\n\t\t{\n\t\t\ttry\n\t\t\t{\n\t\t\t\tConfigVm.GetConfig().Validate();\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tcatch (Exception e)\n\t\t\t{\n\t\t\t\tMessageBox.Show(e.Message, \"Validation Error\", MessageBoxButton.OK, MessageBoxImage.Error);\n\t\t\t}\n\n\t\t\treturn false;\n\t\t}\n\n\t}\n}\n"
  },
  {
    "path": "src/tool/ViewModel/SystemViewModel.cs",
    "content": "using BBSFW.ViewModel.Base;\nusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace BBSFW.ViewModel\n{\n\tpublic class SystemViewModel : ObservableObject\n\t{\n\n\n\t\tprivate ConfigurationViewModel _configVm;\n\t\tpublic ConfigurationViewModel ConfigVm\n\t\t{\n\t\t\tget { return _configVm; }\n\t\t}\n\n\t\tpublic SystemViewModel(ConfigurationViewModel config)\n\t\t{\n\t\t\t_configVm = config;\n\t\t}\n\n\t}\n}\n"
  },
  {
    "path": "src/tool/ViewModel/ValueItemViewModel.cs",
    "content": "using System;\nusing System.Diagnostics.CodeAnalysis;\n\nnamespace BBSFW.ViewModel\n{\n\tpublic class ValueItemViewModel<T> : IEquatable<ValueItemViewModel<T>>\n\t{\n\t\tpublic T Value { get; private set; }\n\n\n\t\tpublic string Name { get; private set; }\n\n\n\t\tpublic ValueItemViewModel(T value, string name)\n\t\t{\n\t\t\tValue = value;\n\t\t\tName = name;\n\t\t}\n\n\t\tpublic static implicit operator T(ValueItemViewModel<T> v) => v.Value; \n\n\n\t\tpublic override string ToString()\n\t\t{\n\t\t\treturn Name;\n\t\t}\n\n\t\tpublic bool Equals([AllowNull] ValueItemViewModel<T> other)\n\t\t{\n\t\t\treturn Value.Equals(other.Value);\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/tool/bbs-fw-tool.csproj",
    "content": "<Project Sdk=\"Microsoft.NET.Sdk\">\r\n\r\n  <PropertyGroup>\r\n    <OutputType>WinExe</OutputType>\r\n    <TargetFramework>net6.0-windows</TargetFramework>\r\n\t<PublishSingleFile>true</PublishSingleFile>\r\n\t<SelfContained>false</SelfContained>\r\n\t<PublishReadyToRun>true</PublishReadyToRun>\r\n\t<RuntimeIdentifier>win-x64</RuntimeIdentifier>\r\n\t<IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract>\r\n\t<RootNamespace>BBSFW</RootNamespace>\r\n    <UseWPF>true</UseWPF>\r\n    <AssemblyName>BBSFWTool</AssemblyName>\r\n    <Authors>Daniel Nilsson</Authors>\r\n    <AssemblyVersion>1.5.99.0</AssemblyVersion>\r\n    <FileVersion>1.5.99.0</FileVersion>\r\n  </PropertyGroup>\r\n\r\n  <ItemGroup>\r\n    <PackageReference Include=\"System.IO.Ports\" Version=\"5.0.0\" />\r\n    <PackageReference Include=\"System.Management\" Version=\"5.0.0\" />\r\n  </ItemGroup>\r\n\r\n  <ItemGroup>\r\n    <Compile Update=\"Properties\\Settings.Designer.cs\">\r\n      <DesignTimeSharedInput>True</DesignTimeSharedInput>\r\n      <AutoGen>True</AutoGen>\r\n      <DependentUpon>Settings.settings</DependentUpon>\r\n    </Compile>\r\n  </ItemGroup>\r\n\r\n  <ItemGroup>\r\n    <None Update=\"Properties\\Settings.settings\">\r\n      <Generator>SettingsSingleFileGenerator</Generator>\r\n      <LastGenOutput>Settings.Designer.cs</LastGenOutput>\r\n    </None>\r\n  </ItemGroup>\r\n\r\n</Project>\r\n"
  },
  {
    "path": "src/tool/bbs-fw-tool.sln",
    "content": "﻿\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio Version 16\nVisualStudioVersion = 16.0.30503.244\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"bbs-fw-tool\", \"bbs-fw-tool.csproj\", \"{7B668996-1621-4134-BFD0-64E5545FB273}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{7B668996-1621-4134-BFD0-64E5545FB273}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{7B668996-1621-4134-BFD0-64E5545FB273}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{7B668996-1621-4134-BFD0-64E5545FB273}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{7B668996-1621-4134-BFD0-64E5545FB273}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\n\tGlobalSection(ExtensibilityGlobals) = postSolution\n\t\tSolutionGuid = {57BF9BEF-8104-430E-B454-23740A703C9B}\n\tEndGlobalSection\nEndGlobal\n"
  }
]