Przeglądaj źródła

remove temporarily

MX 2 lat temu
rodzic
commit
56c6ebb9e4

+ 0 - 1
ReadMe.md

@@ -188,7 +188,6 @@ The Flipper and its community wouldn't be as rich as it is without your contribu
 | Atomic Dice Roller | ![GPIO Badge] | [by nmrr](https://github.com/nmrr/flipperzero-atomicdiceroller) |  | ![None Badge] |
 | NRF24 Channel Scanner | ![GPIO Badge] | [by htotoo](https://github.com/htotoo/NRF24ChannelScanner) |  | [![Author Badge]](https://lab.flipper.net/apps/nrf24channelscanner) |
 | Mx2125 - Step Counter | ![GPIO Badge] | [by grugnoymeme](https://github.com/grugnoymeme/flipperzero-stepcounter-fap) |  | ![None Badge] |
-| SD SPI | ![GPIO Badge] | [by Gl1tchub](https://github.com/Gl1tchub/Flipperzero-SD-SPI) |  | ![None Badge] |
 | TEA5767 Radio control | ![GPIO Badge] | [by victormico](https://github.com/victormico/flipperzero-radio/tree/main) |  | ![None Badge] |
 | IR Remote | ![IR Badge] | [by Hong5489](https://github.com/Hong5489/ir_remote) | improvements [by friebel](https://github.com/RogueMaster/flipperzero-firmware-wPlugins/pull/535) - Hold Option, RAW support [by d4ve10](https://github.com/d4ve10/ir_remote/tree/infrared_hold_option) | ![None Badge] |
 | IR Intervalometer | ![IR Badge] | [by Nitepone](https://github.com/Nitepone/flipper-intervalometer) |  | [![UFW Badge]](https://lab.flipper.net/apps/sony_intervalometer) |

+ 0 - 1
non_catalog_apps/sd_spi/.gitkeep

@@ -1 +0,0 @@
-

+ 0 - 674
non_catalog_apps/sd_spi/LICENSE

@@ -1,674 +0,0 @@
-                    GNU GENERAL PUBLIC LICENSE
-                       Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-                            Preamble
-
-  The GNU General Public License is a free, copyleft license for
-software and other kinds of works.
-
-  The licenses for most software and other practical works are designed
-to take away your freedom to share and change the works.  By contrast,
-the GNU General Public License is intended to guarantee your freedom to
-share and change all versions of a program--to make sure it remains free
-software for all its users.  We, the Free Software Foundation, use the
-GNU General Public License for most of our software; it applies also to
-any other work released this way by its authors.  You can apply it to
-your programs, too.
-
-  When we speak of free software, we are referring to freedom, not
-price.  Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-them if you wish), that you receive source code or can get it if you
-want it, that you can change the software or use pieces of it in new
-free programs, and that you know you can do these things.
-
-  To protect your rights, we need to prevent others from denying you
-these rights or asking you to surrender the rights.  Therefore, you have
-certain responsibilities if you distribute copies of the software, or if
-you modify it: responsibilities to respect the freedom of others.
-
-  For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must pass on to the recipients the same
-freedoms that you received.  You must make sure that they, too, receive
-or can get the source code.  And you must show them these terms so they
-know their rights.
-
-  Developers that use the GNU GPL protect your rights with two steps:
-(1) assert copyright on the software, and (2) offer you this License
-giving you legal permission to copy, distribute and/or modify it.
-
-  For the developers' and authors' protection, the GPL clearly explains
-that there is no warranty for this free software.  For both users' and
-authors' sake, the GPL requires that modified versions be marked as
-changed, so that their problems will not be attributed erroneously to
-authors of previous versions.
-
-  Some devices are designed to deny users access to install or run
-modified versions of the software inside them, although the manufacturer
-can do so.  This is fundamentally incompatible with the aim of
-protecting users' freedom to change the software.  The systematic
-pattern of such abuse occurs in the area of products for individuals to
-use, which is precisely where it is most unacceptable.  Therefore, we
-have designed this version of the GPL to prohibit the practice for those
-products.  If such problems arise substantially in other domains, we
-stand ready to extend this provision to those domains in future versions
-of the GPL, as needed to protect the freedom of users.
-
-  Finally, every program is threatened constantly by software patents.
-States should not allow patents to restrict development and use of
-software on general-purpose computers, but in those that do, we wish to
-avoid the special danger that patents applied to a free program could
-make it effectively proprietary.  To prevent this, the GPL assures that
-patents cannot be used to render the program non-free.
-
-  The precise terms and conditions for copying, distribution and
-modification follow.
-
-                       TERMS AND CONDITIONS
-
-  0. Definitions.
-
-  "This License" refers to version 3 of the GNU General Public License.
-
-  "Copyright" also means copyright-like laws that apply to other kinds of
-works, such as semiconductor masks.
-
-  "The Program" refers to any copyrightable work licensed under this
-License.  Each licensee is addressed as "you".  "Licensees" and
-"recipients" may be individuals or organizations.
-
-  To "modify" a work means to copy from or adapt all or part of the work
-in a fashion requiring copyright permission, other than the making of an
-exact copy.  The resulting work is called a "modified version" of the
-earlier work or a work "based on" the earlier work.
-
-  A "covered work" means either the unmodified Program or a work based
-on the Program.
-
-  To "propagate" a work means to do anything with it that, without
-permission, would make you directly or secondarily liable for
-infringement under applicable copyright law, except executing it on a
-computer or modifying a private copy.  Propagation includes copying,
-distribution (with or without modification), making available to the
-public, and in some countries other activities as well.
-
-  To "convey" a work means any kind of propagation that enables other
-parties to make or receive copies.  Mere interaction with a user through
-a computer network, with no transfer of a copy, is not conveying.
-
-  An interactive user interface displays "Appropriate Legal Notices"
-to the extent that it includes a convenient and prominently visible
-feature that (1) displays an appropriate copyright notice, and (2)
-tells the user that there is no warranty for the work (except to the
-extent that warranties are provided), that licensees may convey the
-work under this License, and how to view a copy of this License.  If
-the interface presents a list of user commands or options, such as a
-menu, a prominent item in the list meets this criterion.
-
-  1. Source Code.
-
-  The "source code" for a work means the preferred form of the work
-for making modifications to it.  "Object code" means any non-source
-form of a work.
-
-  A "Standard Interface" means an interface that either is an official
-standard defined by a recognized standards body, or, in the case of
-interfaces specified for a particular programming language, one that
-is widely used among developers working in that language.
-
-  The "System Libraries" of an executable work include anything, other
-than the work as a whole, that (a) is included in the normal form of
-packaging a Major Component, but which is not part of that Major
-Component, and (b) serves only to enable use of the work with that
-Major Component, or to implement a Standard Interface for which an
-implementation is available to the public in source code form.  A
-"Major Component", in this context, means a major essential component
-(kernel, window system, and so on) of the specific operating system
-(if any) on which the executable work runs, or a compiler used to
-produce the work, or an object code interpreter used to run it.
-
-  The "Corresponding Source" for a work in object code form means all
-the source code needed to generate, install, and (for an executable
-work) run the object code and to modify the work, including scripts to
-control those activities.  However, it does not include the work's
-System Libraries, or general-purpose tools or generally available free
-programs which are used unmodified in performing those activities but
-which are not part of the work.  For example, Corresponding Source
-includes interface definition files associated with source files for
-the work, and the source code for shared libraries and dynamically
-linked subprograms that the work is specifically designed to require,
-such as by intimate data communication or control flow between those
-subprograms and other parts of the work.
-
-  The Corresponding Source need not include anything that users
-can regenerate automatically from other parts of the Corresponding
-Source.
-
-  The Corresponding Source for a work in source code form is that
-same work.
-
-  2. Basic Permissions.
-
-  All rights granted under this License are granted for the term of
-copyright on the Program, and are irrevocable provided the stated
-conditions are met.  This License explicitly affirms your unlimited
-permission to run the unmodified Program.  The output from running a
-covered work is covered by this License only if the output, given its
-content, constitutes a covered work.  This License acknowledges your
-rights of fair use or other equivalent, as provided by copyright law.
-
-  You may make, run and propagate covered works that you do not
-convey, without conditions so long as your license otherwise remains
-in force.  You may convey covered works to others for the sole purpose
-of having them make modifications exclusively for you, or provide you
-with facilities for running those works, provided that you comply with
-the terms of this License in conveying all material for which you do
-not control copyright.  Those thus making or running the covered works
-for you must do so exclusively on your behalf, under your direction
-and control, on terms that prohibit them from making any copies of
-your copyrighted material outside their relationship with you.
-
-  Conveying under any other circumstances is permitted solely under
-the conditions stated below.  Sublicensing is not allowed; section 10
-makes it unnecessary.
-
-  3. Protecting Users' Legal Rights From Anti-Circumvention Law.
-
-  No covered work shall be deemed part of an effective technological
-measure under any applicable law fulfilling obligations under article
-11 of the WIPO copyright treaty adopted on 20 December 1996, or
-similar laws prohibiting or restricting circumvention of such
-measures.
-
-  When you convey a covered work, you waive any legal power to forbid
-circumvention of technological measures to the extent such circumvention
-is effected by exercising rights under this License with respect to
-the covered work, and you disclaim any intention to limit operation or
-modification of the work as a means of enforcing, against the work's
-users, your or third parties' legal rights to forbid circumvention of
-technological measures.
-
-  4. Conveying Verbatim Copies.
-
-  You may convey verbatim copies of the Program's source code as you
-receive it, in any medium, provided that you conspicuously and
-appropriately publish on each copy an appropriate copyright notice;
-keep intact all notices stating that this License and any
-non-permissive terms added in accord with section 7 apply to the code;
-keep intact all notices of the absence of any warranty; and give all
-recipients a copy of this License along with the Program.
-
-  You may charge any price or no price for each copy that you convey,
-and you may offer support or warranty protection for a fee.
-
-  5. Conveying Modified Source Versions.
-
-  You may convey a work based on the Program, or the modifications to
-produce it from the Program, in the form of source code under the
-terms of section 4, provided that you also meet all of these conditions:
-
-    a) The work must carry prominent notices stating that you modified
-    it, and giving a relevant date.
-
-    b) The work must carry prominent notices stating that it is
-    released under this License and any conditions added under section
-    7.  This requirement modifies the requirement in section 4 to
-    "keep intact all notices".
-
-    c) You must license the entire work, as a whole, under this
-    License to anyone who comes into possession of a copy.  This
-    License will therefore apply, along with any applicable section 7
-    additional terms, to the whole of the work, and all its parts,
-    regardless of how they are packaged.  This License gives no
-    permission to license the work in any other way, but it does not
-    invalidate such permission if you have separately received it.
-
-    d) If the work has interactive user interfaces, each must display
-    Appropriate Legal Notices; however, if the Program has interactive
-    interfaces that do not display Appropriate Legal Notices, your
-    work need not make them do so.
-
-  A compilation of a covered work with other separate and independent
-works, which are not by their nature extensions of the covered work,
-and which are not combined with it such as to form a larger program,
-in or on a volume of a storage or distribution medium, is called an
-"aggregate" if the compilation and its resulting copyright are not
-used to limit the access or legal rights of the compilation's users
-beyond what the individual works permit.  Inclusion of a covered work
-in an aggregate does not cause this License to apply to the other
-parts of the aggregate.
-
-  6. Conveying Non-Source Forms.
-
-  You may convey a covered work in object code form under the terms
-of sections 4 and 5, provided that you also convey the
-machine-readable Corresponding Source under the terms of this License,
-in one of these ways:
-
-    a) Convey the object code in, or embodied in, a physical product
-    (including a physical distribution medium), accompanied by the
-    Corresponding Source fixed on a durable physical medium
-    customarily used for software interchange.
-
-    b) Convey the object code in, or embodied in, a physical product
-    (including a physical distribution medium), accompanied by a
-    written offer, valid for at least three years and valid for as
-    long as you offer spare parts or customer support for that product
-    model, to give anyone who possesses the object code either (1) a
-    copy of the Corresponding Source for all the software in the
-    product that is covered by this License, on a durable physical
-    medium customarily used for software interchange, for a price no
-    more than your reasonable cost of physically performing this
-    conveying of source, or (2) access to copy the
-    Corresponding Source from a network server at no charge.
-
-    c) Convey individual copies of the object code with a copy of the
-    written offer to provide the Corresponding Source.  This
-    alternative is allowed only occasionally and noncommercially, and
-    only if you received the object code with such an offer, in accord
-    with subsection 6b.
-
-    d) Convey the object code by offering access from a designated
-    place (gratis or for a charge), and offer equivalent access to the
-    Corresponding Source in the same way through the same place at no
-    further charge.  You need not require recipients to copy the
-    Corresponding Source along with the object code.  If the place to
-    copy the object code is a network server, the Corresponding Source
-    may be on a different server (operated by you or a third party)
-    that supports equivalent copying facilities, provided you maintain
-    clear directions next to the object code saying where to find the
-    Corresponding Source.  Regardless of what server hosts the
-    Corresponding Source, you remain obligated to ensure that it is
-    available for as long as needed to satisfy these requirements.
-
-    e) Convey the object code using peer-to-peer transmission, provided
-    you inform other peers where the object code and Corresponding
-    Source of the work are being offered to the general public at no
-    charge under subsection 6d.
-
-  A separable portion of the object code, whose source code is excluded
-from the Corresponding Source as a System Library, need not be
-included in conveying the object code work.
-
-  A "User Product" is either (1) a "consumer product", which means any
-tangible personal property which is normally used for personal, family,
-or household purposes, or (2) anything designed or sold for incorporation
-into a dwelling.  In determining whether a product is a consumer product,
-doubtful cases shall be resolved in favor of coverage.  For a particular
-product received by a particular user, "normally used" refers to a
-typical or common use of that class of product, regardless of the status
-of the particular user or of the way in which the particular user
-actually uses, or expects or is expected to use, the product.  A product
-is a consumer product regardless of whether the product has substantial
-commercial, industrial or non-consumer uses, unless such uses represent
-the only significant mode of use of the product.
-
-  "Installation Information" for a User Product means any methods,
-procedures, authorization keys, or other information required to install
-and execute modified versions of a covered work in that User Product from
-a modified version of its Corresponding Source.  The information must
-suffice to ensure that the continued functioning of the modified object
-code is in no case prevented or interfered with solely because
-modification has been made.
-
-  If you convey an object code work under this section in, or with, or
-specifically for use in, a User Product, and the conveying occurs as
-part of a transaction in which the right of possession and use of the
-User Product is transferred to the recipient in perpetuity or for a
-fixed term (regardless of how the transaction is characterized), the
-Corresponding Source conveyed under this section must be accompanied
-by the Installation Information.  But this requirement does not apply
-if neither you nor any third party retains the ability to install
-modified object code on the User Product (for example, the work has
-been installed in ROM).
-
-  The requirement to provide Installation Information does not include a
-requirement to continue to provide support service, warranty, or updates
-for a work that has been modified or installed by the recipient, or for
-the User Product in which it has been modified or installed.  Access to a
-network may be denied when the modification itself materially and
-adversely affects the operation of the network or violates the rules and
-protocols for communication across the network.
-
-  Corresponding Source conveyed, and Installation Information provided,
-in accord with this section must be in a format that is publicly
-documented (and with an implementation available to the public in
-source code form), and must require no special password or key for
-unpacking, reading or copying.
-
-  7. Additional Terms.
-
-  "Additional permissions" are terms that supplement the terms of this
-License by making exceptions from one or more of its conditions.
-Additional permissions that are applicable to the entire Program shall
-be treated as though they were included in this License, to the extent
-that they are valid under applicable law.  If additional permissions
-apply only to part of the Program, that part may be used separately
-under those permissions, but the entire Program remains governed by
-this License without regard to the additional permissions.
-
-  When you convey a copy of a covered work, you may at your option
-remove any additional permissions from that copy, or from any part of
-it.  (Additional permissions may be written to require their own
-removal in certain cases when you modify the work.)  You may place
-additional permissions on material, added by you to a covered work,
-for which you have or can give appropriate copyright permission.
-
-  Notwithstanding any other provision of this License, for material you
-add to a covered work, you may (if authorized by the copyright holders of
-that material) supplement the terms of this License with terms:
-
-    a) Disclaiming warranty or limiting liability differently from the
-    terms of sections 15 and 16 of this License; or
-
-    b) Requiring preservation of specified reasonable legal notices or
-    author attributions in that material or in the Appropriate Legal
-    Notices displayed by works containing it; or
-
-    c) Prohibiting misrepresentation of the origin of that material, or
-    requiring that modified versions of such material be marked in
-    reasonable ways as different from the original version; or
-
-    d) Limiting the use for publicity purposes of names of licensors or
-    authors of the material; or
-
-    e) Declining to grant rights under trademark law for use of some
-    trade names, trademarks, or service marks; or
-
-    f) Requiring indemnification of licensors and authors of that
-    material by anyone who conveys the material (or modified versions of
-    it) with contractual assumptions of liability to the recipient, for
-    any liability that these contractual assumptions directly impose on
-    those licensors and authors.
-
-  All other non-permissive additional terms are considered "further
-restrictions" within the meaning of section 10.  If the Program as you
-received it, or any part of it, contains a notice stating that it is
-governed by this License along with a term that is a further
-restriction, you may remove that term.  If a license document contains
-a further restriction but permits relicensing or conveying under this
-License, you may add to a covered work material governed by the terms
-of that license document, provided that the further restriction does
-not survive such relicensing or conveying.
-
-  If you add terms to a covered work in accord with this section, you
-must place, in the relevant source files, a statement of the
-additional terms that apply to those files, or a notice indicating
-where to find the applicable terms.
-
-  Additional terms, permissive or non-permissive, may be stated in the
-form of a separately written license, or stated as exceptions;
-the above requirements apply either way.
-
-  8. Termination.
-
-  You may not propagate or modify a covered work except as expressly
-provided under this License.  Any attempt otherwise to propagate or
-modify it is void, and will automatically terminate your rights under
-this License (including any patent licenses granted under the third
-paragraph of section 11).
-
-  However, if you cease all violation of this License, then your
-license from a particular copyright holder is reinstated (a)
-provisionally, unless and until the copyright holder explicitly and
-finally terminates your license, and (b) permanently, if the copyright
-holder fails to notify you of the violation by some reasonable means
-prior to 60 days after the cessation.
-
-  Moreover, your license from a particular copyright holder is
-reinstated permanently if the copyright holder notifies you of the
-violation by some reasonable means, this is the first time you have
-received notice of violation of this License (for any work) from that
-copyright holder, and you cure the violation prior to 30 days after
-your receipt of the notice.
-
-  Termination of your rights under this section does not terminate the
-licenses of parties who have received copies or rights from you under
-this License.  If your rights have been terminated and not permanently
-reinstated, you do not qualify to receive new licenses for the same
-material under section 10.
-
-  9. Acceptance Not Required for Having Copies.
-
-  You are not required to accept this License in order to receive or
-run a copy of the Program.  Ancillary propagation of a covered work
-occurring solely as a consequence of using peer-to-peer transmission
-to receive a copy likewise does not require acceptance.  However,
-nothing other than this License grants you permission to propagate or
-modify any covered work.  These actions infringe copyright if you do
-not accept this License.  Therefore, by modifying or propagating a
-covered work, you indicate your acceptance of this License to do so.
-
-  10. Automatic Licensing of Downstream Recipients.
-
-  Each time you convey a covered work, the recipient automatically
-receives a license from the original licensors, to run, modify and
-propagate that work, subject to this License.  You are not responsible
-for enforcing compliance by third parties with this License.
-
-  An "entity transaction" is a transaction transferring control of an
-organization, or substantially all assets of one, or subdividing an
-organization, or merging organizations.  If propagation of a covered
-work results from an entity transaction, each party to that
-transaction who receives a copy of the work also receives whatever
-licenses to the work the party's predecessor in interest had or could
-give under the previous paragraph, plus a right to possession of the
-Corresponding Source of the work from the predecessor in interest, if
-the predecessor has it or can get it with reasonable efforts.
-
-  You may not impose any further restrictions on the exercise of the
-rights granted or affirmed under this License.  For example, you may
-not impose a license fee, royalty, or other charge for exercise of
-rights granted under this License, and you may not initiate litigation
-(including a cross-claim or counterclaim in a lawsuit) alleging that
-any patent claim is infringed by making, using, selling, offering for
-sale, or importing the Program or any portion of it.
-
-  11. Patents.
-
-  A "contributor" is a copyright holder who authorizes use under this
-License of the Program or a work on which the Program is based.  The
-work thus licensed is called the contributor's "contributor version".
-
-  A contributor's "essential patent claims" are all patent claims
-owned or controlled by the contributor, whether already acquired or
-hereafter acquired, that would be infringed by some manner, permitted
-by this License, of making, using, or selling its contributor version,
-but do not include claims that would be infringed only as a
-consequence of further modification of the contributor version.  For
-purposes of this definition, "control" includes the right to grant
-patent sublicenses in a manner consistent with the requirements of
-this License.
-
-  Each contributor grants you a non-exclusive, worldwide, royalty-free
-patent license under the contributor's essential patent claims, to
-make, use, sell, offer for sale, import and otherwise run, modify and
-propagate the contents of its contributor version.
-
-  In the following three paragraphs, a "patent license" is any express
-agreement or commitment, however denominated, not to enforce a patent
-(such as an express permission to practice a patent or covenant not to
-sue for patent infringement).  To "grant" such a patent license to a
-party means to make such an agreement or commitment not to enforce a
-patent against the party.
-
-  If you convey a covered work, knowingly relying on a patent license,
-and the Corresponding Source of the work is not available for anyone
-to copy, free of charge and under the terms of this License, through a
-publicly available network server or other readily accessible means,
-then you must either (1) cause the Corresponding Source to be so
-available, or (2) arrange to deprive yourself of the benefit of the
-patent license for this particular work, or (3) arrange, in a manner
-consistent with the requirements of this License, to extend the patent
-license to downstream recipients.  "Knowingly relying" means you have
-actual knowledge that, but for the patent license, your conveying the
-covered work in a country, or your recipient's use of the covered work
-in a country, would infringe one or more identifiable patents in that
-country that you have reason to believe are valid.
-
-  If, pursuant to or in connection with a single transaction or
-arrangement, you convey, or propagate by procuring conveyance of, a
-covered work, and grant a patent license to some of the parties
-receiving the covered work authorizing them to use, propagate, modify
-or convey a specific copy of the covered work, then the patent license
-you grant is automatically extended to all recipients of the covered
-work and works based on it.
-
-  A patent license is "discriminatory" if it does not include within
-the scope of its coverage, prohibits the exercise of, or is
-conditioned on the non-exercise of one or more of the rights that are
-specifically granted under this License.  You may not convey a covered
-work if you are a party to an arrangement with a third party that is
-in the business of distributing software, under which you make payment
-to the third party based on the extent of your activity of conveying
-the work, and under which the third party grants, to any of the
-parties who would receive the covered work from you, a discriminatory
-patent license (a) in connection with copies of the covered work
-conveyed by you (or copies made from those copies), or (b) primarily
-for and in connection with specific products or compilations that
-contain the covered work, unless you entered into that arrangement,
-or that patent license was granted, prior to 28 March 2007.
-
-  Nothing in this License shall be construed as excluding or limiting
-any implied license or other defenses to infringement that may
-otherwise be available to you under applicable patent law.
-
-  12. No Surrender of Others' Freedom.
-
-  If conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License.  If you cannot convey a
-covered work so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you may
-not convey it at all.  For example, if you agree to terms that obligate you
-to collect a royalty for further conveying from those to whom you convey
-the Program, the only way you could satisfy both those terms and this
-License would be to refrain entirely from conveying the Program.
-
-  13. Use with the GNU Affero General Public License.
-
-  Notwithstanding any other provision of this License, you have
-permission to link or combine any covered work with a work licensed
-under version 3 of the GNU Affero General Public License into a single
-combined work, and to convey the resulting work.  The terms of this
-License will continue to apply to the part which is the covered work,
-but the special requirements of the GNU Affero General Public License,
-section 13, concerning interaction through a network will apply to the
-combination as such.
-
-  14. Revised Versions of this License.
-
-  The Free Software Foundation may publish revised and/or new versions of
-the GNU General Public License from time to time.  Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-  Each version is given a distinguishing version number.  If the
-Program specifies that a certain numbered version of the GNU General
-Public License "or any later version" applies to it, you have the
-option of following the terms and conditions either of that numbered
-version or of any later version published by the Free Software
-Foundation.  If the Program does not specify a version number of the
-GNU General Public License, you may choose any version ever published
-by the Free Software Foundation.
-
-  If the Program specifies that a proxy can decide which future
-versions of the GNU General Public License can be used, that proxy's
-public statement of acceptance of a version permanently authorizes you
-to choose that version for the Program.
-
-  Later license versions may give you additional or different
-permissions.  However, no additional obligations are imposed on any
-author or copyright holder as a result of your choosing to follow a
-later version.
-
-  15. Disclaimer of Warranty.
-
-  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
-APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
-HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
-OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
-IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
-ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
-  16. Limitation of Liability.
-
-  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
-THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
-GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
-USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
-DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
-PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
-EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGES.
-
-  17. Interpretation of Sections 15 and 16.
-
-  If the disclaimer of warranty and limitation of liability provided
-above cannot be given local legal effect according to their terms,
-reviewing courts shall apply local law that most closely approximates
-an absolute waiver of all civil liability in connection with the
-Program, unless a warranty or assumption of liability accompanies a
-copy of the Program in return for a fee.
-
-                     END OF TERMS AND CONDITIONS
-
-            How to Apply These Terms to Your New Programs
-
-  If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
-  To do so, attach the following notices to the program.  It is safest
-to attach them to the start of each source file to most effectively
-state the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
-    <one line to give the program's name and a brief idea of what it does.>
-    Copyright (C) <year>  <name of author>
-
-    This program is free software: you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation, either version 3 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program.  If not, see <https://www.gnu.org/licenses/>.
-
-Also add information on how to contact you by electronic and paper mail.
-
-  If the program does terminal interaction, make it output a short
-notice like this when it starts in an interactive mode:
-
-    <program>  Copyright (C) <year>  <name of author>
-    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
-    This is free software, and you are welcome to redistribute it
-    under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License.  Of course, your program's commands
-might be different; for a GUI interface, you would use an "about box".
-
-  You should also get your employer (if you work as a programmer) or school,
-if any, to sign a "copyright disclaimer" for the program, if necessary.
-For more information on this, and how to apply and follow the GNU GPL, see
-<https://www.gnu.org/licenses/>.
-
-  The GNU General Public License does not permit incorporating your program
-into proprietary programs.  If your program is a subroutine library, you
-may consider it more useful to permit linking proprietary applications with
-the library.  If this is what you want to do, use the GNU Lesser General
-Public License instead of this License.  But first, please read
-<https://www.gnu.org/licenses/why-not-lgpl.html>.

+ 0 - 33
non_catalog_apps/sd_spi/README.md

@@ -1,33 +0,0 @@
-# Flipperzero-SD-SPI
-Flipper Zero FAP for Lock and Unlock SD card / Micro SD card through SPI protocol (CMD42).
-
-<p align="center">
-<img src="SDSPI.gif" />
-</p>
-
-## Pinout ##
-
-Without Flipper Zero SDBoard the SD card it must be connected as in the table below
-
-Flipper Zero  | SD Card
-------------- | -------------
-9/3.3V  | +3.3V
-8/GND  | GND
-2/A7  | Mosi
-3/A6  | Miso
-4/A4  | CS
-5/B3  | SCK
-
-<p align="center">
-<img src="scheme.png" />
-</p>
-
-## Usage ##
-
-Whenever an sd card is connected it is required make a "Init", if the operation is successul in the "status" tab R1 is "NO ERROR" and it is possible execute other commands.
-
-"Lock" and "Unlock" work with password set in namesake tab.
-
-Force Erase allow the removal of unknown password from SD but erases all content.
-
-After the first save, the password is stored in apps_data/sdspi/pwd.txt. you can change it to use characters not found on the flipper keyboard.

+ 0 - 14
non_catalog_apps/sd_spi/application.fam

@@ -1,14 +0,0 @@
-App(
-    appid="sd_spi_app",  # Must be unique
-    name="SD SPI",  # Displayed in menus
-    apptype=FlipperAppType.EXTERNAL,
-    entry_point="sd_spi_app",
-    stack_size=2 * 1024,
-    fap_category="GPIO",
-    # Optional values
-    # fap_version=(0, 1),  # (major, minor)
-    fap_icon="sd_spi_app_10px.png",  # 10x10 1-bit PNG
-    fap_description="SD SPI Lock Management",
-    # fap_weburl="https://github.com/Gl1tchub/Flipperzero-SD-SPI",
-    # fap_icon_assets="images",  # Image assets to compile for this application
-)

+ 0 - 949
non_catalog_apps/sd_spi/sd_spi.c

@@ -1,949 +0,0 @@
-#include "sd_spi.h"
-// #include "sector_cache.h"
-#include <furi.h>
-#include <furi_hal.h>
-#include <furi/core/core_defines.h>
-
-#define SD_SPI_DEBUG 1
-#define TAG "SdSpi"
-
-#ifdef SD_SPI_DEBUG
-#define sd_spi_debug(...) FURI_LOG_I(TAG, __VA_ARGS__)
-#else
-#define sd_spi_debug(...)
-#endif
-
-#define SD_CMD_LENGTH 6
-#define SD_DUMMY_BYTE 0xFF
-#define SD_ANSWER_RETRY_COUNT 8
-#define SD_IDLE_RETRY_COUNT 100
-
-#define FLAG_SET(x, y) (((x) & (y)) == (y))
-
-static bool sd_high_capacity = false;
-SdSpiCmdAnswer cmd_answer = {
-    .r1 = SD_DUMMY_BYTE,
-    .r2 = SD_DUMMY_BYTE,
-    .r3 = SD_DUMMY_BYTE,
-    .r4 = SD_DUMMY_BYTE,
-    .r5 = SD_DUMMY_BYTE,
-};
-
-typedef enum {
-    SdSpiDataResponceOK = 0x05,
-    SdSpiDataResponceCRCError = 0x0B,
-    SdSpiDataResponceWriteError = 0x0D,
-    SdSpiDataResponceOtherError = 0xFF,
-} SdSpiDataResponce;
-
-typedef enum {
-    SdSpiCmdAnswerTypeR1,
-    SdSpiCmdAnswerTypeR1B,
-    SdSpiCmdAnswerTypeR2,
-    SdSpiCmdAnswerTypeR3,
-    SdSpiCmdAnswerTypeR4R5,
-    SdSpiCmdAnswerTypeR7,
-} SdSpiCmdAnswerType;
-
-typedef enum {
-    SD_CMD0_GO_IDLE_STATE = 0,
-    SD_CMD1_SEND_OP_COND = 1,
-    SD_CMD8_SEND_IF_COND = 8,
-    SD_CMD9_SEND_CSD = 9,
-    SD_CMD10_SEND_CID = 10,
-    SD_CMD12_STOP_TRANSMISSION = 12,
-    SD_CMD13_SEND_STATUS = 13,
-    SD_CMD16_SET_BLOCKLEN = 16,
-    SD_CMD17_READ_SINGLE_BLOCK = 17,
-    SD_CMD18_READ_MULT_BLOCK = 18,
-    SD_CMD23_SET_BLOCK_COUNT = 23,
-    SD_CMD24_WRITE_SINGLE_BLOCK = 24,
-    SD_CMD25_WRITE_MULT_BLOCK = 25,
-    SD_CMD27_PROG_CSD = 27,
-    SD_CMD28_SET_WRITE_PROT = 28,
-    SD_CMD29_CLR_WRITE_PROT = 29,
-    SD_CMD30_SEND_WRITE_PROT = 30,
-    SD_CMD32_SD_ERASE_GRP_START = 32,
-    SD_CMD33_SD_ERASE_GRP_END = 33,
-    SD_CMD34_UNTAG_SECTOR = 34,
-    SD_CMD35_ERASE_GRP_START = 35,
-    SD_CMD36_ERASE_GRP_END = 36,
-    SD_CMD37_UNTAG_ERASE_GROUP = 37,
-    SD_CMD38_ERASE = 38,
-    SD_CMD41_SD_APP_OP_COND = 41,
-    SD_CMD42_LOCK_UNLOCK = 42,
-    SD_CMD55_APP_CMD = 55,
-    SD_CMD58_READ_OCR = 58,
-} SdSpiCmd;
-
-/** Data tokens */
-typedef enum {
-    SD_TOKEN_START_DATA_SINGLE_BLOCK_READ = 0xFE,
-    SD_TOKEN_START_DATA_MULTIPLE_BLOCK_READ = 0xFE,
-    SD_TOKEN_START_DATA_SINGLE_BLOCK_WRITE = 0xFE,
-    SD_TOKEN_START_DATA_MULTIPLE_BLOCK_WRITE = 0xFC,
-    SD_TOKEN_STOP_DATA_MULTIPLE_BLOCK_WRITE = 0xFD,
-} SdSpiToken;
-
-
-static inline void sd_spi_select_card() {
-    furi_hal_gpio_write(furi_hal_sd_spi_handle->cs, false);
-    furi_delay_us(10); // Entry guard time for some SD cards
-}
-
-static inline void sd_spi_deselect_card() {
-    furi_delay_us(10); // Exit guard time for some SD cards
-    furi_hal_gpio_write(furi_hal_sd_spi_handle->cs, true);
-}
-
-// void sd_bytes_debug(uint8_t* bytes, size_t size){
-//   char out[size];
-//   for(size_t i = 0; i < size; i++)
-//     snprintf(out+i*3, 255, "%02x ", bytes[i]);
-//   FURI_LOG_T(TAG, out);
-// }
-// void sd_byte_debug(uint8_t byte){
-//   char out[3];
-//   snprintf(out, 255, "%02x ", byte);
-//   FURI_LOG_T(TAG, out);
-// }
-
-static void sd_spi_bus_to_ground() {
-    furi_hal_gpio_init_ex(
-        furi_hal_sd_spi_handle->miso,
-        GpioModeOutputPushPull,
-        GpioPullNo,
-        GpioSpeedVeryHigh,
-        GpioAltFnUnused);
-    furi_hal_gpio_init_ex(
-        furi_hal_sd_spi_handle->mosi,
-        GpioModeOutputPushPull,
-        GpioPullNo,
-        GpioSpeedVeryHigh,
-        GpioAltFnUnused);
-    furi_hal_gpio_init_ex(
-        furi_hal_sd_spi_handle->sck,
-        GpioModeOutputPushPull,
-        GpioPullNo,
-        GpioSpeedVeryHigh,
-        GpioAltFnUnused);
-
-    sd_spi_select_card();
-    furi_hal_gpio_write(furi_hal_sd_spi_handle->miso, false);
-    furi_hal_gpio_write(furi_hal_sd_spi_handle->mosi, false);
-    furi_hal_gpio_write(furi_hal_sd_spi_handle->sck, false);
-}
-
-static void sd_spi_bus_rise_up() {
-    sd_spi_deselect_card();
-
-    furi_hal_gpio_init_ex(
-        furi_hal_sd_spi_handle->miso,
-        GpioModeAltFunctionPushPull,
-        GpioPullUp,
-        GpioSpeedVeryHigh,
-        GpioAltFn5SPI2);
-    furi_hal_gpio_init_ex(
-        furi_hal_sd_spi_handle->mosi,
-        GpioModeAltFunctionPushPull,
-        GpioPullUp,
-        GpioSpeedVeryHigh,
-        GpioAltFn5SPI2);
-    furi_hal_gpio_init_ex(
-        furi_hal_sd_spi_handle->sck,
-        GpioModeAltFunctionPushPull,
-        GpioPullUp,
-        GpioSpeedVeryHigh,
-        GpioAltFn5SPI2);
-}
-
-static inline uint8_t sd_spi_read_byte(void) {
-    uint8_t responce;
-    furi_check(furi_hal_spi_bus_trx(furi_hal_sd_spi_handle, NULL, &responce, 1, SD_TIMEOUT_MS));
-    return responce;
-}
-
-static inline void sd_spi_write_byte(uint8_t data) {
-    furi_check(furi_hal_spi_bus_trx(furi_hal_sd_spi_handle, &data, NULL, 1, SD_TIMEOUT_MS));
-}
-
-static inline uint8_t sd_spi_write_and_read_byte(uint8_t data) {
-    uint8_t responce;
-    furi_check(furi_hal_spi_bus_trx(furi_hal_sd_spi_handle, &data, &responce, 1, SD_TIMEOUT_MS));
-    return responce;
-}
-
-static inline void sd_spi_write_bytes(uint8_t* data, uint32_t size) {
-    furi_check(furi_hal_spi_bus_trx(furi_hal_sd_spi_handle, data, NULL, size, SD_TIMEOUT_MS));
-}
-
-static inline void sd_spi_read_bytes(uint8_t* data, uint32_t size) {
-    furi_check(furi_hal_spi_bus_trx(furi_hal_sd_spi_handle, NULL, data, size, SD_TIMEOUT_MS));
-}
-
-static inline void sd_spi_write_bytes_dma(uint8_t* data, uint32_t size) {
-
-    uint32_t timeout_mul = (size / 512) + 1;
-    furi_check(furi_hal_spi_bus_trx_dma(
-        furi_hal_sd_spi_handle, data, NULL, size, SD_TIMEOUT_MS * timeout_mul));
-}
-
-static inline void sd_spi_read_bytes_dma(uint8_t* data, uint32_t size) {
-    uint32_t timeout_mul = (size / 512) + 1;
-    furi_check(furi_hal_spi_bus_trx_dma(
-        furi_hal_sd_spi_handle, NULL, data, size, SD_TIMEOUT_MS * timeout_mul));
-}
-
-static uint8_t sd_spi_wait_for_data_and_read(void) {
-    uint8_t retry_count = SD_ANSWER_RETRY_COUNT;
-    uint8_t responce;
-
-    // Wait until we get a valid data
-    do {
-        responce = sd_spi_read_byte();
-        retry_count--;
-
-    } while((responce == SD_DUMMY_BYTE) && retry_count);
-
-    return responce;
-}
-
-static SdSpiStatus sd_spi_wait_for_data(uint8_t data, uint32_t timeout_ms) {
-    FuriHalCortexTimer timer = furi_hal_cortex_timer_get(timeout_ms * 1000);
-    uint8_t byte;
-
-    do {
-        byte = sd_spi_read_byte();
-        if(furi_hal_cortex_timer_is_expired(timer)) {
-            return SdSpiStatusTimeout;
-        }
-    } while((byte != data));
-
-    return SdSpiStatusOK;
-}
-
-static inline void sd_spi_deselect_card_and_purge() {
-    sd_spi_deselect_card();
-    sd_spi_read_byte();
-}
-
-static inline void sd_spi_purge_crc() {
-    sd_spi_read_byte();
-    sd_spi_read_byte();
-}
-
-static SdSpiCmdAnswer
-    sd_spi_send_cmd(SdSpiCmd cmd, uint32_t arg, uint8_t crc, SdSpiCmdAnswerType answer_type) {
-    uint8_t frame[SD_CMD_LENGTH];
-
-    cmd_answer.r1 = SD_DUMMY_BYTE;
-    cmd_answer.r2 = SD_DUMMY_BYTE;
-    cmd_answer.r3 = SD_DUMMY_BYTE;
-    cmd_answer.r4 = SD_DUMMY_BYTE;
-    cmd_answer.r5 = SD_DUMMY_BYTE;
-
-    frame[0] = ((uint8_t)cmd | 0x40);
-    frame[1] = (uint8_t)(arg >> 24);
-    frame[2] = (uint8_t)(arg >> 16);
-    frame[3] = (uint8_t)(arg >> 8);
-    frame[4] = (uint8_t)(arg);
-    frame[5] = (crc | 0x01);
-
-    sd_spi_select_card();
-    sd_spi_write_bytes(frame, sizeof(frame));
-
-    switch(answer_type) {
-    case SdSpiCmdAnswerTypeR1:
-        cmd_answer.r1 = sd_spi_wait_for_data_and_read();
-        break;
-    case SdSpiCmdAnswerTypeR1B:
-        cmd_answer.r1 = sd_spi_wait_for_data_and_read();
-
-        // reassert card
-        sd_spi_deselect_card();
-        furi_delay_us(1000);
-        sd_spi_deselect_card();
-
-        // and wait for it to be ready
-        while(sd_spi_read_byte() != 0xFF) {
-        };
-
-        break;
-    case SdSpiCmdAnswerTypeR2:
-        cmd_answer.r1 = sd_spi_wait_for_data_and_read();
-        cmd_answer.r2 = sd_spi_read_byte();
-        break;
-    case SdSpiCmdAnswerTypeR3:
-    case SdSpiCmdAnswerTypeR7:
-        cmd_answer.r1 = sd_spi_wait_for_data_and_read();
-        cmd_answer.r2 = sd_spi_read_byte();
-        cmd_answer.r3 = sd_spi_read_byte();
-        cmd_answer.r4 = sd_spi_read_byte();
-        cmd_answer.r5 = sd_spi_read_byte();
-        break;
-    default:
-        break;
-    }
-    return cmd_answer;
-}
-
-static SdSpiDataResponce sd_spi_get_data_response(uint32_t timeout_ms) {
-    SdSpiDataResponce responce = sd_spi_read_byte();
-    // read busy response byte
-    sd_spi_read_byte();
-
-    switch(responce & 0x1F) {
-    case SdSpiDataResponceOK:
-        // TODO: check timings
-        sd_spi_deselect_card();
-        sd_spi_select_card();
-
-        // wait for 0xFF
-        if(sd_spi_wait_for_data(0xFF, timeout_ms) == SdSpiStatusOK) {
-            return SdSpiDataResponceOK;
-        } else {
-            return SdSpiDataResponceOtherError;
-        }
-    case SdSpiDataResponceCRCError:
-        return SdSpiDataResponceCRCError;
-    case SdSpiDataResponceWriteError:
-        return SdSpiDataResponceWriteError;
-    default:
-        return SdSpiDataResponceOtherError;
-    }
-}
-
-static SdSpiStatus sd_spi_init_spi_mode_v1(void) {
-    SdSpiCmdAnswer response;
-    uint8_t retry_count = 0;
-
-    sd_spi_debug("Init SD card in SPI mode v1");
-
-    do {
-        retry_count++;
-
-        // CMD55 (APP_CMD) before any ACMD command: R1 response (0x00: no errors)
-        sd_spi_send_cmd(SD_CMD55_APP_CMD, 0, 0xFF, SdSpiCmdAnswerTypeR1);
-        sd_spi_deselect_card_and_purge();
-
-        // ACMD41 (SD_APP_OP_COND) to initialize SDHC or SDXC cards: R1 response (0x00: no errors)
-        response = sd_spi_send_cmd(SD_CMD41_SD_APP_OP_COND, 0, 0xFF, SdSpiCmdAnswerTypeR1);
-        sd_spi_deselect_card_and_purge();
-
-        if(retry_count >= SD_IDLE_RETRY_COUNT) {
-            return SdSpiStatusError;
-        }
-    } while(response.r1 == SdSpi_R1_IN_IDLE_STATE);
-
-    sd_spi_debug("Init SD card in SPI mode v1 done");
-
-    return SdSpiStatusOK;
-}
-
-static SdSpiStatus sd_spi_init_spi_mode_v2(void) {
-    SdSpiCmdAnswer response;
-    uint8_t retry_count = 0;
-
-    sd_spi_debug("Init SD card in SPI mode v2");
-
-    do {
-        retry_count++;
-        // CMD55 (APP_CMD) before any ACMD command: R1 response (0x00: no errors)
-        sd_spi_send_cmd(SD_CMD55_APP_CMD, 0, 0xFF, SdSpiCmdAnswerTypeR1);
-        sd_spi_deselect_card_and_purge();
-
-        // ACMD41 (APP_OP_COND) to initialize SDHC or SDXC cards: R1 response (0x00: no errors)
-        response =
-            sd_spi_send_cmd(SD_CMD41_SD_APP_OP_COND, 0x40000000, 0xFF, SdSpiCmdAnswerTypeR1);
-        sd_spi_deselect_card_and_purge();
-
-        if(retry_count >= SD_IDLE_RETRY_COUNT) {
-            sd_spi_debug("ACMD41 failed");
-            return SdSpiStatusError;
-        }
-    } while(response.r1 == SdSpi_R1_IN_IDLE_STATE);
-
-    if(FLAG_SET(response.r1, SdSpi_R1_ILLEGAL_COMMAND)) {
-        sd_spi_debug("ACMD41 is illegal command");
-        retry_count = 0;
-        do {
-            retry_count++;
-            // CMD55 (APP_CMD) before any ACMD command: R1 response (0x00: no errors)
-            response = sd_spi_send_cmd(SD_CMD55_APP_CMD, 0, 0xFF, SdSpiCmdAnswerTypeR1);
-            sd_spi_deselect_card_and_purge();
-
-            if(response.r1 != SdSpi_R1_IN_IDLE_STATE) {
-                sd_spi_debug("CMD55 failed");
-                return SdSpiStatusError;
-            }
-            // ACMD41 (SD_APP_OP_COND) to initialize SDHC or SDXC cards: R1 response (0x00: no errors)
-            response = sd_spi_send_cmd(SD_CMD41_SD_APP_OP_COND, 0, 0xFF, SdSpiCmdAnswerTypeR1);
-            sd_spi_deselect_card_and_purge();
-
-            if(retry_count >= SD_IDLE_RETRY_COUNT) {
-                sd_spi_debug("ACMD41 failed");
-                return SdSpiStatusError;
-            }
-        } while(response.r1 == SdSpi_R1_IN_IDLE_STATE);
-    }
-
-    sd_spi_debug("Init SD card in SPI mode v2 done");
-
-    return SdSpiStatusOK;
-}
-
-static SdSpiStatus sd_spi_init_spi_mode(void) {
-    SdSpiCmdAnswer response;
-    uint8_t retry_count;
-
-    // CMD0 (GO_IDLE_STATE) to put SD in SPI mode and
-    // wait for In Idle State Response (R1 Format) equal to 0x01
-    retry_count = 0;
-    do {
-        retry_count++;
-        response = sd_spi_send_cmd(SD_CMD0_GO_IDLE_STATE, 0, 0x95, SdSpiCmdAnswerTypeR1);
-        sd_spi_deselect_card_and_purge();
-
-        if(retry_count >= SD_IDLE_RETRY_COUNT) {
-            sd_spi_debug("CMD0 failed");
-            return SdSpiStatusError;
-        }
-    } while(response.r1 != SdSpi_R1_IN_IDLE_STATE);
-
-    // CMD8 (SEND_IF_COND) to check the power supply status
-    // and wait until response (R7 Format) equal to 0xAA and
-    response = sd_spi_send_cmd(SD_CMD8_SEND_IF_COND, 0x1AA, 0x87, SdSpiCmdAnswerTypeR7);
-    sd_spi_deselect_card_and_purge();
-
-    if(FLAG_SET(response.r1, SdSpi_R1_ILLEGAL_COMMAND)) {
-        if(sd_spi_init_spi_mode_v1() != SdSpiStatusOK) {
-            sd_spi_debug("Init mode v1 failed");
-            return SdSpiStatusError;
-        }
-        sd_high_capacity = 0;
-    } else if(response.r1 == SdSpi_R1_IN_IDLE_STATE) {
-        if(sd_spi_init_spi_mode_v2() != SdSpiStatusOK) {
-            sd_spi_debug("Init mode v2 failed");
-            return SdSpiStatusError;
-        }
-
-        // CMD58 (READ_OCR) to initialize SDHC or SDXC cards: R3 response
-        response = sd_spi_send_cmd(SD_CMD58_READ_OCR, 0, 0xFF, SdSpiCmdAnswerTypeR3);
-        sd_spi_deselect_card_and_purge();
-
-        if(response.r1 != SdSpi_R1_NO_ERROR) {
-            sd_spi_debug("CMD58 failed");
-            return SdSpiStatusError;
-        }
-        sd_high_capacity = (response.r2 & 0x40) >> 6;
-    } else {
-        return SdSpiStatusError;
-    }
-
-    sd_spi_debug("SD card is %s", sd_high_capacity ? "SDHC or SDXC" : "SDSC");
-    return SdSpiStatusOK;
-}
-
-static SdSpiStatus sd_spi_get_csd(SD_CSD* csd) {
-    uint16_t counter = 0;
-    uint8_t csd_data[16];
-    SdSpiStatus ret = SdSpiStatusError;
-    SdSpiCmdAnswer response;
-
-    // CMD9 (SEND_CSD): R1 format (0x00 is no errors)
-    response = sd_spi_send_cmd(SD_CMD9_SEND_CSD, 0, 0xFF, SdSpiCmdAnswerTypeR1);
-
-    if(response.r1 == SdSpi_R1_NO_ERROR) {
-        if(sd_spi_wait_for_data(SD_TOKEN_START_DATA_SINGLE_BLOCK_READ, SD_TIMEOUT_MS) ==
-           SdSpiStatusOK) {
-            // read CSD data
-            for(counter = 0; counter < 16; counter++) {
-                csd_data[counter] = sd_spi_read_byte();
-            }
-
-            sd_spi_purge_crc();
-
-            /*************************************************************************
-            CSD header decoding
-            *************************************************************************/
-
-            csd->CSDStruct = (csd_data[0] & 0xC0) >> 6;
-            csd->Reserved1 = csd_data[0] & 0x3F;
-            csd->TAAC = csd_data[1];
-            csd->NSAC = csd_data[2];
-            csd->MaxBusClkFrec = csd_data[3];
-            csd->CardComdClasses = (csd_data[4] << 4) | ((csd_data[5] & 0xF0) >> 4);
-            csd->RdBlockLen = csd_data[5] & 0x0F;
-            csd->PartBlockRead = (csd_data[6] & 0x80) >> 7;
-            csd->WrBlockMisalign = (csd_data[6] & 0x40) >> 6;
-            csd->RdBlockMisalign = (csd_data[6] & 0x20) >> 5;
-            csd->DSRImpl = (csd_data[6] & 0x10) >> 4;
-
-            /*************************************************************************
-            CSD v1/v2 decoding
-            *************************************************************************/
-
-            if(sd_high_capacity == 0) {
-                csd->version.v1.Reserved1 = ((csd_data[6] & 0x0C) >> 2);
-                csd->version.v1.DeviceSize = ((csd_data[6] & 0x03) << 10) | (csd_data[7] << 2) |
-                                             ((csd_data[8] & 0xC0) >> 6);
-                csd->version.v1.MaxRdCurrentVDDMin = (csd_data[8] & 0x38) >> 3;
-                csd->version.v1.MaxRdCurrentVDDMax = (csd_data[8] & 0x07);
-                csd->version.v1.MaxWrCurrentVDDMin = (csd_data[9] & 0xE0) >> 5;
-                csd->version.v1.MaxWrCurrentVDDMax = (csd_data[9] & 0x1C) >> 2;
-                csd->version.v1.DeviceSizeMul = ((csd_data[9] & 0x03) << 1) |
-                                                ((csd_data[10] & 0x80) >> 7);
-            } else {
-                csd->version.v2.Reserved1 = ((csd_data[6] & 0x0F) << 2) |
-                                            ((csd_data[7] & 0xC0) >> 6);
-                csd->version.v2.DeviceSize = ((csd_data[7] & 0x3F) << 16) | (csd_data[8] << 8) |
-                                             csd_data[9];
-                csd->version.v2.Reserved2 = ((csd_data[10] & 0x80) >> 8);
-            }
-
-            csd->EraseSingleBlockEnable = (csd_data[10] & 0x40) >> 6;
-            csd->EraseSectorSize = ((csd_data[10] & 0x3F) << 1) | ((csd_data[11] & 0x80) >> 7);
-            csd->WrProtectGrSize = (csd_data[11] & 0x7F);
-            csd->WrProtectGrEnable = (csd_data[12] & 0x80) >> 7;
-            csd->Reserved2 = (csd_data[12] & 0x60) >> 5;
-            csd->WrSpeedFact = (csd_data[12] & 0x1C) >> 2;
-            csd->MaxWrBlockLen = ((csd_data[12] & 0x03) << 2) | ((csd_data[13] & 0xC0) >> 6);
-            csd->WriteBlockPartial = (csd_data[13] & 0x20) >> 5;
-            csd->Reserved3 = (csd_data[13] & 0x1F);
-            csd->FileFormatGrouop = (csd_data[14] & 0x80) >> 7;
-            csd->CopyFlag = (csd_data[14] & 0x40) >> 6;
-            csd->PermWrProtect = (csd_data[14] & 0x20) >> 5;
-            csd->TempWrProtect = (csd_data[14] & 0x10) >> 4;
-            csd->FileFormat = (csd_data[14] & 0x0C) >> 2;
-            csd->Reserved4 = (csd_data[14] & 0x03);
-            csd->crc = (csd_data[15] & 0xFE) >> 1;
-            csd->Reserved5 = (csd_data[15] & 0x01);
-
-            ret = SdSpiStatusOK;
-        }
-    }
-
-    sd_spi_deselect_card_and_purge();
-
-    return ret;
-}
-
-static SdSpiStatus sd_spi_get_cid(SD_CID* Cid) {
-    uint16_t counter = 0;
-    uint8_t cid_data[16];
-    SdSpiStatus ret = SdSpiStatusError;
-    SdSpiCmdAnswer response;
-
-    // CMD10 (SEND_CID): R1 format (0x00 is no errors)
-    response = sd_spi_send_cmd(SD_CMD10_SEND_CID, 0, 0xFF, SdSpiCmdAnswerTypeR1);
-
-    if(response.r1 == SdSpi_R1_NO_ERROR) {
-        if(sd_spi_wait_for_data(SD_TOKEN_START_DATA_SINGLE_BLOCK_READ, SD_TIMEOUT_MS) ==
-           SdSpiStatusOK) {
-            // read CID data
-            for(counter = 0; counter < 16; counter++) {
-                cid_data[counter] = sd_spi_read_byte();
-            }
-
-            sd_spi_purge_crc();
-
-            Cid->ManufacturerID = cid_data[0];
-            memcpy(Cid->OEM_AppliID, cid_data + 1, 2);
-            memcpy(Cid->ProdName, cid_data + 3, 5);
-            Cid->ProdRev = cid_data[8];
-            Cid->ProdSN = cid_data[9] << 24;
-            Cid->ProdSN |= cid_data[10] << 16;
-            Cid->ProdSN |= cid_data[11] << 8;
-            Cid->ProdSN |= cid_data[12];
-            Cid->Reserved1 = (cid_data[13] & 0xF0) >> 4;
-            Cid->ManufactYear = (cid_data[13] & 0x0F) << 4;
-            Cid->ManufactYear |= (cid_data[14] & 0xF0) >> 4;
-            Cid->ManufactMonth = (cid_data[14] & 0x0F);
-            Cid->CID_CRC = (cid_data[15] & 0xFE) >> 1;
-            Cid->Reserved2 = 1;
-
-            ret = SdSpiStatusOK;
-        }
-    }
-
-    sd_spi_deselect_card_and_purge();
-
-    return ret;
-}
-
-static SdSpiStatus
-    sd_spi_cmd_read_blocks(uint32_t* data, uint32_t address, uint32_t blocks, uint32_t timeout_ms) {
-    uint32_t block_address = address;
-    uint32_t offset = 0;
-
-    // CMD16 (SET_BLOCKLEN): R1 response (0x00: no errors)
-    SdSpiCmdAnswer response =
-        sd_spi_send_cmd(SD_CMD16_SET_BLOCKLEN, SD_BLOCK_SIZE, 0xFF, SdSpiCmdAnswerTypeR1);
-    sd_spi_deselect_card_and_purge();
-
-    if(response.r1 != SdSpi_R1_NO_ERROR) {
-        return SdSpiStatusError;
-    }
-
-    if(!sd_high_capacity) {
-        block_address = address * SD_BLOCK_SIZE;
-    }
-
-    while(blocks--) {
-        // CMD17 (READ_SINGLE_BLOCK): R1 response (0x00: no errors)
-        response =
-            sd_spi_send_cmd(SD_CMD17_READ_SINGLE_BLOCK, block_address, 0xFF, SdSpiCmdAnswerTypeR1);
-        if(response.r1 != SdSpi_R1_NO_ERROR) {
-            sd_spi_deselect_card_and_purge();
-            return SdSpiStatusError;
-        }
-
-        // Wait for the data start token
-        if(sd_spi_wait_for_data(SD_TOKEN_START_DATA_SINGLE_BLOCK_READ, timeout_ms) ==
-           SdSpiStatusOK) {
-            // Read the data block
-            sd_spi_read_bytes_dma((uint8_t*)data + offset, SD_BLOCK_SIZE);
-            sd_spi_purge_crc();
-
-            // increase offset
-            offset += SD_BLOCK_SIZE;
-
-            // increase block address
-            if(sd_high_capacity) {
-                block_address += 1;
-            } else {
-                block_address += SD_BLOCK_SIZE;
-            }
-        } else {
-            sd_spi_deselect_card_and_purge();
-            return SdSpiStatusError;
-        }
-
-        sd_spi_deselect_card_and_purge();
-    }
-
-    return SdSpiStatusOK;
-}
-
-static SdSpiStatus sd_spi_cmd_write_blocks(
-    uint32_t* data,
-    uint32_t address,
-    uint32_t blocks,
-    uint32_t timeout_ms) {
-    uint32_t block_address = address;
-    uint32_t offset = 0;
-
-    // CMD16 (SET_BLOCKLEN): R1 response (0x00: no errors)
-    SdSpiCmdAnswer response =
-        sd_spi_send_cmd(SD_CMD16_SET_BLOCKLEN, SD_BLOCK_SIZE, 0xFF, SdSpiCmdAnswerTypeR1);
-    sd_spi_deselect_card_and_purge();
-
-    if(response.r1 != SdSpi_R1_NO_ERROR) {
-        return SdSpiStatusError;
-    }
-
-    if(!sd_high_capacity) {
-        block_address = address * SD_BLOCK_SIZE;
-    }
-
-    while(blocks--) {
-        // CMD24 (WRITE_SINGLE_BLOCK): R1 response (0x00: no errors)
-        response = sd_spi_send_cmd(
-            SD_CMD24_WRITE_SINGLE_BLOCK, block_address, 0xFF, SdSpiCmdAnswerTypeR1);
-        if(response.r1 != SdSpi_R1_NO_ERROR) {
-            sd_spi_deselect_card_and_purge();
-            return SdSpiStatusError;
-        }
-
-        // Send dummy byte for NWR timing : one byte between CMD_WRITE and TOKEN
-        // TODO: check bytes count
-        sd_spi_write_byte(SD_DUMMY_BYTE);
-        sd_spi_write_byte(SD_DUMMY_BYTE);
-
-        // Send the data start token
-        sd_spi_write_byte(SD_TOKEN_START_DATA_SINGLE_BLOCK_WRITE);
-        sd_spi_write_bytes_dma((uint8_t*)data + offset, SD_BLOCK_SIZE);
-        sd_spi_purge_crc();
-
-        // Read data response
-        SdSpiDataResponce data_responce = sd_spi_get_data_response(timeout_ms);
-        sd_spi_deselect_card_and_purge();
-
-        if(data_responce != SdSpiDataResponceOK) {
-            return SdSpiStatusError;
-        }
-
-        // increase offset
-        offset += SD_BLOCK_SIZE;
-
-        // increase block address
-        if(sd_high_capacity) {
-            block_address += 1;
-        } else {
-            block_address += SD_BLOCK_SIZE;
-        }
-    }
-
-    return SdSpiStatusOK;
-}
-
-uint8_t sd_max_mount_retry_count() {
-    return 10;
-}
-
-SdSpiStatus sd_init(bool power_reset) {
-
-    sd_spi_debug("sd_init");
-
-    furi_hal_spi_acquire(&furi_hal_spi_bus_handle_external);
-    furi_hal_sd_spi_handle = &furi_hal_spi_bus_handle_external;
-    furi_hal_gpio_init(&gpio_ext_pa4,GpioModeOutputPushPull, GpioPullUp, GpioSpeedVeryHigh);
-
-    if(power_reset) {
-        sd_spi_debug("Power reset");
-
-        // disable power and set low on all bus pins
-        furi_hal_power_disable_external_3_3v();
-        sd_spi_bus_to_ground();
-        hal_sd_detect_set_low();
-        furi_delay_ms(250);
-
-        // reinit bus and enable power
-        sd_spi_bus_rise_up();
-        hal_sd_detect_init();
-        furi_hal_power_enable_external_3_3v();
-        furi_delay_ms(100);
-    }
-
-    SdSpiStatus status = SdSpiStatusError;
-
-    // Send 80 dummy clocks with CS high
-    sd_spi_deselect_card();
-    for(uint8_t i = 0; i < 80; i++) {
-        sd_spi_write_byte(SD_DUMMY_BYTE);
-    }
-
-    for(uint8_t i = 0; i < 128; i++) {
-    // for(uint8_t i = 0; i < 4; i++) {
-        status = sd_spi_init_spi_mode();
-        if(status == SdSpiStatusOK) {
-            // SD initialized and init to SPI mode properly
-            sd_spi_debug("SD init OK after %d retries", i);
-            break;
-        }
-    }
-
-    status = sd_get_card_state();
-
-    furi_hal_sd_spi_handle = NULL;
-    // furi_hal_spi_release(&furi_hal_spi_bus_handle_sd_slow);
-    furi_hal_spi_release(&furi_hal_spi_bus_handle_external);
-
-
-    // Init sector cache
-    // sector_cache_init();
-
-    return status;
-}
-
-SdSpiStatus sd_get_card_state(void) {
-    SdSpiCmdAnswer response;
-
-    // Send CMD13 (SEND_STATUS) to get SD status
-    response = sd_spi_send_cmd(SD_CMD13_SEND_STATUS, 0, 0xFF, SdSpiCmdAnswerTypeR2);
-    sd_spi_deselect_card_and_purge();
-
-    // Return status OK if response is valid
-    if((response.r1 == SdSpi_R1_NO_ERROR) && (response.r2 == SdSpi_R2_NO_ERROR || response.r2 == SdSpi_R2_CARD_LOCKED)) {
-        return SdSpiStatusOK;
-    }
-
-    return SdSpiStatusError;
-}
-
-SdSpiStatus sd_get_card_info(SD_CardInfo* card_info) {
-    SdSpiStatus status;
-
-    status = sd_spi_get_csd(&(card_info->Csd));
-
-    if(status != SdSpiStatusOK) {
-        return status;
-    }
-
-    status = sd_spi_get_cid(&(card_info->Cid));
-
-    if(status != SdSpiStatusOK) {
-        return status;
-    }
-
-    if(sd_high_capacity == 1) {
-        card_info->LogBlockSize = 512;
-        card_info->CardBlockSize = 512;
-        card_info->CardCapacity = ((uint64_t)card_info->Csd.version.v2.DeviceSize + 1UL) * 1024UL *
-                                  (uint64_t)card_info->LogBlockSize;
-        card_info->LogBlockNbr = (card_info->CardCapacity) / (card_info->LogBlockSize);
-    } else {
-        card_info->CardCapacity = (card_info->Csd.version.v1.DeviceSize + 1);
-        card_info->CardCapacity *= (1UL << (card_info->Csd.version.v1.DeviceSizeMul + 2));
-        card_info->LogBlockSize = 512;
-        card_info->CardBlockSize = 1UL << (card_info->Csd.RdBlockLen);
-        card_info->CardCapacity *= card_info->CardBlockSize;
-        card_info->LogBlockNbr = (card_info->CardCapacity) / (card_info->LogBlockSize);
-    }
-
-    return status;
-}
-
-SdSpiStatus sd_set_pwd(char* pwd) {
-
-  sd_spi_debug("sd_set_pwd");
-  sd_spi_debug(pwd);
-
-  SdSpiStatus status = SdSpiStatusError;
-  SdSpiCmdAnswer response;
-
-  furi_hal_spi_acquire(&furi_hal_spi_bus_handle_external);
-  furi_hal_sd_spi_handle = &furi_hal_spi_bus_handle_external;
-
-  response = sd_spi_send_cmd(SD_CMD42_LOCK_UNLOCK, 0, 0xFF, SdSpiCmdAnswerTypeR1);
-
-  if(response.r1 == SdSpi_R1_NO_ERROR) {
-    sd_spi_debug("SD_CMD42_LOCK_UNLOCK R1_NO_ERROR");
-    uint8_t data[512] = {0xFF};
-    data[0] = 0x05;
-    data[1] = strlen(pwd);
-    for(int i = 0; i < (int)strlen(pwd); i++){
-      data[i+2] = pwd[i];
-    }
-
-    sd_spi_write_byte(SD_TOKEN_START_DATA_SINGLE_BLOCK_WRITE);
-    sd_spi_write_bytes_dma(data, SD_BLOCK_SIZE);
-    sd_spi_purge_crc();
-
-    SdSpiDataResponce data_responce = sd_spi_get_data_response(SD_TIMEOUT_MS);
-    sd_spi_deselect_card_and_purge();
-
-    if(data_responce == SdSpiDataResponceOK) {
-      sd_spi_debug("SD_CMD42_LOCK_UNLOCK SdSpiDataResponceOK");
-
-      if(sd_get_card_state()==SdSpiStatusOK) {
-        if(cmd_answer.r2==SdSpi_R2_CARD_LOCKED) { status = SdSpiStatusOK; }
-      }
-    }
-    else { sd_spi_debug("SD_CMD42_LOCK_UNLOCK SdSpiDataResponceError"); }
-  }
-  else { sd_spi_debug("SD_CMD42_LOCK_UNLOCK R1_ERROR"); }
-  furi_hal_sd_spi_handle = NULL;
-  furi_hal_spi_release(&furi_hal_spi_bus_handle_external);
-
-  return status;
-}
-SdSpiStatus sd_clr_pwd(char* pwd) {
-  sd_spi_debug("sd_clr_pwd");
-  sd_spi_debug(pwd);
-
-  SdSpiStatus status = SdSpiStatusError;
-  SdSpiCmdAnswer response;
-
-  furi_hal_spi_acquire(&furi_hal_spi_bus_handle_external);
-  furi_hal_sd_spi_handle = &furi_hal_spi_bus_handle_external;
-
-  response = sd_spi_send_cmd(SD_CMD42_LOCK_UNLOCK, 0, 0xFF, SdSpiCmdAnswerTypeR1);
-  if(response.r1 == SdSpi_R1_NO_ERROR) {
-    sd_spi_debug("SD_CMD42_LOCK_UNLOCK R1_NO_ERROR");
-    uint8_t data[512] = {0xFF};
-    data[0] = 0x02;
-    data[1] = strlen(pwd);
-    for(int i = 0; i < (int)strlen(pwd); i++){
-      data[i+2] = pwd[i];
-    }
-    sd_spi_write_byte(SD_TOKEN_START_DATA_SINGLE_BLOCK_WRITE);
-    sd_spi_write_bytes_dma(data, SD_BLOCK_SIZE);
-    sd_spi_purge_crc();
-
-    SdSpiDataResponce data_responce = sd_spi_get_data_response(SD_TIMEOUT_MS);
-    sd_spi_deselect_card_and_purge();
-
-    if(data_responce == SdSpiDataResponceOK) {
-      sd_spi_debug("SD_CMD42_LOCK_UNLOCK SdSpiDataResponceOK");
-
-      if(sd_get_card_state()==SdSpiStatusOK) {
-        if(cmd_answer.r2==SdSpi_R2_NO_ERROR) { status = SdSpiStatusOK; }
-      }
-    }
-    else { sd_spi_debug("SD_CMD42_LOCK_UNLOCK SdSpiDataResponceError"); }
-  }
-  else { sd_spi_debug("SD_CMD42_LOCK_UNLOCK R1_ERROR"); }
-
-  furi_hal_sd_spi_handle = NULL;
-  furi_hal_spi_release(&furi_hal_spi_bus_handle_external);
-
-  return status;
-}
-SdSpiStatus sd_force_erase(void) {
-  SdSpiStatus status = SdSpiStatusError;
-  SdSpiCmdAnswer response;
-
-  furi_hal_spi_acquire(&furi_hal_spi_bus_handle_external);
-  furi_hal_sd_spi_handle = &furi_hal_spi_bus_handle_external;
-
-  sd_spi_debug("SD_CMD16_SET_BLOCKLEN 1");
-  sd_spi_send_cmd(SD_CMD16_SET_BLOCKLEN, 1, 0xFF, SdSpiCmdAnswerTypeR1);
-  sd_spi_deselect_card_and_purge();
-
-  sd_spi_debug("SD_CMD42_LOCK_UNLOCK");
-  response = sd_spi_send_cmd(SD_CMD42_LOCK_UNLOCK, 0, 0xFF, SdSpiCmdAnswerTypeR1);
-
-  if(response.r1 == SdSpi_R1_NO_ERROR) {
-
-    sd_spi_debug("SD_CMD42_LOCK_UNLOCK R1_NO_ERROR");
-    uint8_t data[2] = {0xfe,0x08};
-    sd_spi_write_bytes_dma(data, sizeof(data));
-    sd_spi_purge_crc();
-
-    SdSpiDataResponce data_responce = sd_spi_get_data_response(SD_TIMEOUT_MS);
-    sd_spi_deselect_card_and_purge();
-
-    status = SdSpiStatusOK;
-
-    if(data_responce == SdSpiDataResponceOK) {
-      sd_spi_debug("SD_CMD42_LOCK_UNLOCK SdSpiDataResponceOK");
-      if(sd_get_card_state()==SdSpiStatusOK) {
-        if(cmd_answer.r2==SdSpi_R2_NO_ERROR) { status = SdSpiStatusOK; }
-      }
-    }
-    else { sd_spi_debug("SD_CMD42_LOCK_UNLOCK SdSpiDataResponceError"); }
-  }
-  else { sd_spi_debug("SD_CMD42_LOCK_UNLOCK R1_ERROR"); }
-
-  furi_hal_sd_spi_handle = NULL;
-  furi_hal_spi_release(&furi_hal_spi_bus_handle_external);
-
-  return status;
-}
-
-SdSpiStatus
-    sd_read_blocks(uint32_t* data, uint32_t address, uint32_t blocks, uint32_t timeout_ms) {
-    SdSpiStatus status = sd_spi_cmd_read_blocks(data, address, blocks, timeout_ms);
-    return status;
-}
-
-SdSpiStatus
-    sd_write_blocks(uint32_t* data, uint32_t address, uint32_t blocks, uint32_t timeout_ms) {
-    SdSpiStatus status = sd_spi_cmd_write_blocks(data, address, blocks, timeout_ms);
-    return status;
-}
-
-SdSpiStatus sd_get_cid(SD_CID* cid) {
-    SdSpiStatus status;
-    furi_hal_spi_acquire(&furi_hal_spi_bus_handle_external);
-    furi_hal_sd_spi_handle = &furi_hal_spi_bus_handle_external;
-
-    memset(cid, 0, sizeof(SD_CID));
-    status = sd_spi_get_cid(cid);
-
-    furi_hal_sd_spi_handle = NULL;
-    furi_hal_spi_release(&furi_hal_spi_bus_handle_external);
-
-    return status;
-}

+ 0 - 204
non_catalog_apps/sd_spi/sd_spi.h

@@ -1,204 +0,0 @@
-#pragma once
-#include <stdint.h>
-#include <stdbool.h>
-
-#define __IO volatile
-
-#define SD_TIMEOUT_MS 500//(1000)
-#define SD_BLOCK_SIZE 512
-
-#define VERSION_APP "0.1"
-#define DEVELOPED " "
-#define GITHUB "github.com/Gl1tchub/Flipperzero-SD-SPI"
-
-
-typedef enum {
-    SdSpiStatusOK,
-    SdSpiStatusError,
-    SdSpiStatusTimeout,
-} SdSpiStatus;
-
-/** R1 answer value */
-typedef enum {
-    SdSpi_R1_NO_ERROR = 0x00,
-    SdSpi_R1_IN_IDLE_STATE = 0x01,
-    SdSpi_R1_ERASE_RESET = 0x02,
-    SdSpi_R1_ILLEGAL_COMMAND = 0x04,
-    SdSpi_R1_COM_CRC_ERROR = 0x08,
-    SdSpi_R1_ERASE_SEQUENCE_ERROR = 0x10,
-    SdSpi_R1_ADDRESS_ERROR = 0x20,
-    SdSpi_R1_PARAMETER_ERROR = 0x40,
-} SdSpiR1;
-
-/** R2 answer value */
-typedef enum {
-    /* R2 answer value */
-    SdSpi_R2_NO_ERROR = 0x00,
-    SdSpi_R2_CARD_LOCKED = 0x01,
-    SdSpi_R2_LOCKUNLOCK_ERROR = 0x02,
-    SdSpi_R2_ERROR = 0x04,
-    SdSpi_R2_CC_ERROR = 0x08,
-    SdSpi_R2_CARD_ECC_FAILED = 0x10,
-    SdSpi_R2_WP_VIOLATION = 0x20,
-    SdSpi_R2_ERASE_PARAM = 0x40,
-    SdSpi_R2_OUTOFRANGE = 0x80,
-} SdSpiR2;
-
-/**
- * @brief Card Specific Data: CSD Register
- */
-typedef struct {
-    /* Header part */
-    uint8_t CSDStruct : 2; /* CSD structure */
-    uint8_t Reserved1 : 6; /* Reserved */
-    uint8_t TAAC : 8; /* Data read access-time 1 */
-    uint8_t NSAC : 8; /* Data read access-time 2 in CLK cycles */
-    uint8_t MaxBusClkFrec : 8; /* Max. bus clock frequency */
-    uint16_t CardComdClasses : 12; /* Card command classes */
-    uint8_t RdBlockLen : 4; /* Max. read data block length */
-    uint8_t PartBlockRead : 1; /* Partial blocks for read allowed */
-    uint8_t WrBlockMisalign : 1; /* Write block misalignment */
-    uint8_t RdBlockMisalign : 1; /* Read block misalignment */
-    uint8_t DSRImpl : 1; /* DSR implemented */
-
-    /* v1 or v2 struct */
-    union csd_version {
-        struct {
-            uint8_t Reserved1 : 2; /* Reserved */
-            uint16_t DeviceSize : 12; /* Device Size */
-            uint8_t MaxRdCurrentVDDMin : 3; /* Max. read current @ VDD min */
-            uint8_t MaxRdCurrentVDDMax : 3; /* Max. read current @ VDD max */
-            uint8_t MaxWrCurrentVDDMin : 3; /* Max. write current @ VDD min */
-            uint8_t MaxWrCurrentVDDMax : 3; /* Max. write current @ VDD max */
-            uint8_t DeviceSizeMul : 3; /* Device size multiplier */
-        } v1;
-        struct {
-            uint8_t Reserved1 : 6; /* Reserved */
-            uint32_t DeviceSize : 22; /* Device Size */
-            uint8_t Reserved2 : 1; /* Reserved */
-        } v2;
-    } version;
-
-    uint8_t EraseSingleBlockEnable : 1; /* Erase single block enable */
-    uint8_t EraseSectorSize : 7; /* Erase group size multiplier */
-    uint8_t WrProtectGrSize : 7; /* Write protect group size */
-    uint8_t WrProtectGrEnable : 1; /* Write protect group enable */
-    uint8_t Reserved2 : 2; /* Reserved */
-    uint8_t WrSpeedFact : 3; /* Write speed factor */
-    uint8_t MaxWrBlockLen : 4; /* Max. write data block length */
-    uint8_t WriteBlockPartial : 1; /* Partial blocks for write allowed */
-    uint8_t Reserved3 : 5; /* Reserved */
-    uint8_t FileFormatGrouop : 1; /* File format group */
-    uint8_t CopyFlag : 1; /* Copy flag (OTP) */
-    uint8_t PermWrProtect : 1; /* Permanent write protection */
-    uint8_t TempWrProtect : 1; /* Temporary write protection */
-    uint8_t FileFormat : 2; /* File Format */
-    uint8_t Reserved4 : 2; /* Reserved */
-    uint8_t crc : 7; /* Reserved */
-    uint8_t Reserved5 : 1; /* always 1*/
-
-} SD_CSD;
-
-/**
- * @brief Card Identification Data: CID Register
- */
-typedef struct {
-    uint8_t ManufacturerID; /* ManufacturerID */
-    char OEM_AppliID[2]; /* OEM/Application ID */
-    char ProdName[5]; /* Product Name */
-    uint8_t ProdRev; /* Product Revision */
-    uint32_t ProdSN; /* Product Serial Number */
-    uint8_t Reserved1; /* Reserved1 */
-    uint8_t ManufactYear; /* Manufacturing Year */
-    uint8_t ManufactMonth; /* Manufacturing Month */
-    uint8_t CID_CRC; /* CID CRC */
-    uint8_t Reserved2; /* always 1 */
-} SD_CID;
-
-/**
- * @brief SD Card information structure
- */
- typedef struct {
-     SD_CSD Csd;
-     SD_CID Cid;
-     uint64_t CardCapacity; /*!< Card Capacity */
-     uint32_t CardBlockSize; /*!< Card Block Size */
-     uint32_t LogBlockNbr; /*!< Specifies the Card logical Capacity in blocks   */
-     uint32_t LogBlockSize; /*!< Specifies logical block size in bytes           */
- } SD_CardInfo;
-
- typedef struct {
-     uint8_t r1;
-     uint8_t r2;
-     uint8_t r3;
-     uint8_t r4;
-     uint8_t r5;
- } SdSpiCmdAnswer;
-
- extern SdSpiCmdAnswer cmd_answer;
-
-
-/**
- * @brief SD card max mount retry count
- *
- * @return uint8_t
- */
-uint8_t sd_max_mount_retry_count();
-
-/**
- * @brief Init sd card
- *
- * @param power_reset reset card power
- * @return SdSpiStatus
- */
-SdSpiStatus sd_init(bool power_reset);
-
-/**
- * @brief Get card state
- *
- * @return SdSpiStatus
- */
-SdSpiStatus sd_get_card_state(void);
-
-/**
- * @brief Get card info
- *
- * @param card_info
- * @return SdSpiStatus
- */
-SdSpiStatus sd_get_card_info(SD_CardInfo* card_info);
-
-/**
- * @brief Read blocks
- *
- * @param data
- * @param address
- * @param blocks
- * @param timeout_ms
- * @return SdSpiStatus
- */
-SdSpiStatus sd_read_blocks(uint32_t* data, uint32_t address, uint32_t blocks, uint32_t timeout_ms);
-
-/**
- * @brief Write blocks
- *
- * @param data
- * @param address
- * @param blocks
- * @param timeout_ms
- * @return SdSpiStatus
- */
-SdSpiStatus
-    sd_write_blocks(uint32_t* data, uint32_t address, uint32_t blocks, uint32_t timeout_ms);
-
-/**
- * @brief Get card CSD register
- *
- * @param Cid
- * @return SdSpiStatus
- */
-SdSpiStatus sd_get_cid(SD_CID* cid);
-
-SdSpiStatus sd_set_pwd(char* pwd);
-SdSpiStatus sd_clr_pwd(char* pwd);
-SdSpiStatus sd_force_erase(void);

+ 0 - 572
non_catalog_apps/sd_spi/sd_spi_app.c

@@ -1,572 +0,0 @@
-#include <furi.h>
-#include <gui/gui.h>
-#include <gui/icon_i.h>
-#include <gui/view_dispatcher.h>
-#include <gui/scene_manager.h>
-#include <gui/modules/submenu.h>
-#include <gui/modules/text_box.h>
-#include <gui/modules/text_input.h>
-#include <gui/modules/popup.h>
-#include <gui/modules/dialog_ex.h>
-
-#include <furi_hal_spi.h>
-#include <notification/notification.h>
-#include <notification/notification_messages.h>
-#include <storage/storage.h>
-#include <toolbox/path.h>
-#include <gui/modules/widget.h>
-
-
-#include "sd_spi.h"
-
-#define TAG "sd-spi-app"
-
-/* generated by fbt from .png files in images folder */
-// #include <sd_spi_app_icons.h>
-
-#define TEXT_BOX_STORE_SIZE (4096)
-#define PASSWORD_MAX_LEN (16)
-#define ALERT_MAX_LEN 32
-
-#define STORAGE_LOCKED_FILE "pwd.txt"
-
-/** ids for all scenes used by the app */
-typedef enum {
-    AppScene_MainMenu,
-    AppScene_Status,
-    AppScene_Confirmation,
-    AppScene_Password,
-    AppScene_Info,
-    AppScene_count
-} AppScene;
-
-/** ids for the 2 types of view used by the app */
-typedef enum { AppView_Menu, AppView_Status, AppView_Dialog, AppView_TextInput, AppView_Info} SDSPIAppView;
-
-/** the app context struct */
-typedef struct {
-    SceneManager* scene_manager;
-    ViewDispatcher* view_dispatcher;
-    Submenu* menu;
-    TextBox* tb_status;
-    Widget* widget_about;
-    TextInput* text_input;
-    DialogEx* dialog;
-    char* input_pwd;
-} SDSPIApp;
-
-/** all custom events */
-typedef enum { AppEvent_Status, AppEvent_Confirmation, AppEvent_Password, AppEvent_Info } AppEvent;
-
-/** indices for menu items */
-typedef enum { AppMenuSelection_Init, AppMenuSelection_Status, AppMenuSelection_SDLock, AppMenuSelection_SDUnLock, Confirmation_Dialog, AppMenuSelection_Password, AppMenuSelection_Info } AppMenuSelection;
-
-bool notify_sequence(SdSpiStatus status){
-  NotificationApp* notifications = furi_record_open(RECORD_NOTIFICATION);
-  if(status == SdSpiStatusOK){ notification_message(notifications, &sequence_success); return true; }
-  else{ notification_message(notifications, &sequence_error); }
-  return false;
-  furi_record_close(RECORD_NOTIFICATION);
-}
-
-/** main menu callback - sends a custom event to the scene manager based on the menu selection */
-void app_menu_callback_main_menu(void* context, uint32_t index) {
-    FURI_LOG_T(TAG, "app_menu_callback_main_menu");
-    SDSPIApp* app = context;
-    switch(index) {
-    case AppMenuSelection_Status:
-      scene_manager_handle_custom_event(app->scene_manager, AppEvent_Status);
-      break;
-    case AppMenuSelection_Init:
-      {
-        SdSpiStatus sdStatus;
-        sdStatus = sd_init(false);
-        notify_sequence(sdStatus);
-      }
-      break;
-    case AppMenuSelection_SDLock:
-      FURI_LOG_T(TAG, "AppMenuSelection_SDLock");
-      {
-        SdSpiStatus sdStatus;
-        sdStatus = sd_set_pwd(app->input_pwd);
-        notify_sequence(sdStatus);
-      }
-
-      break;
-    case AppMenuSelection_SDUnLock:
-      FURI_LOG_T(TAG, "AppMenuSelection_SDUnLock");
-      {
-        SdSpiStatus sdStatus;// = sd_init(false);
-        sdStatus = sd_clr_pwd(app->input_pwd);
-        notify_sequence(sdStatus);
-      }
-      break;
-    case AppMenuSelection_Password:
-      scene_manager_handle_custom_event(app->scene_manager, AppEvent_Password);
-      break;
-    case Confirmation_Dialog:
-      scene_manager_handle_custom_event(app->scene_manager, AppEvent_Confirmation);
-      break;
-    case AppMenuSelection_Info:
-      scene_manager_handle_custom_event(app->scene_manager, AppEvent_Info);
-      break;
-    }
-}
-
-/** resets the menu, gives it content, callbacks and selection enums */
-void app_scene_on_enter_main_menu(void* context) {
-    FURI_LOG_T(TAG, "app_scene_on_enter_main_menu");
-    SDSPIApp* app = context;
-    submenu_reset(app->menu);
-
-    submenu_add_item(
-      app->menu,
-      "SD Init",
-      AppMenuSelection_Init,
-      app_menu_callback_main_menu,
-      app);
-    submenu_add_item(
-      app->menu,
-      "SD Status",
-      AppMenuSelection_Status,
-      app_menu_callback_main_menu,
-      app);
-    submenu_add_item(
-      app->menu,
-      "SD Lock",
-      AppMenuSelection_SDLock,
-      app_menu_callback_main_menu,
-      app);
-    submenu_add_item(
-      app->menu,
-      "SD Unlock",
-      AppMenuSelection_SDUnLock,
-      app_menu_callback_main_menu,
-      app);
-    submenu_add_item(
-      app->menu,
-      "SD Force Erase",
-      Confirmation_Dialog,
-      app_menu_callback_main_menu,
-      app);
-    submenu_add_item(
-      app->menu,
-      "Password",
-      AppMenuSelection_Password,
-      app_menu_callback_main_menu,
-      app);
-    submenu_add_item(
-      app->menu,
-      "About",
-      AppMenuSelection_Info,
-      app_menu_callback_main_menu,
-      app);
-
-    view_dispatcher_switch_to_view(app->view_dispatcher, AppView_Menu);
-}
-
-/** main menu event handler - switches scene based on the event */
-bool app_scene_on_event_main_menu(void* context, SceneManagerEvent event) {
-    FURI_LOG_T(TAG, "app_scene_on_event_main_menu");
-    SDSPIApp* app = context;
-    bool consumed = false;
-    switch(event.type) {
-    case SceneManagerEventTypeCustom:
-        switch(event.event) {
-        case AppEvent_Status:
-            scene_manager_next_scene(app->scene_manager, AppScene_Status);
-            consumed = true;
-            break;
-        case AppEvent_Confirmation:
-            scene_manager_next_scene(app->scene_manager, AppScene_Confirmation);
-            consumed = true;
-            break;
-        case AppEvent_Password:
-            scene_manager_next_scene(app->scene_manager, AppScene_Password);
-            consumed = true;
-            break;
-        case AppEvent_Info:
-            scene_manager_next_scene(app->scene_manager, AppScene_Info);
-            consumed = true;
-            break;
-        }
-        break;
-    default:
-        consumed = false;
-        break;
-    }
-    return consumed;
-}
-
-void app_scene_on_exit_main_menu(void* context) {
-    FURI_LOG_T(TAG, "app_scene_on_exit_main_menu");
-    SDSPIApp* app = context;
-    submenu_reset(app->menu);
-}
-
-bool text_input_validator(const char* text, FuriString* error, void* context) {
-    UNUSED(context);
-    bool validated = true;
-    if(strlen(text) > PASSWORD_MAX_LEN || strlen(text) < 1) {
-        furi_string_set(error, "the pwd\nmust have\nfrom 1 to\n16 chars");
-        validated = false;
-    }
-    return validated;
-}
-void text_input_done_callback(void* context){
-  SDSPIApp* app = context;
-  Storage* storage = furi_record_open(RECORD_STORAGE);
-  FuriString* path;
-  path = furi_string_alloc();
-  furi_string_set_str(path, EXT_PATH("apps_data/sdspi"));
-  if(!storage_file_exists(storage,EXT_PATH("apps_data"))) { storage_common_mkdir(storage, EXT_PATH("apps_data")); }
-  if(!storage_file_exists(storage,EXT_PATH("apps_data/sdspi"))) { storage_common_mkdir(storage, EXT_PATH("apps_data/sdspi")); }
-
-  path_append(path,STORAGE_LOCKED_FILE);
-  File* file = storage_file_alloc(storage);
-  storage_simply_remove(storage, furi_string_get_cstr(path));
-  if(!storage_file_open(file, furi_string_get_cstr(path), FSAM_WRITE, FSOM_CREATE_ALWAYS)) {
-      FURI_LOG_E(TAG, "Failed to open file");
-  }
-  if(!storage_file_write(file, app->input_pwd, strlen(app->input_pwd))) {
-      FURI_LOG_E(TAG, "Failed to write to file");
-  }
-  furi_string_free(path);
-  storage_file_close(file);
-  storage_file_free(file);
-  furi_record_close(RECORD_STORAGE);
-  scene_manager_previous_scene(app->scene_manager);
-}
-
-/* App Scene Select Password */
-void app_scene_on_enter_password(void* context) {
-    FURI_LOG_T(TAG, "app_scene_on_enter_password");
-    SDSPIApp* app = context;
-    text_input_set_header_text(app->text_input,"Enter password");
-    text_input_set_validator(app->text_input, text_input_validator, context);
-    text_input_set_result_callback(
-        app->text_input,
-        text_input_done_callback,
-        app,
-        app->input_pwd,
-        PASSWORD_MAX_LEN,
-        false);
-    view_dispatcher_switch_to_view(app->view_dispatcher, AppView_TextInput);
-}
-bool app_scene_on_event_password(void* context, SceneManagerEvent event) {
-    FURI_LOG_T(TAG, "app_scene_on_event_password");
-    UNUSED(context);
-    UNUSED(event);
-    return false;
-}
-void app_scene_on_exit_password(void* context) {
-    FURI_LOG_T(TAG, "app_scene_on_exit_password");
-    SDSPIApp* app = context;
-    text_input_reset(app->text_input);
-}
-
-/* App Scene Confirm SD Force Erase */
-void app_dialog_erase_callback(DialogExResult result, void* context) {
-  SDSPIApp* app = context;
-  if(result == DialogExResultLeft) { scene_manager_previous_scene(app->scene_manager); }
-  else if(result == DialogExResultRight) {
-    {
-      SdSpiStatus sdStatus;
-      sdStatus = sd_force_erase();
-      if(notify_sequence(sdStatus)){ scene_manager_previous_scene(app->scene_manager); };
-    }
-  }
-}
-void app_scene_on_enter_dialog(void* context) {
-    FURI_LOG_T(TAG, "app_scene_on_enter_dialog");
-    SDSPIApp* app = context;
-    dialog_ex_reset(app->dialog);
-
-    dialog_ex_set_result_callback(app->dialog, app_dialog_erase_callback);
-    dialog_ex_set_context(app->dialog, app);
-    dialog_ex_set_left_button_text(app->dialog, "Back");
-    dialog_ex_set_right_button_text(app->dialog, "Erase");
-    // dialog_ex_set_center_button_text(app->dialog, "Menu List");
-    dialog_ex_set_header(app->dialog, "Erase SD card?", 128/2, 12, AlignCenter, AlignTop);
-    view_dispatcher_switch_to_view(app->view_dispatcher, AppView_Dialog);
-}
-bool app_scene_on_event_dialog(void* context, SceneManagerEvent event) {
-    FURI_LOG_T(TAG, "app_scene_on_event_dialog");
-    UNUSED(context);
-    UNUSED(event);
-    return false;
-}
-void app_scene_on_exit_dialog(void* context) {
-    FURI_LOG_T(TAG, "app_scene_on_exit_dialog");
-    SDSPIApp* app = context;
-    dialog_ex_reset(app->dialog);
-}
-
-/* App Scene About */
-void app_scene_on_enter_info(void* context) {
-    FURI_LOG_T(TAG, "app_scene_on_enter_info");
-    SDSPIApp* app = context;
-    widget_reset(app->widget_about);
-    widget_add_text_box_element(
-        app->widget_about,
-        0,
-        2,
-        128,
-        14,
-        AlignCenter,
-        AlignBottom,
-        "\e#\e!            SD Spi           \e!\n",
-        false);
-    FuriString* temp_str = furi_string_alloc();
-    furi_string_cat_printf(temp_str, "Version: %s\n", VERSION_APP);
-    furi_string_cat_printf(temp_str, "Developed by: %s\n", DEVELOPED);
-    furi_string_cat_printf(temp_str, "Github: %s\n\n", GITHUB);
-
-    widget_add_text_scroll_element(app->widget_about, 0, 16, 128, 50, furi_string_get_cstr(temp_str));
-    view_dispatcher_switch_to_view(app->view_dispatcher, AppView_Info);
-}
-bool app_scene_on_event_info(void* context, SceneManagerEvent event) {
-    FURI_LOG_T(TAG, "app_scene_on_event_info");
-    UNUSED(context);
-    UNUSED(event);
-    return false;
-}
-void app_scene_on_exit_info(void* context) {
-    FURI_LOG_T(TAG, "app_scene_on_exit_info");
-    SDSPIApp* app = context;
-    widget_reset(app->widget_about);
-}
-
-/* App Scene SD Status */
-void app_scene_on_enter_status(void* context) {
-    FURI_LOG_T(TAG, "app_scene_on_enter_status");
-    SDSPIApp* app = context;
-    text_box_reset(app->tb_status);
-
-    FuriString* fs_status = furi_string_alloc();
-    furi_string_reserve(fs_status, TEXT_BOX_STORE_SIZE);
-    furi_string_set_char(fs_status, 0, 0);
-    furi_string_set_str(fs_status, "Sd Status:");
-
-    furi_string_cat_str(fs_status, "\nR1");
-    if(cmd_answer.r1 != 0xff) {
-      if(cmd_answer.r1 == SdSpi_R1_NO_ERROR){ furi_string_cat_str(fs_status, "\nNO_ERROR"); }
-      if(cmd_answer.r1 & SdSpi_R1_ERASE_RESET){ furi_string_cat_str(fs_status, "\nERASE_RESET"); }
-      if(cmd_answer.r1 & SdSpi_R1_IN_IDLE_STATE){ furi_string_cat_str(fs_status, "\nIN_IDLE_STATE"); }
-      if(cmd_answer.r1 & SdSpi_R1_ILLEGAL_COMMAND){ furi_string_cat_str(fs_status, "\nILLEGAL_COMMAND"); }
-      if(cmd_answer.r1 & SdSpi_R1_COM_CRC_ERROR){ furi_string_cat_str(fs_status, "\nCOM_CRC_ERROR"); }
-      if(cmd_answer.r1 & SdSpi_R1_ERASE_SEQUENCE_ERROR){ furi_string_cat_str(fs_status, "\nERASE_SEQUENCE_ERROR"); }
-      if(cmd_answer.r1 & SdSpi_R1_ADDRESS_ERROR){ furi_string_cat_str(fs_status, "\nADDRESS_ERROR"); }
-      if(cmd_answer.r1 & SdSpi_R1_PARAMETER_ERROR){ furi_string_cat_str(fs_status, "\nPARAMETER_ERROR"); }
-    }
-
-    furi_string_cat_str(fs_status, "\nR2");
-    if(cmd_answer.r2 != 0xff) {
-      if(cmd_answer.r2 == SdSpi_R2_NO_ERROR){ furi_string_cat_str(fs_status, "\nNO_ERROR"); }
-      if(cmd_answer.r2 & SdSpi_R2_CARD_LOCKED){ furi_string_cat_str(fs_status, "\nCARD_LOCKED"); }
-      if(cmd_answer.r2 & SdSpi_R2_LOCKUNLOCK_ERROR){ furi_string_cat_str(fs_status, "\nLOCKUNLOCK_ERROR"); }
-      if(cmd_answer.r2 & SdSpi_R2_ERROR){ furi_string_cat_str(fs_status, "\nERROR"); }
-      if(cmd_answer.r2 & SdSpi_R2_CC_ERROR){ furi_string_cat_str(fs_status, "\nCC_ERROR"); }
-      if(cmd_answer.r2 & SdSpi_R2_CARD_ECC_FAILED){ furi_string_cat_str(fs_status, "\nCARD_ECC_FAILED"); }
-      if(cmd_answer.r2 & SdSpi_R2_WP_VIOLATION){ furi_string_cat_str(fs_status, "\nWP_VIOLATION"); }
-      if(cmd_answer.r2 & SdSpi_R2_ERASE_PARAM){ furi_string_cat_str(fs_status, "\nERASE_PARAM"); }
-      if(cmd_answer.r2 & SdSpi_R2_OUTOFRANGE){ furi_string_cat_str(fs_status, "\nOUTOFRANGE"); }
-    }
-
-    text_box_set_text(app->tb_status, furi_string_get_cstr(fs_status));
-    text_box_set_focus(app->tb_status, TextBoxFocusEnd);
-    view_dispatcher_switch_to_view(app->view_dispatcher, AppView_Status);
-}
-bool app_scene_on_event_status(void* context, SceneManagerEvent event) {
-    FURI_LOG_T(TAG, "app_scene_on_event_status");
-    UNUSED(context);
-    UNUSED(event);
-    return false;
-}
-void app_scene_on_exit_status(void* context) {
-    FURI_LOG_T(TAG, "app_scene_on_exit_status");
-    SDSPIApp* app = context;
-    text_box_reset(app->tb_status);
-}
-
-
-
-/** collection of all scene on_enter handlers - in the same order as their enum */
-void (*const app_scene_on_enter_handlers[])(void*) = {
-    app_scene_on_enter_main_menu,
-    app_scene_on_enter_status,
-    // app_scene_on_enter_info,
-    app_scene_on_enter_dialog,
-    app_scene_on_enter_password,
-    app_scene_on_enter_info};
-
-/** collection of all scene on event handlers - in the same order as their enum */
-bool (*const app_scene_on_event_handlers[])(void*, SceneManagerEvent) = {
-    app_scene_on_event_main_menu,
-    app_scene_on_event_status,
-    // app_scene_on_event_info,
-    app_scene_on_event_dialog,
-    app_scene_on_event_password,
-    app_scene_on_event_info};
-
-/** collection of all scene on exit handlers - in the same order as their enum */
-void (*const app_scene_on_exit_handlers[])(void*) = {
-    app_scene_on_exit_main_menu,
-    app_scene_on_exit_status,
-    // app_scene_on_exit_info,
-    app_scene_on_exit_dialog,
-    app_scene_on_exit_password,
-    app_scene_on_exit_info};
-
-/** collection of all on_enter, on_event, on_exit handlers */
-const SceneManagerHandlers app_scene_event_handlers = {
-    .on_enter_handlers = app_scene_on_enter_handlers,
-    .on_event_handlers = app_scene_on_event_handlers,
-    .on_exit_handlers = app_scene_on_exit_handlers,
-    .scene_num = AppScene_count};
-
-/** custom event handler - passes the event to the scene manager */
-bool app_scene_manager_custom_event_callback(void* context, uint32_t custom_event) {
-    FURI_LOG_T(TAG, "app_scene_manager_custom_event_callback");
-    furi_assert(context);
-    SDSPIApp* app = context;
-    return scene_manager_handle_custom_event(app->scene_manager, custom_event);
-}
-
-/** navigation event handler - passes the event to the scene manager */
-bool app_scene_manager_navigation_event_callback(void* context) {
-    FURI_LOG_T(TAG, "app_scene_manager_navigation_event_callback");
-    furi_assert(context);
-    SDSPIApp* app = context;
-    return scene_manager_handle_back_event(app->scene_manager);
-}
-
-/** initialise the scene manager with all handlers */
-void app_scene_manager_init(SDSPIApp* app) {
-    FURI_LOG_T(TAG, "app_scene_manager_init");
-    app->scene_manager = scene_manager_alloc(&app_scene_event_handlers, app);
-}
-
-
-/** initialise the views, and initialise the view dispatcher with all views */
-void app_view_dispatcher_init(SDSPIApp* app) {
-    FURI_LOG_T(TAG, "app_view_dispatcher_init");
-    app->view_dispatcher = view_dispatcher_alloc();
-    view_dispatcher_enable_queue(app->view_dispatcher);
-
-    // allocate each view
-    FURI_LOG_D(TAG, "app_view_dispatcher_init allocating views");
-    app->menu = submenu_alloc();
-    app->tb_status = text_box_alloc();
-    app->text_input = text_input_alloc();
-    app->widget_about = widget_alloc();
-    app->dialog = dialog_ex_alloc();
-
-    app->input_pwd = "";
-
-    Storage* storage = furi_record_open(RECORD_STORAGE);
-    FuriString* path;
-    path = furi_string_alloc();
-    furi_string_set_str(path, EXT_PATH("apps_data/sdspi"));
-    path_append(path,STORAGE_LOCKED_FILE);
-    if(storage_file_exists(storage,furi_string_get_cstr(path))) {
-      File* file = storage_file_alloc(storage);
-      if(storage_file_open(file, furi_string_get_cstr(path), FSAM_READ, FSOM_OPEN_EXISTING)) {
-          FURI_LOG_E(TAG, "File pwd loading");
-          char data[PASSWORD_MAX_LEN] = {0};
-          if(storage_file_read(file, data, PASSWORD_MAX_LEN)>0){
-            FURI_LOG_E(TAG, "File pwd laoded");
-            // app->input_pwd = data;
-            strncpy(app->input_pwd,data,PASSWORD_MAX_LEN);
-            FURI_LOG_E(TAG, data);
-          }
-          storage_file_close(file);
-      }
-      else{
-        FURI_LOG_E(TAG, "File pwd not found");
-      }
-      storage_file_free(file);
-    }
-    furi_string_free(path);
-    furi_record_close(RECORD_STORAGE);
-
-    FURI_LOG_D(TAG, "app_view_dispatcher_init setting callbacks");
-    view_dispatcher_set_event_callback_context(app->view_dispatcher, app);
-    view_dispatcher_set_custom_event_callback(app->view_dispatcher, app_scene_manager_custom_event_callback);
-    view_dispatcher_set_navigation_event_callback(app->view_dispatcher, app_scene_manager_navigation_event_callback);
-
-    // add views to the dispatcher, indexed by their enum value
-    FURI_LOG_D(TAG, "app_view_dispatcher_init adding view menu");
-    view_dispatcher_add_view(app->view_dispatcher, AppView_Menu, submenu_get_view(app->menu));
-
-    FURI_LOG_D(TAG, "app_view_dispatcher_init adding view textbox");
-    view_dispatcher_add_view(app->view_dispatcher, AppView_Status, text_box_get_view(app->tb_status));
-
-    FURI_LOG_D(TAG, "app_view_dispatcher_init adding view dialog");
-    view_dispatcher_add_view(app->view_dispatcher, AppView_Dialog, dialog_ex_get_view(app->dialog));
-
-    FURI_LOG_D(TAG, "app_view_dispatcher_init adding view password");
-    view_dispatcher_add_view(app->view_dispatcher, AppView_TextInput, text_input_get_view(app->text_input));
-
-    FURI_LOG_D(TAG, "app_view_dispatcher_init adding view about");
-    view_dispatcher_add_view(app->view_dispatcher, AppView_Info, widget_get_view(app->widget_about));
-}
-
-/** initialise app data, scene manager, and view dispatcher */
-SDSPIApp* app_init() {
-    FURI_LOG_T(TAG, "app_init");
-    SDSPIApp* app = malloc(sizeof(SDSPIApp));
-    app_scene_manager_init(app);
-    app_view_dispatcher_init(app);
-    return app;
-}
-
-/** free all app data, scene manager, and view dispatcher */
-void app_free(SDSPIApp* app) {
-    FURI_LOG_T(TAG, "app_free");
-    scene_manager_free(app->scene_manager);
-    view_dispatcher_remove_view(app->view_dispatcher, AppView_Menu);
-    view_dispatcher_remove_view(app->view_dispatcher, AppView_Status);
-    view_dispatcher_remove_view(app->view_dispatcher, AppView_TextInput);
-    view_dispatcher_remove_view(app->view_dispatcher, AppView_Dialog);
-    view_dispatcher_remove_view(app->view_dispatcher, AppView_Info);
-    view_dispatcher_free(app->view_dispatcher);
-    submenu_free(app->menu);
-    text_box_free(app->tb_status);
-    widget_free(app->widget_about);
-    dialog_ex_free(app->dialog);
-    text_input_free(app->text_input);
-    free(app);
-}
-
-/** go to trace log level in the dev environment */
-void app_set_log_level() {
-#ifdef FURI_DEBUG
-    furi_log_set_level(FuriLogLevelTrace);
-#else
-    furi_log_set_level(FuriLogLevelInfo);
-#endif
-}
-
-/** entrypoint */
-int32_t sd_spi_app(void* p) {
-    UNUSED(p);
-    app_set_log_level();
-
-    // create the app context struct, scene manager, and view dispatcher
-    FURI_LOG_I(TAG, "sd_spi_app starting...");
-    SDSPIApp* app = app_init();
-
-    // set the scene and launch the main loop
-    Gui* gui = furi_record_open(RECORD_GUI);
-    view_dispatcher_attach_to_gui(app->view_dispatcher, gui, ViewDispatcherTypeFullscreen);
-    scene_manager_next_scene(app->scene_manager, AppScene_MainMenu);
-    FURI_LOG_D(TAG, "Starting dispatcher...");
-    view_dispatcher_run(app->view_dispatcher);
-
-    // free all memory
-    FURI_LOG_I(TAG, "app finishing...");
-    furi_record_close(RECORD_GUI);
-    app_free(app);
-    return 0;
-}

BIN
non_catalog_apps/sd_spi/sd_spi_app_10px.png