diff --git a/3d/knob.stl b/3d/knob.stl deleted file mode 100644 index 8a454fa..0000000 Binary files a/3d/knob.stl and /dev/null differ diff --git a/LICENSE.md b/LICENSE.md deleted file mode 100644 index a512019..0000000 --- a/LICENSE.md +++ /dev/null @@ -1,484 +0,0 @@ -THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS -COOPERATIVE NON-VIOLENT PUBLIC LICENSE (\"LICENSE\"). THE WORK IS -PROTECTED BY COPYRIGHT AND ALL OTHER APPLICABLE LAWS. ANY USE OF THE -WORK OTHER THAN AS AUTHORIZED UNDER THIS LICENSE OR COPYRIGHT LAW IS -PROHIBITED. BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED IN THIS -LICENSE, YOU AGREE TO BE BOUND BY THE TERMS OF THIS LICENSE. TO THE -EXTENT THIS LICENSE MAY BE CONSIDERED TO BE A CONTRACT, THE LICENSOR -GRANTS YOU THE RIGHTS CONTAINED HERE IN AS CONSIDERATION FOR ACCEPTING -THE TERMS AND CONDITIONS OF THIS LICENSE AND FOR AGREEING TO BE BOUND BY -THE TERMS AND CONDITIONS OF THIS LICENSE. - -# Definitions - -An Act of War is any action of one country against any group either with -an intention to provoke a conflict or an action that occurs during a -declared war or during armed conflict between military forces of any -origin. This includes but is not limited to enforcing sanctions or -sieges, supplying armed forces, or profiting from the manufacture of -tools or weaponry used in military conflict. - -An Adaptation is a work based upon the Work, or upon the Work and other -pre-existing works, such as a translation, adaptation, derivative work, -arrangement of music or other alterations of a literary or artistic -work, or phonogram or performance and includes cinematographic -adaptations or any other form in which the Work may be recast, -transformed, or adapted including in any form recognizably derived from -the original, except that a work that constitutes a Collection will not -be considered an Adaptation for the purpose of this License. For the -avoidance of doubt, where the Work is a musical work, performance or -phonogram, the synchronization of the Work in timed-relation with a -moving image (\"synching\") will be considered an Adaptation for the -purpose of this License. In addition, where the Work is designed to -output a neural network the output of the neural network will be -considered an Adaptation for the purpose of this license. - -Bodily Harm is any physical hurt or injury to a person that interferes -with the health or comfort of the person and that is more than merely -transient or trifling in nature. - -Distribute is to make available to the public the original and copies of -the Work or Adaptation, as appropriate, through sale, gift or any other -transfer of possession or ownership. - -Incarceration is Confinement in a jail, prison, or any other place where -individuals of any kind are held against either their will or (if their -will cannot be determined) the will of their legal guardian or -guardians. In the case of a conflict between the will of the individual -and the will of their legal guardian or guardians, the will of the -individual will take precedence. - -Licensor is The individual, individuals, entity, or entities that -offer(s) the Work under the terms of this License - -Original Author is in the case of a literary or artistic work, the -individual, individuals, entity or entities who created the Work or if -no individual or entity can be identified, the publisher; and in -addition - -- in the case of a performance the actors, singers, musicians, - dancers, and other persons who act, sing, deliver, declaim, play in, - interpret or otherwise perform literary or artistic works or - expressions of folklore; - -- in the case of a phonogram the producer being the person or legal - entity who first fixes the sounds of a performance or other sounds; - and, - -- in the case of broadcasts, the organization that transmits the - broadcast. - -Work is the literary and/or artistic work offered under the terms of -this License including without limitation any production in the -literary, scientific and artistic domain, whatever may be the mode or -form of its expression including digital form, such as a book, pamphlet -and other writing; a lecture, address, sermon or other work of the same -nature; a dramatic or dramatico-musical work; a choreographic work or -entertainment in dumb show; a musical composition with or without words; -a cinematographic work to which are assimilated works expressed by a -process analogous to cinematography; a work of drawing, painting, -architecture, sculpture, engraving or lithography; a photographic work -to which are assimilated works expressed by a process analogous to -photography; a work of applied art; an illustration, map, plan, sketch -or three-dimensional work relative to geography, topography, -architecture or science; a performance; a broadcast; a phonogram; a -compilation of data to the extent it is protected as a copyrightable -work; or a work performed by a variety or circus performer to the extent -it is not otherwise considered a literary or artistic work. - -You means an individual or entity exercising rights under this License -who has not previously violated the terms of this License with respect -to the Work, or who has received express permission from the Licensor to -exercise rights under this License despite a previous violation. - -Publicly Perform means to perform public recitations of the Work and to -communicate to the public those public recitations, by any means or -process, including by wire or wireless means or public digital -performances; to make available to the public Works in such a way that -members of the public may access these Works from a place and at a place -individually chosen by them; to perform the Work to the public by any -means or process and the communication to the public of the performances -of the Work, including by public digital performance; to broadcast and -rebroadcast the Work by any means including signs, sounds or images. - -Reproduce is to make copies of the Work by any means including without -limitation by sound or visual recordings and the right of fixation and -reproducing fixations of the Work, including storage of a protected -performance or phonogram in digital form or other electronic medium. - -Software is any digital Work which, through use of a third-party piece -of Software or through the direct usage of itself on a computer system, -the memory of the computer is modified dynamically or semi-dynamically. -\"Software\", secondly, processes or interprets information. - -Source Code is Any digital Work which, through use of a third-party -piece of Software or through the direct usage of itself on a computer -system, the memory of the computer is modified dynamically or -semi-dynamically. \"Software\", secondly, processes or interprets -information. - -Surveilling is the use of the Work to either overtly or covertly observe -and record persons and or their activities. - -A Network Service is the use of a piece of Software to interpret or -modify information that is subsequently and directly served to users -over the Internet. - -To Discriminate is use of a work to differentiate between humans in a -such a way which prioritizes some above others on the basis of percieved -membership within certain groups. - -Hate Speech is Communication or any form of expression which is solely -for the purpose of expressing hatred for some group or advocating a form -of Discrimination between humans. - -Coercion is leveraging of the threat of force or use of force to -intimidate a person in order to gain compliance, or to offer large -incentives which aim to entice a person to act against their will. - -# Fair Dealing Rights - -Nothing in this License is intended to reduce, limit, or restrict any -uses free from copyright or rights arising from limitations or -exceptions that are provided for in connection with the copyright -protection under copyright law or other applicable laws. - -# License Grant - -Subject to the terms and conditions of this License, Licensor hereby -grants You a worldwide, royalty-free, non-exclusive, perpetual (for the -duration of the applicable copyright) license to exercise the rights in -the Work as stated below: - -To Reproduce the Work, to incorporate the Work into one or more -Collections, and to Reproduce the Work as incorporated in the -Collections - -To create and Reproduce Adaptations provided that any such Adaptation, -including any translation in any medium, takes reasonable steps to -clearly label, demarcate or otherwise identify that changes were made to -the original Work. For example, a translation could be marked \"The -original work was translated from English to Spanish,\" or a -modification could indicate \"The original work has been modified.\" - -To Distribute and Publicly Perform the Work including as incorporated in -Collections. - -To Distribute and Publicly Perform Adaptations. The above rights may be -exercised in all media and formats whether now known or hereafter -devised. The above rights include the right to make such modifications -as are technically necessary to exercise the rights in other media and -formats. This License constitutes the entire agreement between the -parties with respect to the Work licensed here. There are no -understandings, agreements or representations with respect to the Work -not specified here. Licensor shall not be bound by any additional -provisions that may appear in any communication from You. This License -may not be modified without the mutual written agreement of the Licensor -and You. All rights not expressly granted by Licensor are hereby -reserved, including but not limited to the rights set forth in -Non-waivable Compulsory License Schemes, Waivable Compulsory License -Schemes, and Voluntary License Schemes in the restrictions. - -# Restrictions - -The license granted in the license grant above is expressly made subject -to and limited by the following restrictions: - -You may Distribute or Publicly Perform the Work only under the terms of -this License. You must include a copy of, or the Uniform Resource -Identifier (URI) for, this License with every copy of the Work You -Distribute or Publicly Perform. You may not offer or impose any terms on -the Work that restrict the terms of this License or the ability of the -recipient of the Work to exercise the rights granted to that recipient -under the terms of the License. You may not sublicense the Work. You -must keep intact all notices that refer to this License and to the -disclaimer of warranties with every copy of the Work You Distribute or -Publicly Perform. When You Distribute or Publicly Perform the Work, You -may not impose any effective technological measures on the Work that -restrict the ability of a recipient of the Work from You to exercise the -rights granted to that recipient under the terms of the License. This -Section applies to the Work as incorporated in a Collection, but this -does not require the Collection apart from the Work itself to be made -subject to the terms of this License. If You create a Collection, upon -notice from any Licensor You must, to the extent practicable, remove -from the Collection any credit as requested. If You create an -Adaptation, upon notice from any Licensor You must, to the extent -practicable, remove from the Adaptation any credit as requested. - -## Commercial Restrictions - -You may not exercise any of the rights granted to You in the above -section in any manner that is primarily intended for or directed toward -commercial advantage or private monetary compensation unless you meet -the following requirements. - -i. You are a worker-owned business or worker-owned collective. - -ii. after tax, all financial gain, surplus, profits and benefits - produced by the business or collective are distributed among the - worker-owners unless a set amount is to be allocated towards - community projects as decided by a previously-established consensus - agreement between the worker-owners where all worker-owners agreed. - -iii. You are not using such rights on behalf of a business other than - those specified in (i) or (ii) above, nor are using such rights as - a proxy on behalf of a business with the intent to circumvent the - aforementioned restrictions on such a business. - -The exchange of the Work for other copyrighted works by means of digital -file-sharing or otherwise shall not be considered to be intended for or -directed toward commercial advantage or private monetary compensation, -provided there is no payment of any monetary compensation in connection -with the exchange of copyrighted works. - -If the Work meets the definition of Software, You may exercise the -rights granted in the license grant only if You provide a copy of the -corresponding Source Code from which the Work was derived in digital -form, or You provide a URI for the corresponding Source Code of the -Work, to any recipients upon request. - -If the Work is used as or for a Network Service, You may exercise the -rights granted in the license grant only if You provide a copy of the -corresponding Source Code from which the Work was derived in digital -form, or You provide a URI for the corresponding Source Code to the -Work, to any recipients of the data served or modified by the Web -Service. - -Any use by a business that is privately owned and managed, and that -seeks to generate profit from the labor of employees paid by salary or -other wages, is not permitted under this license. - -## - -You may exercise the rights granted in the license grant for any -purposes only if: - -i. You do not use the Work for the purpose of inflicting Bodily Harm on - human beings (subject to criminal prosecution or otherwise) outside - of providing medical aid or undergoing a voluntary procedure under - no form of Coercion. - -ii. You do not use the Work for the purpose of Surveilling or tracking - individuals for financial gain. - -iii. You do not use the Work in an Act of War. - -iv. You do not use the Work for the purpose of supporting or profiting - from an Act of War. - -v. You do not use the Work for the purpose of Incarceration. - -vi. You do not use the Work for the purpose of extracting, processing, - or refining, oil, gas, or coal. Or to in any other way to - deliberately pollute the environment as a byproduct of manufacturing - or irresponsible disposal of hazardous materials. - -vii. You do not use the Work for the purpose of expediting, - coordinating, or facilitating paid work undertaken by individuals - under the age of 12 years. - -viii. You do not use the Work to either Discriminate or spread Hate - Speech on the basis of sex, sexual orientation, gender identity, - race, age, disability, color, national origin, religion, caste, or - lower economic status. - -## - -If You Distribute, or Publicly Perform the Work or any Adaptations or -Collections, You must, unless a request has been made by any Licensor to -remove credit from a Collection or Adaptation, keep intact all copyright -notices for the Work and provide, reasonable to the medium or means You -are utilizing: - -i. the name of the Original Author (or pseudonym, if applicable) if - supplied, and/or if the Original Author and/or Licensor designate - another party or parties (e.g., a sponsor institute, publishing - entity, journal) for attribution (\"Attribution Parties\") in - Licensor\'s copyright notice, terms of service or by other - reasonable means, the name of such party or parties; - -ii. the title of the Work if supplied; - -iii. to the extent reasonably practicable, the URI, if any, that - Licensor to be associated with the Work, unless such URI does not - refer to the copyright notice or licensing information for the - Work; and, - -iv. in the case of an Adaptation, a credit identifying the use of the - Work in the Adaptation (e.g., \"French translation of the Work by - Original Author,\" or \"Screenplay based on original Work by - Original Author\"). - -If any Licensor has sent notice to request removing credit, You must, to -the extent practicable, remove any credit as requested. The credit -required by this Section may be implemented in any reasonable manner; -provided, however, that in the case of an Adaptation or Collection, at a -minimum such credit will appear, if a credit for all contributing -authors of the Adaptation or Collection appears, then as part of these -credits and in a manner at least as prominent as the credits for the -other contributing authors. For the avoidance of doubt, You may only use -the credit required by this Section for the purpose of attribution in -the manner set out above and, by exercising Your rights under this -License, You may not implicitly or explicitly assert or imply any -connection with, sponsorship or endorsement by the Original Author, -Licensor and/or Attribution Parties, as appropriate, of You or Your use -of the Work, without the separate, express prior written permission of -the Original Author, Licensor and/or Attribution Parties. - -Non-waivable Compulsory License Schemes. In those jurisdictions in which -the right to collect royalties through any statutory or compulsory -licensing scheme cannot be waived, the Licensor reserves the exclusive -right to collect such royalties for any exercise by You of the rights -granted under this License - -Waivable Compulsory License Schemes. In those jurisdictions in which the -right to collect royalties through any statutory or compulsory licensing -scheme can be waived, the Licensor reserves the exclusive right to -collect such royalties for any exercise by You of the rights granted -under this License if Your exercise of such rights is for a purpose or -use which is otherwise than noncommercial as permitted under Commercial -Restrictions and otherwise waives the right to collect royalties through -any statutory or compulsory licensing scheme. - -Voluntary License Schemes. The Licensor reserves the right to collect -royalties, whether individually or, in the event that the Licensor is a -member of a collecting society that administers voluntary licensing -schemes, via that society, from any exercise by You of the rights -granted under this License that is for a purpose or use which is -otherwise than noncommercial as permitted under the license grant. - -Except as otherwise agreed in writing by the Licensor or as may be -otherwise permitted by applicable law, if You Reproduce, Distribute or -Publicly Perform the Work either by itself or as part of any Adaptations -or Collections, You must not distort, mutilate, modify or take other -derogatory action in relation to the Work which would be prejudicial to -the Original Author\'s honor or reputation. Licensor agrees that in -those jurisdictions (e.g. Japan), in which any exercise of the right -granted in the license grant of this License (the right to make -Adaptations) would be deemed to be a distortion, mutilation, -modification or other derogatory action prejudicial to the Original -Author\'s honor and reputation, the Licensor will waive or not assert, -as appropriate, this Section, to the fullest extent permitted by the -applicable national law, to enable You to reasonably exercise Your right -under the license grant of this License (right to make Adaptations) but -not otherwise. - -Do not make any legal claim against anyone accusing the Work, with or -without changes, alone or with other works, of infringing any patent -claim. - -# Representations Warranties and Disclaimer - -UNLESS OTHERWISE MUTUALLY AGREED TO BY THE PARTIES IN WRITING, LICENSOR -OFFERS THE WORK AS-IS AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY -KIND CONCERNING THE WORK, EXPRESS, IMPLIED, STATUTORY OR OTHERWISE, -INCLUDING, WITHOUT LIMITATION, WARRANTIES OF TITLE, MERCHANTIBILITY, -FITNESS FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR THE ABSENCE OF -LATENT OR OTHER DEFECTS, ACCURACY, OR THE PRESENCE OF ABSENCE OF ERRORS, -WHETHER OR NOT DISCOVERABLE. SOME JURISDICTIONS DO NOT ALLOW THE -EXCLUSION OF IMPLIED WARRANTIES, SO SUCH EXCLUSION MAY NOT APPLY TO YOU. - -# Limitation on Liability - -EXCEPT TO THE EXTENT REQUIRED BY APPLICABLE LAW, IN NO EVENT WILL -LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY FOR ANY SPECIAL, -INCIDENTAL, CONSEQUENTIAL, PUNITIVE OR EXEMPLARY DAMAGES ARISING OUT OF -THIS LICENSE OR THE USE OF THE WORK, EVEN IF LICENSOR HAS BEEN ADVISED -OF THE POSSIBILITY OF SUCH DAMAGES. - -# Termination - -This License and the rights granted hereunder will terminate -automatically upon any breach by You of the terms of this License. -Individuals or entities who have received Adaptations or Collections -from You under this License, however, will not have their licenses -terminated provided such individuals or entities remain in full -compliance with those licenses. The Sections on definitions, fair -dealing rights, representations, warranties, and disclaimer, limitation -on liability, termination, and revised license versions will survive any -termination of this License. - -Subject to the above terms and conditions, the license granted here is -perpetual (for the duration of the applicable copyright in the Work). -Notwithstanding the above, Licensor reserves the right to release the -Work under different license terms or to stop distributing the Work at -any time; provided, however that any such election will not serve to -withdraw this License (or any other license that has been, or is -required to be, granted under the terms of this License), and this -License will continue in full force and effect unless terminated as -stated above. - -# Revised License Versions - -This License may receive future revisions in the original spirit of the -license intended to strengthen This License. Each version of This -License has an incrementing version number. - -Unless otherwise specified like in the below subsection The Licensor has -only granted this current version of This License for The Work. In this -case future revisions do not apply. - -The Licensor may specify that the latest available revision of This -License be used for The Work by either explicitly writing so or by -suffixing the License URI with a \"+\" symbol. - -The Licensor may specify that The Work is also available under the terms -of This License\'s current revision as well as specific future -revisions. The Licensor may do this by writing it explicitly or -suffixing the License URI with any additional version numbers each -separated by a comma. - -# Miscellaneous - -Each time You Distribute or Publicly Perform the Work or a Collection, -the Licensor offers to the recipient a license to the Work on the same -terms and conditions as the license granted to You under this License. - -Each time You Distribute or Publicly Perform an Adaptation, Licensor -offers to the recipient a license to the original Work on the same terms -and conditions as the license granted to You under this License. - -If the Work is classified as Software, each time You Distribute or -Publicly Perform an Adaptation, Licensor offers to the recipient a copy -and/or URI of the corresponding Source Code on the same terms and -conditions as the license granted to You under this License. - -If the Work is used as a Network Service, each time You Distribute or -Publicly Perform an Adaptation, or serve data derived from the Software, -the Licensor offers to any recipients of the data a copy and/or URI of -the corresponding Source Code on the same terms and conditions as the -license granted to You under this License. - -If any provision of this License is invalid or unenforceable under -applicable law, it shall not affect the validity or enforceability of -the remainder of the terms of this License, and without further action -by the parties to this agreement, such provision shall be reformed to -the minimum extent necessary to make such provision valid and -enforceable. - -No term or provision of this License shall be deemed waived and no -breach consented to unless such waiver or consent shall be in writing -and signed by the party to be charged with such waiver or consent. - -This License constitutes the entire agreement between the parties with -respect to the Work licensed here. There are no understandings, -agreements or representations with respect to the Work not specified -here. Licensor shall not be bound by any additional provisions that may -appear in any communication from You. This License may not be modified -without the mutual written agreement of the Licensor and You. - -The rights granted under, and the subject matter referenced, in this -License were drafted utilizing the terminology of the Berne Convention -for the Protection of Literary and Artistic Works (as amended on -September 28, 1979), the Rome Convention of 1961, the WIPO Copyright -Treaty of 1996, the WIPO Performances and Phonograms Treaty of 1996 and -the Universal Copyright Convention (as revised on July 24, 1971). These -rights and subject matter take effect in the relevant jurisdiction in -which the License terms are sought to be enforced according to the -corresponding provisions of the implementation of those treaty -provisions in the applicable national law. If the standard suite of -rights granted under applicable copyright law includes additional rights -not granted under this License, such additional rights are deemed to be -included in the License; this License is not intended to restrict the -license of any rights under applicable law. - diff --git a/blockdiagram.svg b/blockdiagram.svg deleted file mode 100644 index 38a0c77..0000000 --- a/blockdiagram.svg +++ /dev/null @@ -1,192 +0,0 @@ - - - - - - - - - - 2x LEDs - - - - USB-? port - - - - Somecontroler - - - - Pot orrot-encFLOOD LT - - - - Pot orrot-encINTEG LT - - - - - - - diff --git a/firmware/.cargo/config b/firmware/.cargo/config deleted file mode 100644 index af1f29b..0000000 --- a/firmware/.cargo/config +++ /dev/null @@ -1,11 +0,0 @@ -[target.thumbv7m-none-eabi] -runner = 'arm-none-eabi-gdb' -rustflags = [ - "-C", "link-arg=-Tlink.x", -] - -[build] -target = "thumbv7m-none-eabi" - -[unstable] -build-std = ["core", "alloc"] diff --git a/firmware/.gdbinit b/firmware/.gdbinit deleted file mode 100644 index 098ff6f..0000000 --- a/firmware/.gdbinit +++ /dev/null @@ -1,18 +0,0 @@ -target remote :3333 - -monitor arm semihosting enable - -# # send captured ITM to the file itm.fifo -# # (the microcontroller SWO pin must be connected to the programmer SWO pin) -# # 8000000 must match the core clock frequency -# monitor tpiu config internal itm.fifo uart off 8000000 - -# # OR: make the microcontroller SWO pin output compatible with UART (8N1) -# # 2000000 is the frequency of the SWO pin -# monitor tpiu config external uart off 8000000 2000000 - -# # enable ITM port 0 -# monitor itm port 0 on - -load -step diff --git a/firmware/Cargo.lock b/firmware/Cargo.lock deleted file mode 100644 index 84b9dff..0000000 --- a/firmware/Cargo.lock +++ /dev/null @@ -1,505 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "bare-metal" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5deb64efa5bd81e31fcd1938615a6d98c82eafcbcd787162b6f63b91d6bac5b3" -dependencies = [ - "rustc_version", -] - -[[package]] -name = "bare-metal" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8fe8f5a8a398345e52358e18ff07cc17a568fbca5c6f73873d3a62056309603" - -[[package]] -name = "bitfield" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46afbd2983a5d5a7bd740ccb198caf5b82f45c40c09c0eed36052d91cb92e719" - -[[package]] -name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - -[[package]] -name = "bitvec" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c" -dependencies = [ - "funty", - "radium", - "tap", - "wyz", -] - -[[package]] -name = "bxcan" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40ac3d0c0a542d0ab5521211f873f62706a7136df415676f676d347e5a41dd80" -dependencies = [ - "bitflags", - "embedded-hal", - "nb 1.1.0", - "vcell", -] - -[[package]] -name = "byteorder" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" - -[[package]] -name = "cortex-m" -version = "0.7.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ec610d8f49840a5b376c69663b6369e71f4b34484b9b2eb29fb918d92516cb9" -dependencies = [ - "bare-metal 0.2.5", - "bitfield", - "embedded-hal", - "volatile-register", -] - -[[package]] -name = "cortex-m-rt" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee84e813d593101b1723e13ec38b6ab6abbdbaaa4546553f5395ed274079ddb1" -dependencies = [ - "cortex-m-rt-macros", -] - -[[package]] -name = "cortex-m-rt-macros" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0f6f3e36f203cfedbc78b357fb28730aa2c6dc1ab060ee5c2405e843988d3c7" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "cortex-m-semihosting" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c23234600452033cc77e4b761e740e02d2c4168e11dbf36ab14a0f58973592b0" -dependencies = [ - "cortex-m", -] - -[[package]] -name = "embedded-dma" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "994f7e5b5cb23521c22304927195f236813053eb9c065dd2226a32ba64695446" -dependencies = [ - "stable_deref_trait", -] - -[[package]] -name = "embedded-hal" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35949884794ad573cf46071e41c9b60efb0cb311e3ca01f7af807af1debc66ff" -dependencies = [ - "nb 0.1.3", - "void", -] - -[[package]] -name = "firmware" -version = "0.1.0" -dependencies = [ - "cortex-m", - "cortex-m-rt", - "embedded-hal", - "fugit", - "nb 1.1.0", - "packed_struct", - "panic-halt", - "panic-semihosting", - "ryu", - "stm32f1xx-hal", - "usb-device", - "usbd-human-interface-device", - "usbd-serial", -] - -[[package]] -name = "frunk" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11a351b59e12f97b4176ee78497dff72e4276fb1ceb13e19056aca7fa0206287" -dependencies = [ - "frunk_core", - "frunk_derives", -] - -[[package]] -name = "frunk_core" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af2469fab0bd07e64ccf0ad57a1438f63160c69b2e57f04a439653d68eb558d6" - -[[package]] -name = "frunk_derives" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0fa992f1656e1707946bbba340ad244f0814009ef8c0118eb7b658395f19a2e" -dependencies = [ - "frunk_proc_macro_helpers", - "quote", - "syn 2.0.55", -] - -[[package]] -name = "frunk_proc_macro_helpers" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35b54add839292b743aeda6ebedbd8b11e93404f902c56223e51b9ec18a13d2c" -dependencies = [ - "frunk_core", - "proc-macro2", - "quote", - "syn 2.0.55", -] - -[[package]] -name = "fugit" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17186ad64927d5ac8f02c1e77ccefa08ccd9eaa314d5a4772278aa204a22f7e7" -dependencies = [ - "gcd", -] - -[[package]] -name = "fugit-timer" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9607bfc4c388f9d629704f56ede4a007546cad417b3bcd6fc7c87dc7edce04a" -dependencies = [ - "fugit", - "nb 1.1.0", -] - -[[package]] -name = "funty" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" - -[[package]] -name = "gcd" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d758ba1b47b00caf47f24925c0074ecb20d6dfcffe7f6d53395c0465674841a" - -[[package]] -name = "hash32" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47d60b12902ba28e2730cd37e95b8c9223af2808df9e902d4df49588d1470606" -dependencies = [ - "byteorder", -] - -[[package]] -name = "heapless" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bfb9eb618601c89945a70e254898da93b13be0388091d42117462b265bb3fad" -dependencies = [ - "hash32", - "stable_deref_trait", -] - -[[package]] -name = "nb" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "801d31da0513b6ec5214e9bf433a77966320625a37860f910be265be6e18d06f" -dependencies = [ - "nb 1.1.0", -] - -[[package]] -name = "nb" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d5439c4ad607c3c23abf66de8c8bf57ba8adcd1f129e699851a6e43935d339d" - -[[package]] -name = "num_enum" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02339744ee7253741199f897151b38e72257d13802d4ee837285cc2990a90845" -dependencies = [ - "num_enum_derive", -] - -[[package]] -name = "num_enum_derive" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "681030a937600a36906c185595136d26abfebb4aa9c65701cefcaf8578bb982b" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.55", -] - -[[package]] -name = "option-block" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0f2c5d345596a14d7c8b032a68f437955f0059f2eb9a5972371c84f7eef3227" - -[[package]] -name = "packed_struct" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36b29691432cc9eff8b282278473b63df73bea49bc3ec5e67f31a3ae9c3ec190" -dependencies = [ - "bitvec", - "packed_struct_codegen", -] - -[[package]] -name = "packed_struct_codegen" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cd6706dfe50d53e0f6aa09e12c034c44faacd23e966ae5a209e8bdb8f179f98" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "panic-halt" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de96540e0ebde571dc55c73d60ef407c653844e6f9a1e2fdbd40c07b9252d812" - -[[package]] -name = "panic-semihosting" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee8a3e1233d9073d76a870223512ce4eeea43c067a94a445c13bd6d792d7b1ab" -dependencies = [ - "cortex-m", - "cortex-m-semihosting", -] - -[[package]] -name = "proc-macro2" -version = "1.0.79" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e835ff2298f5721608eb1a980ecaee1aef2c132bf95ecc026a11b7bf3c01c02e" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "quote" -version = "1.0.35" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "radium" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" - -[[package]] -name = "rustc_version" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" -dependencies = [ - "semver", -] - -[[package]] -name = "ryu" -version = "1.0.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1" - -[[package]] -name = "semver" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" -dependencies = [ - "semver-parser", -] - -[[package]] -name = "semver-parser" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" - -[[package]] -name = "stable_deref_trait" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" - -[[package]] -name = "stm32-usbd" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6c94998f166d66b210a164648a0b7866428d8f1e0740bf8a4c5edd89d4750c1" -dependencies = [ - "cortex-m", - "usb-device", - "vcell", -] - -[[package]] -name = "stm32f1" -version = "0.15.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2dc80735831c28fe85384e1e28428fb6d201f67c696e369a239ed9c5eba369d" -dependencies = [ - "bare-metal 1.0.0", - "cortex-m", - "cortex-m-rt", - "vcell", -] - -[[package]] -name = "stm32f1xx-hal" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30845662b9ce46a2ec04da97666a2b32458bee5032bb0452d0caf1536a96a542" -dependencies = [ - "bitflags", - "bxcan", - "cortex-m", - "cortex-m-rt", - "embedded-dma", - "embedded-hal", - "fugit", - "fugit-timer", - "nb 1.1.0", - "stm32-usbd", - "stm32f1", - "void", -] - -[[package]] -name = "syn" -version = "1.0.109" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "syn" -version = "2.0.55" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "002a1b3dbf967edfafc32655d0f377ab0bb7b994aa1d32c8cc7e9b8bf3ebb8f0" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "tap" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" - -[[package]] -name = "unicode-ident" -version = "1.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" - -[[package]] -name = "usb-device" -version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f6cc3adc849b5292b4075fc0d5fdcf2f24866e88e336dd27a8943090a520508" - -[[package]] -name = "usbd-human-interface-device" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d69710303c06f23a1259d086bfb241212ae1ccfb5d582ebd596bb042d662ed73" -dependencies = [ - "frunk", - "fugit", - "heapless", - "num_enum", - "option-block", - "packed_struct", - "usb-device", -] - -[[package]] -name = "usbd-serial" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db75519b86287f12dcf0d171c7cf4ecc839149fe9f3b720ac4cfce52959e1dfe" -dependencies = [ - "embedded-hal", - "nb 0.1.3", - "usb-device", -] - -[[package]] -name = "vcell" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77439c1b53d2303b20d9459b1ade71a83c716e3f9c34f3228c00e6f185d6c002" - -[[package]] -name = "void" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" - -[[package]] -name = "volatile-register" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de437e2a6208b014ab52972a27e59b33fa2920d3e00fe05026167a1c509d19cc" -dependencies = [ - "vcell", -] - -[[package]] -name = "wyz" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" -dependencies = [ - "tap", -] diff --git a/firmware/Cargo.toml b/firmware/Cargo.toml deleted file mode 100644 index caa1db3..0000000 --- a/firmware/Cargo.toml +++ /dev/null @@ -1,38 +0,0 @@ -[package] -name = "firmware" -version = "0.1.0" -edition = "2021" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] -embedded-hal = "0.2.7" -nb = "1" -cortex-m = "0.7.6" -cortex-m-rt = "0.7.1" -# Panic behaviour, see https://crates.io/keywords/panic-impl for alternatives -panic-halt = "0.2.0" -#stm32-usbd = "0.6.0" -usb-device = "0.2.9" -usbd-serial = "0.1.1" -ryu = "1.0.16" -panic-semihosting = "0.6.0" -usbd-human-interface-device = "0.4.5" -packed_struct = { version = "0.10.1", default-features = false } -fugit = "0.3.7" - -[dependencies.stm32f1xx-hal] -version = "0.10.0" -features = ["rt", "stm32f103"] - -[profile.dev] -codegen-units = 1 -opt-level = "z" - -[profile.dev.package."*"] -codegen-units = 1 -opt-level = "z" - -[profile.release] -# or "z" -opt-level = "z" diff --git a/firmware/descriptor.wara b/firmware/descriptor.wara deleted file mode 100644 index 1f08e83..0000000 --- a/firmware/descriptor.wara +++ /dev/null @@ -1,25 +0,0 @@ -[[applicationCollection]] -usage = ['Generic Desktop', 'Joystick'] - -[[applicationCollection.inputReport]] - -[[applicationCollection.inputReport.physicalCollection]] -usage = ['Generic Desktop', 'Pointer'] - -[[applicationCollection.inputReport.physicalCollection.variableItem]] -usage = ['Generic Desktop', 'X'] -logicalValueRange = [0, 65535] - -[[applicationCollection.inputReport.physicalCollection.variableItem]] -usage = ['Generic Desktop', 'Z'] -logicalValueRange = [0, 65535] - -[[applicationCollection.outputReport]] - -[[applicationCollection.outputReport.variableItem]] -usage = ['Haptics', 'Manual Trigger'] -logicalValueRange = [0, 48000] - -[[applicationCollection.outputReport.variableItem]] -usage = ['Haptics', 'Manual Trigger'] -logicalValueRange = [0, 65535] diff --git a/firmware/hidtools.sh b/firmware/hidtools.sh deleted file mode 100755 index 85f7524..0000000 --- a/firmware/hidtools.sh +++ /dev/null @@ -1,3 +0,0 @@ -#! /usr/bin/env bash -nix run github:feathecutie/hidtools -- -s descriptor.wara -cat descriptor.h |grep " 0x"|grep -v "ReportId" diff --git a/firmware/memory.x b/firmware/memory.x deleted file mode 100644 index 71f245d..0000000 --- a/firmware/memory.x +++ /dev/null @@ -1,6 +0,0 @@ -/* Linker script for the STM32F103C8T6 */ -MEMORY -{ - FLASH : ORIGIN = 0x08000000, LENGTH = 64K - RAM : ORIGIN = 0x20000000, LENGTH = 20K -} diff --git a/firmware/openocd.cfg b/firmware/openocd.cfg deleted file mode 100644 index 0f1a070..0000000 --- a/firmware/openocd.cfg +++ /dev/null @@ -1,12 +0,0 @@ -# Sample OpenOCD configuration for the STM32F3DISCOVERY development board - -# Depending on the hardware revision you got you'll have to pick ONE of these -# interfaces. At any time only one interface should be commented out. - -# Revision C (newer revision) -source [find interface/jlink.cfg] - -# Revision A and B (older revisions) -# source [find interface/stlink-v2.cfg] - -source [find target/stm32f1x.cfg] diff --git a/firmware/openocd.sh b/firmware/openocd.sh deleted file mode 100755 index d312b75..0000000 --- a/firmware/openocd.sh +++ /dev/null @@ -1,2 +0,0 @@ -#! /usr/bin/env bash -openocd -f interface/jlink.cfg -f ./swd.cfg -f target/stm32f1x.cfg diff --git a/firmware/src/device.rs b/firmware/src/device.rs deleted file mode 100644 index 990fac7..0000000 --- a/firmware/src/device.rs +++ /dev/null @@ -1,142 +0,0 @@ -use core::default::Default; -use fugit::ExtU32; -use packed_struct::prelude::*; -use usb_device::bus::UsbBus; -use usb_device::class_prelude::UsbBusAllocator; -use usbd_human_interface_device::{ - descriptor::InterfaceProtocol, - device::DeviceClass, - interface::{ - InBytes8, Interface, InterfaceBuilder, InterfaceConfig, OutBytes8, ReportSingle, - UsbAllocatable, - }, - UsbHidError, -}; - -// Generated using Waratah -#[rustfmt::skip] -pub const CUSTOM_DESCRIPTOR: &[u8] = &[ - 0x05, 0x01, // UsagePage(Generic Desktop[0x0001]) - 0x09, 0x04, // UsageId(Joystick[0x0004]) - 0xA1, 0x01, // Collection(Application) - 0x09, 0x01, // UsageId(Pointer[0x0001]) - 0xA1, 0x00, // Collection(Physical) - 0x09, 0x30, // UsageId(X[0x0030]) - 0x09, 0x32, // UsageId(Z[0x0032]) - 0x15, 0x00, // LogicalMinimum(0) - 0x26, 0xFF, 0x0F, // LogicalMaximum(4,095) - 0x95, 0x02, // ReportCount(2) - 0x75, 0x10, // ReportSize(16) - 0x81, 0x02, // Input(Data, Variable, Absolute, NoWrap, Linear, PreferredState, NoNullPosition, BitField) - 0xC0, // EndCollection() - 0x05, 0x09, // UsagePage(Button[0x0009]) - 0x19, 0x01, // UsageIdMin(Button 1[0x0001]) - 0x29, 0x10, // UsageIdMax(Button 16[0x0010]) - 0x25, 0x01, // LogicalMaximum(1) - 0x95, 0x10, // ReportCount(16) - 0x75, 0x01, // ReportSize(1) - 0x81, 0x02, // Input(Data, Variable, Absolute, NoWrap, Linear, PreferredState, NoNullPosition, BitField) - 0x06, 0x00, 0xFF, // Usage Page (Vendor Defined 0xFF00) - 0x09, 0x01, // Usage (0x01) - 0x27, 0x80, 0xBB, 0x00, 0x00, // LogicalMaximum(48,000) - 0x95, 0x01, // ReportCount(1) - 0x75, 0x10, // ReportSize(16) - 0x91, 0x02, // Output(Data, Variable, Absolute, NoWrap, Linear, PreferredState, NoNullPosition, NonVolatile, BitField) - 0x09, 0x21, // UsageId(Manual Trigger[0x0021]) - 0x27, 0xFF, 0xFF, 0x00, 0x00, // LogicalMaximum(65,535) - 0x91, 0x02, // Output(Data, Variable, Absolute, NoWrap, Linear, PreferredState, NoNullPosition, NonVolatile, BitField) - 0xC0, // EndCollection() -]; - -#[derive(Clone, Copy, Debug, Eq, PartialEq, Default, PackedStruct)] -#[packed_struct(endian = "lsb", size_bytes = "6")] -pub struct CustomInputReport { - #[packed_field] - pub x: u16, - #[packed_field] - pub y: u16, - #[packed_field] - pub buttons: u16, -} - -#[derive(Clone, Copy, Debug, Eq, PartialEq, Default, PackedStruct)] -#[packed_struct(endian = "lsb", size_bytes = "4")] -pub struct CustomOutputReport { - #[packed_field] - pub integ_lt: u16, - pub test: u16, -} - -pub struct CustomDevice<'a, B: UsbBus> { - interface: Interface<'a, B, InBytes8, OutBytes8, ReportSingle>, -} - -impl<'a, B: UsbBus> CustomDevice<'a, B> { - pub fn write_report(&mut self, report: &CustomInputReport) -> Result<(), UsbHidError> { - let data = report.pack().map_err(|_| UsbHidError::SerializationError)?; - self.interface - .write_report(&data) - .map(|_| ()) - .map_err(UsbHidError::from) - } - - pub fn read_report(&mut self) -> Result { - let mut data = [0, 0, 0, 0]; - self.interface - .read_report(&mut data[..]) - .map(|_| CustomOutputReport::unpack(&data).unwrap()) - .map_err(UsbHidError::from) - } -} - -impl<'a, B: UsbBus> DeviceClass<'a> for CustomDevice<'a, B> { - type I = Interface<'a, B, InBytes8, OutBytes8, ReportSingle>; - - fn interface(&mut self) -> &mut Self::I { - &mut self.interface - } - - fn reset(&mut self) {} - - fn tick(&mut self) -> Result<(), UsbHidError> { - Ok(()) - } -} - -pub struct CustomConfig<'a> { - interface: InterfaceConfig<'a, InBytes8, OutBytes8, ReportSingle>, -} - -impl<'a> Default for CustomConfig<'a> { - #[must_use] - fn default() -> Self { - Self::new( - InterfaceBuilder::new(CUSTOM_DESCRIPTOR) - .unwrap() - .boot_device(InterfaceProtocol::None) - .description(" CustomDevice") - .in_endpoint(10.millis()) - .unwrap() - .with_out_endpoint(10.millis()) - .unwrap() - .build(), - ) - } -} - -impl<'a> CustomConfig<'a> { - #[must_use] - pub fn new(interface: InterfaceConfig<'a, InBytes8, OutBytes8, ReportSingle>) -> Self { - Self { interface } - } -} - -impl<'a, B: UsbBus + 'a> UsbAllocatable<'a, B> for CustomConfig<'a> { - type Allocated = CustomDevice<'a, B>; - - fn allocate(self, usb_alloc: &'a UsbBusAllocator) -> Self::Allocated { - Self::Allocated { - interface: Interface::new(usb_alloc, self.interface), - } - } -} diff --git a/firmware/src/main.rs b/firmware/src/main.rs deleted file mode 100644 index 6512ce3..0000000 --- a/firmware/src/main.rs +++ /dev/null @@ -1,143 +0,0 @@ -#![deny(unsafe_code)] -#![no_main] -#![no_std] - -mod device; - -use panic_halt as _; - -use cortex_m::asm::delay; -use cortex_m_rt::entry; -use stm32f1xx_hal::{ - adc, - gpio::{Analog, Pin}, - pac, - prelude::*, - timer::{Channel, Tim2NoRemap}, -}; - -use stm32f1xx_hal::usb::{Peripheral, UsbBus}; -use usb_device::prelude::*; -use usbd_human_interface_device::prelude::*; - -use crate::device::{CustomConfig, CustomInputReport, CustomOutputReport}; - -struct MyPins { - pa1: Pin<'A', 1, Analog>, - pa2: Pin<'A', 2, Analog>, -} - -#[entry] -fn main() -> ! { - // ====================== general setup ================= - // Acquire peripherals - // let cp = cortex_m::Peripherals::take().unwrap(); - let p = pac::Peripherals::take().unwrap(); - let mut flash = p.FLASH.constrain(); - let rcc = p.RCC.constrain(); - - // Setup GPIOA - let mut gpioa = p.GPIOA.split(); - - // configure clock - let clocks = rcc - .cfgr - .use_hse(16.MHz()) - .sysclk(48.MHz()) - .pclk1(24.MHz()) - .freeze(&mut flash.acr); - - // ====================== USB setup ================= - assert!(clocks.usbclk_valid()); - let mut usb_dp = gpioa.pa12.into_push_pull_output(&mut gpioa.crh); - usb_dp.set_low(); - delay(clocks.sysclk().raw() / 100); - - let usb = Peripheral { - usb: p.USB, - pin_dm: gpioa.pa11, - pin_dp: usb_dp.into_floating_input(&mut gpioa.crh), - }; - let usb_bus = UsbBus::new(usb); - - let mut consumer = UsbHidClassBuilder::new() - .add_device(CustomConfig::default()) - .build(&usb_bus); - - let mut usb_dev = UsbDeviceBuilder::new(&usb_bus, UsbVidPid(0x16c0, 0x27dd)) - .manufacturer("FLC Meow") - .product("Pedestal box") - .serial_number("01189998819991197253") - .build(); - - // ====================== ADC setup ================= - // Setup ADC - let mut adc1 = adc::Adc::adc1(p.ADC1, clocks); - - // ====================== Pin setup ================= - let mut input_pins = MyPins { - pa1: gpioa.pa1.into_analog(&mut gpioa.crl), - pa2: gpioa.pa2.into_analog(&mut gpioa.crl), - }; - - let mut last = get_report(&mut input_pins, &mut adc1); - - // ====================== PWM setup ================= - let mut afio = p.AFIO.constrain(); - let c1 = gpioa.pa0.into_alternate_push_pull(&mut gpioa.crl); - let mut pwm = p - .TIM2 - .pwm_hz::(c1, &mut afio.mapr, 1.kHz(), &clocks); - pwm.enable(Channel::C1); - let pwm_max = pwm.get_max_duty() as u16; //48000 in our case - - // ====================== Main loop ================= - loop { - let report = get_report(&mut input_pins, &mut adc1); - if report != last { - match consumer.device().write_report(&report) { - Err(UsbHidError::WouldBlock) => {} - Ok(_) => { - last = report; - } - Err(e) => { - core::panic!("Failed to write consumer report: {:?}", e) - } - } - } - - if usb_dev.poll(&mut [&mut consumer]) { - match consumer.device().read_report() { - Err(UsbHidError::WouldBlock) => {} - Ok(output) => { - let pwm_val: u16; - if output.integ_lt > pwm_max { - pwm_val = pwm_max; - } - else { - pwm_val = output.integ_lt; - } - pwm.set_duty(Channel::C1, pwm_val); - } - Err(e) => { - core::panic!("Failed to write consumer report: {:?}", e) - } - } - } - - } -} - -// Returns a CustomInputReport from the inputs given -fn get_report(pins: &mut MyPins, adc1: &mut adc::Adc) -> CustomInputReport { - let integ_lt: u16 = adc1.read(&mut pins.pa1).unwrap(); - let flood_lt: u16 = adc1.read(&mut pins.pa2).unwrap(); - let buttons: u16 = 0; - - - CustomInputReport { - x: integ_lt.into(), - y: flood_lt.into(), - buttons, - } -} diff --git a/firmware/swd.cfg b/firmware/swd.cfg deleted file mode 100644 index b263065..0000000 --- a/firmware/swd.cfg +++ /dev/null @@ -1 +0,0 @@ -transport select swd