├── 2.0surface fix2.dwg ├── LICENSE ├── NAGEKI 2.0 surface v19.dwg ├── NAGEKI 3.0 ├── NAGEKI 3.0 final fix.dwg ├── ONGEKI WAD button.stl ├── ONGEKI WAD shield.stl ├── Schematic_ONGEKI PCB 3.0 eng_2022-06-08.svg ├── UV 20220426 .png ├── ongeki lever v3.stl └── readme.md ├── NAGEKI PCB V2.zip ├── NAGEKI WAD.zip ├── ONGEKI WAD button.stl ├── ONGEKI WAD shield.stl ├── README.md ├── README_CN.md ├── nageki2.0 code ├── nageki2.0.ino └── src │ ├── Encoder │ ├── Encoder.cpp │ ├── Encoder.h │ └── utility │ │ ├── direct_pin_read.h │ │ ├── interrupt_config.h │ │ └── interrupt_pins.h │ └── NeoPixel │ └── light.h ├── pic ├── Denoised beauty.png ├── IMG_8305.JPG ├── IMG_8331.JPG ├── IMG_8332.JPG ├── IMG_8376.PNG ├── IMG_8377.PNG ├── IMG_8378.PNG ├── IMG_8379.PNG ├── NAGEKI 2.1 UV BRIGHT 2.png ├── NAGEKI 3 side.png ├── NAGEKI 3.png ├── PCB 2.0 B.png ├── PCB 2.0.png ├── PCB3.png ├── QQ截图20211012202125.png ├── lever.png ├── leverd.jpg ├── main.png └── pcb.png └── skin ├── NAGEKI 2.1 UV BRIGHT 2.png ├── NAGEKI 2.1 UV BRIGHT.png └── NAGEKI 2.1 UV.png /2.0surface fix2.dwg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nana0Nana/NAGEKI/42f0009509a7cd1791d0e71a70f73c9ecc5fad9d/2.0surface fix2.dwg -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Mozilla Public License Version 2.0 2 | ================================== 3 | 4 | 1. Definitions 5 | -------------- 6 | 7 | 1.1. "Contributor" 8 | means each individual or legal entity that creates, contributes to 9 | the creation of, or owns Covered Software. 10 | 11 | 1.2. "Contributor Version" 12 | means the combination of the Contributions of others (if any) used 13 | by a Contributor and that particular Contributor's Contribution. 14 | 15 | 1.3. "Contribution" 16 | means Covered Software of a particular Contributor. 17 | 18 | 1.4. "Covered Software" 19 | means Source Code Form to which the initial Contributor has attached 20 | the notice in Exhibit A, the Executable Form of such Source Code 21 | Form, and Modifications of such Source Code Form, in each case 22 | including portions thereof. 23 | 24 | 1.5. "Incompatible With Secondary Licenses" 25 | means 26 | 27 | (a) that the initial Contributor has attached the notice described 28 | in Exhibit B to the Covered Software; or 29 | 30 | (b) that the Covered Software was made available under the terms of 31 | version 1.1 or earlier of the License, but not also under the 32 | terms of a Secondary License. 33 | 34 | 1.6. "Executable Form" 35 | means any form of the work other than Source Code Form. 36 | 37 | 1.7. "Larger Work" 38 | means a work that combines Covered Software with other material, in 39 | a separate file or files, that is not Covered Software. 40 | 41 | 1.8. "License" 42 | means this document. 43 | 44 | 1.9. "Licensable" 45 | means having the right to grant, to the maximum extent possible, 46 | whether at the time of the initial grant or subsequently, any and 47 | all of the rights conveyed by this License. 48 | 49 | 1.10. "Modifications" 50 | means any of the following: 51 | 52 | (a) any file in Source Code Form that results from an addition to, 53 | deletion from, or modification of the contents of Covered 54 | Software; or 55 | 56 | (b) any new file in Source Code Form that contains any Covered 57 | Software. 58 | 59 | 1.11. "Patent Claims" of a Contributor 60 | means any patent claim(s), including without limitation, method, 61 | process, and apparatus claims, in any patent Licensable by such 62 | Contributor that would be infringed, but for the grant of the 63 | License, by the making, using, selling, offering for sale, having 64 | made, import, or transfer of either its Contributions or its 65 | Contributor Version. 66 | 67 | 1.12. "Secondary License" 68 | means either the GNU General Public License, Version 2.0, the GNU 69 | Lesser General Public License, Version 2.1, the GNU Affero General 70 | Public License, Version 3.0, or any later versions of those 71 | licenses. 72 | 73 | 1.13. "Source Code Form" 74 | means the form of the work preferred for making modifications. 75 | 76 | 1.14. "You" (or "Your") 77 | means an individual or a legal entity exercising rights under this 78 | License. For legal entities, "You" includes any entity that 79 | controls, is controlled by, or is under common control with You. For 80 | purposes of this definition, "control" means (a) the power, direct 81 | or indirect, to cause the direction or management of such entity, 82 | whether by contract or otherwise, or (b) ownership of more than 83 | fifty percent (50%) of the outstanding shares or beneficial 84 | ownership of such entity. 85 | 86 | 2. License Grants and Conditions 87 | -------------------------------- 88 | 89 | 2.1. Grants 90 | 91 | Each Contributor hereby grants You a world-wide, royalty-free, 92 | non-exclusive license: 93 | 94 | (a) under intellectual property rights (other than patent or trademark) 95 | Licensable by such Contributor to use, reproduce, make available, 96 | modify, display, perform, distribute, and otherwise exploit its 97 | Contributions, either on an unmodified basis, with Modifications, or 98 | as part of a Larger Work; and 99 | 100 | (b) under Patent Claims of such Contributor to make, use, sell, offer 101 | for sale, have made, import, and otherwise transfer either its 102 | Contributions or its Contributor Version. 103 | 104 | 2.2. Effective Date 105 | 106 | The licenses granted in Section 2.1 with respect to any Contribution 107 | become effective for each Contribution on the date the Contributor first 108 | distributes such Contribution. 109 | 110 | 2.3. Limitations on Grant Scope 111 | 112 | The licenses granted in this Section 2 are the only rights granted under 113 | this License. No additional rights or licenses will be implied from the 114 | distribution or licensing of Covered Software under this License. 115 | Notwithstanding Section 2.1(b) above, no patent license is granted by a 116 | Contributor: 117 | 118 | (a) for any code that a Contributor has removed from Covered Software; 119 | or 120 | 121 | (b) for infringements caused by: (i) Your and any other third party's 122 | modifications of Covered Software, or (ii) the combination of its 123 | Contributions with other software (except as part of its Contributor 124 | Version); or 125 | 126 | (c) under Patent Claims infringed by Covered Software in the absence of 127 | its Contributions. 128 | 129 | This License does not grant any rights in the trademarks, service marks, 130 | or logos of any Contributor (except as may be necessary to comply with 131 | the notice requirements in Section 3.4). 132 | 133 | 2.4. Subsequent Licenses 134 | 135 | No Contributor makes additional grants as a result of Your choice to 136 | distribute the Covered Software under a subsequent version of this 137 | License (see Section 10.2) or under the terms of a Secondary License (if 138 | permitted under the terms of Section 3.3). 139 | 140 | 2.5. Representation 141 | 142 | Each Contributor represents that the Contributor believes its 143 | Contributions are its original creation(s) or it has sufficient rights 144 | to grant the rights to its Contributions conveyed by this License. 145 | 146 | 2.6. Fair Use 147 | 148 | This License is not intended to limit any rights You have under 149 | applicable copyright doctrines of fair use, fair dealing, or other 150 | equivalents. 151 | 152 | 2.7. Conditions 153 | 154 | Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted 155 | in Section 2.1. 156 | 157 | 3. Responsibilities 158 | ------------------- 159 | 160 | 3.1. Distribution of Source Form 161 | 162 | All distribution of Covered Software in Source Code Form, including any 163 | Modifications that You create or to which You contribute, must be under 164 | the terms of this License. You must inform recipients that the Source 165 | Code Form of the Covered Software is governed by the terms of this 166 | License, and how they can obtain a copy of this License. You may not 167 | attempt to alter or restrict the recipients' rights in the Source Code 168 | Form. 169 | 170 | 3.2. Distribution of Executable Form 171 | 172 | If You distribute Covered Software in Executable Form then: 173 | 174 | (a) such Covered Software must also be made available in Source Code 175 | Form, as described in Section 3.1, and You must inform recipients of 176 | the Executable Form how they can obtain a copy of such Source Code 177 | Form by reasonable means in a timely manner, at a charge no more 178 | than the cost of distribution to the recipient; and 179 | 180 | (b) You may distribute such Executable Form under the terms of this 181 | License, or sublicense it under different terms, provided that the 182 | license for the Executable Form does not attempt to limit or alter 183 | the recipients' rights in the Source Code Form under this License. 184 | 185 | 3.3. Distribution of a Larger Work 186 | 187 | You may create and distribute a Larger Work under terms of Your choice, 188 | provided that You also comply with the requirements of this License for 189 | the Covered Software. If the Larger Work is a combination of Covered 190 | Software with a work governed by one or more Secondary Licenses, and the 191 | Covered Software is not Incompatible With Secondary Licenses, this 192 | License permits You to additionally distribute such Covered Software 193 | under the terms of such Secondary License(s), so that the recipient of 194 | the Larger Work may, at their option, further distribute the Covered 195 | Software under the terms of either this License or such Secondary 196 | License(s). 197 | 198 | 3.4. Notices 199 | 200 | You may not remove or alter the substance of any license notices 201 | (including copyright notices, patent notices, disclaimers of warranty, 202 | or limitations of liability) contained within the Source Code Form of 203 | the Covered Software, except that You may alter any license notices to 204 | the extent required to remedy known factual inaccuracies. 205 | 206 | 3.5. Application of Additional Terms 207 | 208 | You may choose to offer, and to charge a fee for, warranty, support, 209 | indemnity or liability obligations to one or more recipients of Covered 210 | Software. However, You may do so only on Your own behalf, and not on 211 | behalf of any Contributor. You must make it absolutely clear that any 212 | such warranty, support, indemnity, or liability obligation is offered by 213 | You alone, and You hereby agree to indemnify every Contributor for any 214 | liability incurred by such Contributor as a result of warranty, support, 215 | indemnity or liability terms You offer. You may include additional 216 | disclaimers of warranty and limitations of liability specific to any 217 | jurisdiction. 218 | 219 | 4. Inability to Comply Due to Statute or Regulation 220 | --------------------------------------------------- 221 | 222 | If it is impossible for You to comply with any of the terms of this 223 | License with respect to some or all of the Covered Software due to 224 | statute, judicial order, or regulation then You must: (a) comply with 225 | the terms of this License to the maximum extent possible; and (b) 226 | describe the limitations and the code they affect. Such description must 227 | be placed in a text file included with all distributions of the Covered 228 | Software under this License. Except to the extent prohibited by statute 229 | or regulation, such description must be sufficiently detailed for a 230 | recipient of ordinary skill to be able to understand it. 231 | 232 | 5. Termination 233 | -------------- 234 | 235 | 5.1. The rights granted under this License will terminate automatically 236 | if You fail to comply with any of its terms. However, if You become 237 | compliant, then the rights granted under this License from a particular 238 | Contributor are reinstated (a) provisionally, unless and until such 239 | Contributor explicitly and finally terminates Your grants, and (b) on an 240 | ongoing basis, if such Contributor fails to notify You of the 241 | non-compliance by some reasonable means prior to 60 days after You have 242 | come back into compliance. Moreover, Your grants from a particular 243 | Contributor are reinstated on an ongoing basis if such Contributor 244 | notifies You of the non-compliance by some reasonable means, this is the 245 | first time You have received notice of non-compliance with this License 246 | from such Contributor, and You become compliant prior to 30 days after 247 | Your receipt of the notice. 248 | 249 | 5.2. If You initiate litigation against any entity by asserting a patent 250 | infringement claim (excluding declaratory judgment actions, 251 | counter-claims, and cross-claims) alleging that a Contributor Version 252 | directly or indirectly infringes any patent, then the rights granted to 253 | You by any and all Contributors for the Covered Software under Section 254 | 2.1 of this License shall terminate. 255 | 256 | 5.3. In the event of termination under Sections 5.1 or 5.2 above, all 257 | end user license agreements (excluding distributors and resellers) which 258 | have been validly granted by You or Your distributors under this License 259 | prior to termination shall survive termination. 260 | 261 | ************************************************************************ 262 | * * 263 | * 6. Disclaimer of Warranty * 264 | * ------------------------- * 265 | * * 266 | * Covered Software is provided under this License on an "as is" * 267 | * basis, without warranty of any kind, either expressed, implied, or * 268 | * statutory, including, without limitation, warranties that the * 269 | * Covered Software is free of defects, merchantable, fit for a * 270 | * particular purpose or non-infringing. The entire risk as to the * 271 | * quality and performance of the Covered Software is with You. * 272 | * Should any Covered Software prove defective in any respect, You * 273 | * (not any Contributor) assume the cost of any necessary servicing, * 274 | * repair, or correction. This disclaimer of warranty constitutes an * 275 | * essential part of this License. No use of any Covered Software is * 276 | * authorized under this License except under this disclaimer. * 277 | * * 278 | ************************************************************************ 279 | 280 | ************************************************************************ 281 | * * 282 | * 7. Limitation of Liability * 283 | * -------------------------- * 284 | * * 285 | * Under no circumstances and under no legal theory, whether tort * 286 | * (including negligence), contract, or otherwise, shall any * 287 | * Contributor, or anyone who distributes Covered Software as * 288 | * permitted above, be liable to You for any direct, indirect, * 289 | * special, incidental, or consequential damages of any character * 290 | * including, without limitation, damages for lost profits, loss of * 291 | * goodwill, work stoppage, computer failure or malfunction, or any * 292 | * and all other commercial damages or losses, even if such party * 293 | * shall have been informed of the possibility of such damages. This * 294 | * limitation of liability shall not apply to liability for death or * 295 | * personal injury resulting from such party's negligence to the * 296 | * extent applicable law prohibits such limitation. Some * 297 | * jurisdictions do not allow the exclusion or limitation of * 298 | * incidental or consequential damages, so this exclusion and * 299 | * limitation may not apply to You. * 300 | * * 301 | ************************************************************************ 302 | 303 | 8. Litigation 304 | ------------- 305 | 306 | Any litigation relating to this License may be brought only in the 307 | courts of a jurisdiction where the defendant maintains its principal 308 | place of business and such litigation shall be governed by laws of that 309 | jurisdiction, without reference to its conflict-of-law provisions. 310 | Nothing in this Section shall prevent a party's ability to bring 311 | cross-claims or counter-claims. 312 | 313 | 9. Miscellaneous 314 | ---------------- 315 | 316 | This License represents the complete agreement concerning the subject 317 | matter hereof. If any provision of this License is held to be 318 | unenforceable, such provision shall be reformed only to the extent 319 | necessary to make it enforceable. Any law or regulation which provides 320 | that the language of a contract shall be construed against the drafter 321 | shall not be used to construe this License against a Contributor. 322 | 323 | 10. Versions of the License 324 | --------------------------- 325 | 326 | 10.1. New Versions 327 | 328 | Mozilla Foundation is the license steward. Except as provided in Section 329 | 10.3, no one other than the license steward has the right to modify or 330 | publish new versions of this License. Each version will be given a 331 | distinguishing version number. 332 | 333 | 10.2. Effect of New Versions 334 | 335 | You may distribute the Covered Software under the terms of the version 336 | of the License under which You originally received the Covered Software, 337 | or under the terms of any subsequent version published by the license 338 | steward. 339 | 340 | 10.3. Modified Versions 341 | 342 | If you create software not governed by this License, and you want to 343 | create a new license for such software, you may create and use a 344 | modified version of this License if you rename the license and remove 345 | any references to the name of the license steward (except to note that 346 | such modified license differs from this License). 347 | 348 | 10.4. Distributing Source Code Form that is Incompatible With Secondary 349 | Licenses 350 | 351 | If You choose to distribute Source Code Form that is Incompatible With 352 | Secondary Licenses under the terms of this version of the License, the 353 | notice described in Exhibit B of this License must be attached. 354 | 355 | Exhibit A - Source Code Form License Notice 356 | ------------------------------------------- 357 | 358 | This Source Code Form is subject to the terms of the Mozilla Public 359 | License, v. 2.0. If a copy of the MPL was not distributed with this 360 | file, You can obtain one at http://mozilla.org/MPL/2.0/. 361 | 362 | If it is not possible or desirable to put the notice in a particular 363 | file, then You may include the notice in a location (such as a LICENSE 364 | file in a relevant directory) where a recipient would be likely to look 365 | for such a notice. 366 | 367 | You may add additional accurate notices of copyright ownership. 368 | 369 | Exhibit B - "Incompatible With Secondary Licenses" Notice 370 | --------------------------------------------------------- 371 | 372 | This Source Code Form is "Incompatible With Secondary Licenses", as 373 | defined by the Mozilla Public License, v. 2.0. 374 | -------------------------------------------------------------------------------- /NAGEKI 2.0 surface v19.dwg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nana0Nana/NAGEKI/42f0009509a7cd1791d0e71a70f73c9ecc5fad9d/NAGEKI 2.0 surface v19.dwg -------------------------------------------------------------------------------- /NAGEKI 3.0/NAGEKI 3.0 final fix.dwg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nana0Nana/NAGEKI/42f0009509a7cd1791d0e71a70f73c9ecc5fad9d/NAGEKI 3.0/NAGEKI 3.0 final fix.dwg -------------------------------------------------------------------------------- /NAGEKI 3.0/ONGEKI WAD button.stl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nana0Nana/NAGEKI/42f0009509a7cd1791d0e71a70f73c9ecc5fad9d/NAGEKI 3.0/ONGEKI WAD button.stl -------------------------------------------------------------------------------- /NAGEKI 3.0/ONGEKI WAD shield.stl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nana0Nana/NAGEKI/42f0009509a7cd1791d0e71a70f73c9ecc5fad9d/NAGEKI 3.0/ONGEKI WAD shield.stl -------------------------------------------------------------------------------- /NAGEKI 3.0/UV 20220426 .png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nana0Nana/NAGEKI/42f0009509a7cd1791d0e71a70f73c9ecc5fad9d/NAGEKI 3.0/UV 20220426 .png -------------------------------------------------------------------------------- /NAGEKI 3.0/ongeki lever v3.stl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nana0Nana/NAGEKI/42f0009509a7cd1791d0e71a70f73c9ecc5fad9d/NAGEKI 3.0/ongeki lever v3.stl -------------------------------------------------------------------------------- /NAGEKI 3.0/readme.md: -------------------------------------------------------------------------------- 1 | ![alt pic](https://github.com/Nana0Nana/NAGEKI/blob/main/pic/Denoised%20beauty.png?raw=true) 2 | 3 | # Render by OCTANE4.0 4 | 5 | # Befor you Build this controller,I recommend you have CAD Fundamentals and redraw screw holes. 6 | 7 | # New UV pattern 8 | 9 | ![alt pic](https://github.com/Nana0Nana/NAGEKI/blob/main/NAGEKI%203.0/UV%2020220426%20.png?raw=true?raw=true) 10 | 11 | 12 | # New Lever handle Design by myself 13 | 14 | ![alt pic](https://github.com/Nana0Nana/NAGEKI/blob/main/pic/lever.png?raw=true?raw=true?raw=true) 15 | 16 | 17 | # New PCB Design by myself 18 | 19 | ## For design reasons, only SVG images of schematics is posted. 20 | 21 | ![alt pic](https://github.com/Nana0Nana/NAGEKI/blob/main/pic/PCB3.png?raw=true?raw=true?raw=true?raw=true) 22 | 23 | # Lever Damping Design 24 | 25 | ## For somereason, The Design of Lever Damping Will not posted But you can Build it by your self. 26 | 27 | ### pictures: 28 | 29 | Official: 30 | ![alt pic](https://lh3.googleusercontent.com/pw/AM-JKLVhYo-QsOyu-vL1Y9sjPr-EyaKC3vLjsHrvYfkyICfCFt7lcwXTQYio1GbFHpUz2ioEy-YFpVHfmG5LU9lURMiAGyRInCe1NAaauHiBlYaPZlLhYueOChrw7YDaS3ev6DoSO-kdWvCysoPUvEmAqeuaSA=w997-h1329-no?authuser=0?raw=true?raw=true?raw=true?raw=true) 31 | 32 | Nageki: 33 | ![alt pic](https://github.com/Nana0Nana/NAGEKI/blob/main/pic/leverd.jpg?raw=true?raw=true?raw=true?raw=true?raw=true) 34 | confidential :) 35 | -------------------------------------------------------------------------------- /NAGEKI PCB V2.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nana0Nana/NAGEKI/42f0009509a7cd1791d0e71a70f73c9ecc5fad9d/NAGEKI PCB V2.zip -------------------------------------------------------------------------------- /NAGEKI WAD.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nana0Nana/NAGEKI/42f0009509a7cd1791d0e71a70f73c9ecc5fad9d/NAGEKI WAD.zip -------------------------------------------------------------------------------- /ONGEKI WAD button.stl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nana0Nana/NAGEKI/42f0009509a7cd1791d0e71a70f73c9ecc5fad9d/ONGEKI WAD button.stl -------------------------------------------------------------------------------- /ONGEKI WAD shield.stl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nana0Nana/NAGEKI/42f0009509a7cd1791d0e71a70f73c9ecc5fad9d/ONGEKI WAD shield.stl -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # N.A.G.E.K.I. 2 | # [Introduction website](https://nananana.net/nageki-en/) 3 | 4 | 5 | # IM REBUILDING THIS PROJECT,ALL THE WORKS ALREADY DONE AND WAITING FOR UPLOAD. 6 | 7 | # [NAGEKI 3.0](https://github.com/Nana0Nana/NAGEKI/tree/main/NAGEKI%203.0) 8 | 9 | ![alt pic](https://github.com/Nana0Nana/NAGEKI/blob/main/pic/NAGEKI%203.png) 10 | 11 | ## A cheap,simple,Ongeki controller Use Keyboard Simulation and Mouse Simulation to controller the ongeki game. Using Pro-micro control. 12 | ## [中文版介绍 Chinese version](https://github.com/Nana0Nana/NAGEKI/blob/main/README_CN.md) 13 | ## 中文用户可以点击最上面的Introduction,里面详细的说明了安装步骤以及注意事项 14 | # [请我喝杯奶茶](https://afdian.net/@Nana0Nana) 15 | 16 | # Befor download 17 | # Please Download the New Release at the right part,DO NOT DOWNLOAD THE SOURCE CODE! 18 | ## FOR All the blueprint,I __didnt__ do the Screw holes, so thats mean you need use drill to creat a hold for screw,I use M3x25 screw to fix all the part. 19 | 20 | # First 21 | ## you need print the PCB and you need a Promicro to control. 22 | ## Promicro mini cant be used on this project! 23 | ## I already ping the ports out so you just need connect them. 24 | ## (Now you can use this brand new PCB,thats better than after and it have 4 more pin you can use for Pot and lights.) 25 | ![alt pic](https://github.com/Nana0Nana/NAGEKI/blob/main/pic/PCB%202.0%20B.png?raw=true) 26 | ![alt pic](https://github.com/Nana0Nana/NAGEKI/blob/main/pic/PCB%202.0.png?raw=true) 27 | 28 | 29 | 30 | # For main. 31 | 32 | I recommend you use the 15 or 20mm Density wood board 33 | ### You Also can use 9mm Density wood board now,I already test for it:) 34 | 35 | ![alt pic](https://github.com/Nana0Nana/NAGEKI/blob/main/pic/main.png?raw=true) 36 | 37 | ## details 38 | 39 | For the main button,I get 67x67mm hole,thats a really big size than the button you got.But you will get the Acrylic board,that will fix the hole. 40 | you need 60x60mm button. 41 | 42 | for menu button,I get 50x50mm hole,same,that hold will a bit large than the button size,so you need the Acrylic board. 43 | you nedd 44x44mm button 44 | 45 | ## NAGEKI 2.0 NEED 33x33mm button!!! 46 | 47 | for side button,I use the 100x100mm button,thats the cheap and easy way to solve the side button problem. 48 | ![alt pic](https://github.com/Nana0Nana/N.A.G.E.K.I./blob/main/pic/IMG_8376.PNG?raw=true) 49 | ![alt pic](https://github.com/Nana0Nana/N.A.G.E.K.I./blob/main/pic/IMG_8377.PNG?raw=true) 50 | ![alt pic](https://github.com/Nana0Nana/N.A.G.E.K.I./blob/main/pic/IMG_8378.PNG?raw=true) 51 | 52 | ## Then,you need a encoder to control the lever. 53 | ### also you need a frame to fixed encoder. 54 | ## For the lever,you can buy the wood stick or the iron stick,then you can try to use some gear or something to fixed the stick and encoder,I will post here if i get the good way to fixed them. 55 | 56 | ![alt pic](https://github.com/Nana0Nana/N.A.G.E.K.I./blob/main/pic/IMG_8379.PNG?raw=true) 57 | 58 | # For surface. 59 | I recommend you use the UV print on the surface,I used 2mm thickness board. 60 | 61 | Also,you can just use the Acrylic board on surface. 62 | 63 | and you can use UV print with this pic. 64 | 65 | ![alt pic](https://github.com/Nana0Nana/NAGEKI/blob/main/pic/NAGEKI%202.1%20UV%20BRIGHT%202.png?raw=true) 66 | 67 | 68 | # Afer everything,you will get a complete NAGEKI controller. 69 | 70 | 71 | ![alt pic](https://github.com/Nana0Nana/N.A.G.E.K.I./blob/main/pic/IMG_8332.JPG?raw=true) 72 | ↑ This picture is for ver 1.0 ,ver 2.0 have a lot change here. 73 | 74 | 75 | # When you ready for the frame,just use the arudio write the code(i already post it) 76 | 77 | # ENJOY YOUR ONGEKI GAME :) 78 | 79 | # !!!attention!!! 80 | # Im not the professional person for design and codeing,all the idea or design just form my hobby,and I never learn the pcb writing or the CAD drawing.SO the project 100% will have alot of problem,So if you find some problem or you can help me build the project better,pls email me at 2391626794@qq.com or nana.nyabox@gmail.com 81 | -------------------------------------------------------------------------------- /README_CN.md: -------------------------------------------------------------------------------- 1 | 2 | # N.A.G.E.K.I. 3 | 4 | ## 一个低成本,简单制作的Ongeki控制器,使用arduino Promicro开发。 5 | ## 项目介绍页!仅中文! 6 | ## https://nananana.net/nageki/ 7 | 8 | 9 | # 某些人请先搞清楚什么是开源项目之后再来照搬我的项目! 10 | # 开源是为了方便大家且完全是慈善行为!我不会收到任何补助! 11 | # 请使用我的开源项目前先思考自己脑子是否正常! 12 | # 项目已经开展很久所以未来不会有更新! 13 | # 依据、仿造、修改本库的项目是不可接受的! 14 | # 禁止使用本项目进行任何商业目的的售卖行为! 15 | # 我有权利隐藏/删除本库全部内容 16 | ### 我为什么不写英文版,因为只有你们某些傻逼二次元团体会这么干。 17 | 18 | 19 | # 在你查看库之前 20 | ## 请务必在右侧Release下载最新发布的NAGEKI项 21 | 22 | 所有的图纸,我 __并没有__ 做螺丝孔的开孔设计,这意味着你需要一台手持钻并自行打孔,我使用了M3x25的螺丝去固定各个部位。 23 | 24 | 25 | # 首先 26 | ## 你需要打印我提供的PCB,与一块promicro开发板 27 | 28 | ## 我已经在pcb上注明了端口,你只需要用杜邦线或其他导线连接。 29 | 30 | ![alt pic](https://github.com/Nana0Nana/NAGEKI/blob/main/pic/PCB%202.0%20B.png?raw=true) 31 | ![alt pic](https://github.com/Nana0Nana/NAGEKI/blob/main/pic/PCB%202.0.png?raw=true) 32 | 33 | 34 | 35 | # 对于控制器外壳 36 | 37 | 我推荐你使用15或20mm的密度板组装 38 | 对于9mm密度板,经测试强度可靠 39 | 您可以搜索店铺 多美歌广告 采购NAGEKI需要的所有结构框架,价格为189元包邮。 40 | 41 | ![alt pic](https://github.com/Nana0Nana/NAGEKI/blob/main/pic/main.png?raw=true) 42 | 43 | ## 一些细节 44 | 45 | 关于控制器的两个侧键,我使用了100x100的按钮,这是我能找到最简单也是最便宜的方法来解决侧键问题。 46 | 47 | ![alt pic](https://github.com/Nana0Nana/N.A.G.E.K.I./blob/main/pic/IMG_8376.PNG?raw=true) 48 | ![alt pic](https://github.com/Nana0Nana/N.A.G.E.K.I./blob/main/pic/IMG_8377.PNG?raw=true) 49 | ![alt pic](https://github.com/Nana0Nana/N.A.G.E.K.I./blob/main/pic/IMG_8378.PNG?raw=true) 50 | 51 | ## 然后,你需要一个旋转编码器来控制摇杆的移动 52 | ### 当然你也需要一个编码器支架来固定编码器 53 | 54 | ## 对于摇杆,你可以找一些木棍或者空心铁棍,重量切记不要太重,然后你可以尝试将它与编码器连接,我使用胶带与束带固定他们,如果我找到了更好的方法固定他们我会及时在此更新, 55 | 56 | ![alt pic](https://github.com/Nana0Nana/N.A.G.E.K.I./blob/main/pic/IMG_8379.PNG?raw=true) 57 | 58 | # 对于台面 59 | 60 | 我推荐你使用UV打印的亚克力,这样更美观,你也可以使用透明亚克力,价格更加实惠,我使用了2mm厚度的亚克力。 61 | 62 | 你可以提供这张图片给UV打印厂家 63 | 64 | ![alt pic](https://github.com/Nana0Nana/NAGEKI/blob/main/skin/NAGEKI%202.1%20UV%20BRIGHT%202.png?raw=true) 65 | 66 | 67 | # 完成了上面的所有事项,你已经得到了一个ongeki控制器外壳。 68 | 69 | 70 | ![alt pic](https://github.com/Nana0Nana/N.A.G.E.K.I./blob/main/pic/IMG_8332.JPG?raw=true) 71 | ↑这是1.0手台的结构图片,与最新版有出入。 72 | 73 | 74 | # 在你组装好外壳后,只需要焊接好pcb与promicro然后上传我已经写好的程序。 75 | 76 | # ENJOY YOUR ONGEKI GAME :) 77 | 78 | # !!!注意事项!!! 79 | # 我不是专业建模与编程人士,我也从未接触过该领域更没有系统性的学习过这些知识,所以在我的构建中,100%会出现一些问题!! 如果你发现了问题或者你愿意帮助我更好的完善手台,可以发送Email给我。2391626794@qq.com or Nya@nananana.net. 80 | -------------------------------------------------------------------------------- /nageki2.0 code/nageki2.0.ino: -------------------------------------------------------------------------------- 1 | #include "Mouse.h" 2 | #include "./src/Encoder/Encoder.h" 3 | //thanks my hero :) 4 | //https://github.com/Reyn-Mukai/SDVX-DIY/tree/Standard 5 | //from SDVX-DIY CODE 6 | #include "Keyboard.h" 7 | #include "Mouse.h" 8 | #include 9 | 10 | 11 | 12 | /*WS2812*/ 13 | 14 | /*Pot*/ 15 | int Sensor=A0;//将A0引脚取名为Sensor/ A0 pin Named Sensor 16 | int SensorRead=0; 17 | int newdata=0; 18 | int inputValue=0; 19 | int a; 20 | 21 | /* button pin */ 22 | const int buttonPin1 = 9; // Key left 1 23 | const int buttonPin2 = 8; // Key left 2 24 | const int buttonPin3 = 7; // Key left 3 25 | 26 | const int buttonPin4 = 6; // Key Right 4 27 | const int buttonPin5 = 5; // Key Right 5 28 | const int buttonPin6 = 4; // Key Right 6 29 | 30 | 31 | const int FunctionL = 15; // FKey left 32 | const int FunctionR = 10; // FKey right 33 | 34 | const int SideL = 16; // SKey left 35 | const int SideR = 14; // SKey right 36 | 37 | /* Encoder pin */ 38 | /* 如果发现转动方向是反的就把3和2的位置调换一下*/ 39 | /*Switch "3" and "2" if the spin way was wrong*/ 40 | #define ENC_1_PIN_A 2 41 | #define ENC_1_PIN_B 3 42 | 43 | 44 | /* Encoder */ 45 | Encoder encLeft(ENC_1_PIN_A, ENC_1_PIN_B); 46 | 47 | 48 | void setup() { 49 | Serial.begin(9600); 50 | // 初始化按键引脚,如果没有上拉电阻,需要使用INPUT_PULLUP/Pin Mode. 51 | pinMode(buttonPin1, INPUT_PULLUP); 52 | pinMode(buttonPin2, INPUT_PULLUP); 53 | pinMode(buttonPin3, INPUT_PULLUP); 54 | pinMode(buttonPin4, INPUT_PULLUP); 55 | pinMode(buttonPin5, INPUT_PULLUP); 56 | pinMode(buttonPin6, INPUT_PULLUP); 57 | pinMode(FunctionL, INPUT_PULLUP); 58 | pinMode(FunctionR, INPUT_PULLUP); 59 | pinMode(SideL, INPUT_PULLUP); 60 | pinMode(SideR, INPUT_PULLUP); 61 | // 初始化模拟键盘功能/Begin keyboard 62 | Keyboard.begin(); 63 | Keyboard.releaseAll(); //所有键盘按键松开/Releasekeyboard 64 | //初始化鼠标/Begin Mousemove 65 | Mouse.begin(); 66 | //归零编码器/encoder write 0 67 | encLeft.write(0); 68 | } 69 | 70 | void Keys(){ 71 | if (digitalRead(buttonPin1) == LOW){ //按键1/Key1 72 | Keyboard.press('A'); 73 | } 74 | else { 75 | Keyboard.release('A'); 76 | } 77 | 78 | if (digitalRead(buttonPin2) == LOW){ //按键2/Key2 79 | Keyboard.press('S'); 80 | } 81 | else { 82 | Keyboard.release('S'); 83 | } 84 | 85 | if (digitalRead(buttonPin3) == LOW){ //按键3/Key3 86 | Keyboard.press('D'); 87 | } 88 | else { 89 | Keyboard.release('D'); 90 | } 91 | if (digitalRead(buttonPin4) == LOW){ //按键4/Key 4 92 | Keyboard.press('J'); 93 | } 94 | else { 95 | Keyboard.release('J'); 96 | } 97 | 98 | if (digitalRead(buttonPin5) == LOW){ //按键5/Key 5 99 | Keyboard.press('K'); 100 | } 101 | else { 102 | Keyboard.release('K'); 103 | } 104 | 105 | if (digitalRead(buttonPin6) == LOW){ //按键6/Key 6 106 | Keyboard.press('L'); 107 | } 108 | else { 109 | Keyboard.release('L'); 110 | } 111 | } 112 | void Function(){ 113 | if (digitalRead(FunctionL) == LOW){ //功能键左/Menu L 114 | Keyboard.press('R'); 115 | } 116 | else { 117 | Keyboard.release('R'); 118 | } 119 | if (digitalRead(FunctionR) == LOW){ //功能键右/Menu R 120 | Keyboard.press('U'); 121 | } 122 | else { 123 | Keyboard.release('U'); 124 | } 125 | } 126 | void Side() 127 | { 128 | if (digitalRead(SideL) == LOW){ //侧键1/Side 1 129 | Keyboard.press('P'); 130 | } 131 | else { 132 | Keyboard.release('P'); 133 | } 134 | if (digitalRead(SideR) == LOW){ //侧键2/Side 2 135 | Keyboard.press('Q'); 136 | } 137 | else { 138 | Keyboard.release('Q'); 139 | } 140 | } 141 | void Card(){ 142 | if (digitalRead(FunctionL) == LOW && digitalRead(FunctionR) == LOW){ //回车键刷卡/hold Enter to load card 143 | Keyboard.press(0xB0); 144 | } 145 | else { 146 | Keyboard.release(0xB0); 147 | } 148 | } 149 | void encFuncLeft(){ 150 | updateMousePositionLeft(); 151 | } 152 | 153 | void updateMousePositionLeft() 154 | { 155 | static int prev_value = 0; 156 | int a; 157 | a = encLeft.read(); 158 | Mouse.move((prev_value - a), 0, 0); 159 | prev_value = a; 160 | } 161 | 162 | 163 | void lever() 164 | { 165 | SensorRead=analogRead(Sensor);//读出Sensor的值并将它赋给SensorRead/Read Sensor and wirte for SensorRead 166 | newdata=map(SensorRead,0,1023,0,255); 167 | if (newdata >= 255) 168 | { 169 | newdata=(newdata - 128); 170 | Serial.println(newdata); 171 | } 172 | else if (newdata <= 255) 173 | { 174 | newdata=(newdata - 127); 175 | Serial.println(newdata); 176 | } 177 | } 178 | 179 | 180 | void move() 181 | { 182 | static int prev_value = 0; 183 | a = newdata; 184 | Mouse.move((prev_value - a), 0, 0); 185 | prev_value = a; 186 | 187 | } 188 | 189 | 190 | void loop() 191 | { 192 | Keys(); 193 | Function(); 194 | Side(); 195 | Card(); 196 | encFuncLeft(); 197 | updateMousePositionLeft(); 198 | move(); 199 | } 200 | -------------------------------------------------------------------------------- /nageki2.0 code/src/Encoder/Encoder.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "Encoder.h" 3 | 4 | // Yes, all the code is in the header file, to provide the user 5 | // configure options with #define (before they include it), and 6 | // to facilitate some crafty optimizations! 7 | 8 | Encoder_internal_state_t * Encoder::interruptArgs[]; 9 | 10 | 11 | -------------------------------------------------------------------------------- /nageki2.0 code/src/Encoder/Encoder.h: -------------------------------------------------------------------------------- 1 | /* Encoder Library, for measuring quadrature encoded signals 2 | * http://www.pjrc.com/teensy/td_libs_Encoder.html 3 | * Copyright (c) 2011,2013 PJRC.COM, LLC - Paul Stoffregen 4 | * 5 | * Version 1.2 - fix -2 bug in C-only code 6 | * Version 1.1 - expand to support boards with up to 60 interrupts 7 | * Version 1.0 - initial release 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | * THE SOFTWARE. 26 | */ 27 | 28 | 29 | #ifndef Encoder_h_ 30 | #define Encoder_h_ 31 | 32 | #if defined(ARDUINO) && ARDUINO >= 100 33 | #include "Arduino.h" 34 | #elif defined(WIRING) 35 | #include "Wiring.h" 36 | #else 37 | #include "WProgram.h" 38 | #include "pins_arduino.h" 39 | #endif 40 | 41 | #include "utility/direct_pin_read.h" 42 | 43 | #if defined(ENCODER_USE_INTERRUPTS) || !defined(ENCODER_DO_NOT_USE_INTERRUPTS) 44 | #define ENCODER_USE_INTERRUPTS 45 | #define ENCODER_ARGLIST_SIZE CORE_NUM_INTERRUPT 46 | #include "utility/interrupt_pins.h" 47 | #ifdef ENCODER_OPTIMIZE_INTERRUPTS 48 | #include "utility/interrupt_config.h" 49 | #endif 50 | #else 51 | #define ENCODER_ARGLIST_SIZE 0 52 | #endif 53 | 54 | 55 | 56 | // All the data needed by interrupts is consolidated into this ugly struct 57 | // to facilitate assembly language optimizing of the speed critical update. 58 | // The assembly code uses auto-incrementing addressing modes, so the struct 59 | // must remain in exactly this order. 60 | typedef struct { 61 | volatile IO_REG_TYPE * pin1_register; 62 | volatile IO_REG_TYPE * pin2_register; 63 | IO_REG_TYPE pin1_bitmask; 64 | IO_REG_TYPE pin2_bitmask; 65 | uint8_t state; 66 | int32_t position; 67 | } Encoder_internal_state_t; 68 | 69 | class Encoder 70 | { 71 | public: 72 | Encoder(uint8_t pin1, uint8_t pin2) { 73 | #ifdef INPUT_PULLUP 74 | pinMode(pin1, INPUT_PULLUP); 75 | pinMode(pin2, INPUT_PULLUP); 76 | #else 77 | pinMode(pin1, INPUT); 78 | digitalWrite(pin1, HIGH); 79 | pinMode(pin2, INPUT); 80 | digitalWrite(pin2, HIGH); 81 | #endif 82 | encoder.pin1_register = PIN_TO_BASEREG(pin1); 83 | encoder.pin1_bitmask = PIN_TO_BITMASK(pin1); 84 | encoder.pin2_register = PIN_TO_BASEREG(pin2); 85 | encoder.pin2_bitmask = PIN_TO_BITMASK(pin2); 86 | encoder.position = 0; 87 | // allow time for a passive R-C filter to charge 88 | // through the pullup resistors, before reading 89 | // the initial state 90 | delayMicroseconds(2000); 91 | uint8_t s = 0; 92 | if (DIRECT_PIN_READ(encoder.pin1_register, encoder.pin1_bitmask)) s |= 1; 93 | if (DIRECT_PIN_READ(encoder.pin2_register, encoder.pin2_bitmask)) s |= 2; 94 | encoder.state = s; 95 | #ifdef ENCODER_USE_INTERRUPTS 96 | interrupts_in_use = attach_interrupt(pin1, &encoder); 97 | interrupts_in_use += attach_interrupt(pin2, &encoder); 98 | #endif 99 | //update_finishup(); // to force linker to include the code (does not work) 100 | } 101 | 102 | 103 | #ifdef ENCODER_USE_INTERRUPTS 104 | inline int32_t read() { 105 | if (interrupts_in_use < 2) { 106 | noInterrupts(); 107 | update(&encoder); 108 | } else { 109 | noInterrupts(); 110 | } 111 | int32_t ret = encoder.position; 112 | interrupts(); 113 | return ret; 114 | } 115 | inline void write(int32_t p) { 116 | noInterrupts(); 117 | encoder.position = p; 118 | interrupts(); 119 | } 120 | #else 121 | inline int32_t read() { 122 | update(&encoder); 123 | return encoder.position; 124 | } 125 | inline void write(int32_t p) { 126 | encoder.position = p; 127 | } 128 | #endif 129 | private: 130 | Encoder_internal_state_t encoder; 131 | #ifdef ENCODER_USE_INTERRUPTS 132 | uint8_t interrupts_in_use; 133 | #endif 134 | public: 135 | static Encoder_internal_state_t * interruptArgs[ENCODER_ARGLIST_SIZE]; 136 | 137 | // _______ _______ 138 | // Pin1 ______| |_______| |______ Pin1 139 | // negative <--- _______ _______ __ --> positive 140 | // Pin2 __| |_______| |_______| Pin2 141 | 142 | // new new old old 143 | // pin2 pin1 pin2 pin1 Result 144 | // ---- ---- ---- ---- ------ 145 | // 0 0 0 0 no movement 146 | // 0 0 0 1 +1 147 | // 0 0 1 0 -1 148 | // 0 0 1 1 +2 (assume pin1 edges only) 149 | // 0 1 0 0 -1 150 | // 0 1 0 1 no movement 151 | // 0 1 1 0 -2 (assume pin1 edges only) 152 | // 0 1 1 1 +1 153 | // 1 0 0 0 +1 154 | // 1 0 0 1 -2 (assume pin1 edges only) 155 | // 1 0 1 0 no movement 156 | // 1 0 1 1 -1 157 | // 1 1 0 0 +2 (assume pin1 edges only) 158 | // 1 1 0 1 -1 159 | // 1 1 1 0 +1 160 | // 1 1 1 1 no movement 161 | /* 162 | // Simple, easy-to-read "documentation" version :-) 163 | // 164 | void update(void) { 165 | uint8_t s = state & 3; 166 | if (digitalRead(pin1)) s |= 4; 167 | if (digitalRead(pin2)) s |= 8; 168 | switch (s) { 169 | case 0: case 5: case 10: case 15: 170 | break; 171 | case 1: case 7: case 8: case 14: 172 | position++; break; 173 | case 2: case 4: case 11: case 13: 174 | position--; break; 175 | case 3: case 12: 176 | position += 2; break; 177 | default: 178 | position -= 2; break; 179 | } 180 | state = (s >> 2); 181 | } 182 | */ 183 | 184 | public: 185 | // update() is not meant to be called from outside Encoder, 186 | // but it is public to allow static interrupt routines. 187 | // DO NOT call update() directly from sketches. 188 | static void update(Encoder_internal_state_t *arg) { 189 | #if defined(__AVR__) 190 | // The compiler believes this is just 1 line of code, so 191 | // it will inline this function into each interrupt 192 | // handler. That's a tiny bit faster, but grows the code. 193 | // Especially when used with ENCODER_OPTIMIZE_INTERRUPTS, 194 | // the inline nature allows the ISR prologue and epilogue 195 | // to only save/restore necessary registers, for very nice 196 | // speed increase. 197 | asm volatile ( 198 | "ld r30, X+" "\n\t" 199 | "ld r31, X+" "\n\t" 200 | "ld r24, Z" "\n\t" // r24 = pin1 input 201 | "ld r30, X+" "\n\t" 202 | "ld r31, X+" "\n\t" 203 | "ld r25, Z" "\n\t" // r25 = pin2 input 204 | "ld r30, X+" "\n\t" // r30 = pin1 mask 205 | "ld r31, X+" "\n\t" // r31 = pin2 mask 206 | "ld r22, X" "\n\t" // r22 = state 207 | "andi r22, 3" "\n\t" 208 | "and r24, r30" "\n\t" 209 | "breq L%=1" "\n\t" // if (pin1) 210 | "ori r22, 4" "\n\t" // state |= 4 211 | "L%=1:" "and r25, r31" "\n\t" 212 | "breq L%=2" "\n\t" // if (pin2) 213 | "ori r22, 8" "\n\t" // state |= 8 214 | "L%=2:" "ldi r30, lo8(pm(L%=table))" "\n\t" 215 | "ldi r31, hi8(pm(L%=table))" "\n\t" 216 | "add r30, r22" "\n\t" 217 | "adc r31, __zero_reg__" "\n\t" 218 | "asr r22" "\n\t" 219 | "asr r22" "\n\t" 220 | "st X+, r22" "\n\t" // store new state 221 | "ld r22, X+" "\n\t" 222 | "ld r23, X+" "\n\t" 223 | "ld r24, X+" "\n\t" 224 | "ld r25, X+" "\n\t" 225 | "ijmp" "\n\t" // jumps to update_finishup() 226 | // TODO move this table to another static function, 227 | // so it doesn't get needlessly duplicated. Easier 228 | // said than done, due to linker issues and inlining 229 | "L%=table:" "\n\t" 230 | "rjmp L%=end" "\n\t" // 0 231 | "rjmp L%=plus1" "\n\t" // 1 232 | "rjmp L%=minus1" "\n\t" // 2 233 | "rjmp L%=plus2" "\n\t" // 3 234 | "rjmp L%=minus1" "\n\t" // 4 235 | "rjmp L%=end" "\n\t" // 5 236 | "rjmp L%=minus2" "\n\t" // 6 237 | "rjmp L%=plus1" "\n\t" // 7 238 | "rjmp L%=plus1" "\n\t" // 8 239 | "rjmp L%=minus2" "\n\t" // 9 240 | "rjmp L%=end" "\n\t" // 10 241 | "rjmp L%=minus1" "\n\t" // 11 242 | "rjmp L%=plus2" "\n\t" // 12 243 | "rjmp L%=minus1" "\n\t" // 13 244 | "rjmp L%=plus1" "\n\t" // 14 245 | "rjmp L%=end" "\n\t" // 15 246 | "L%=minus2:" "\n\t" 247 | "subi r22, 2" "\n\t" 248 | "sbci r23, 0" "\n\t" 249 | "sbci r24, 0" "\n\t" 250 | "sbci r25, 0" "\n\t" 251 | "rjmp L%=store" "\n\t" 252 | "L%=minus1:" "\n\t" 253 | "subi r22, 1" "\n\t" 254 | "sbci r23, 0" "\n\t" 255 | "sbci r24, 0" "\n\t" 256 | "sbci r25, 0" "\n\t" 257 | "rjmp L%=store" "\n\t" 258 | "L%=plus2:" "\n\t" 259 | "subi r22, 254" "\n\t" 260 | "rjmp L%=z" "\n\t" 261 | "L%=plus1:" "\n\t" 262 | "subi r22, 255" "\n\t" 263 | "L%=z:" "sbci r23, 255" "\n\t" 264 | "sbci r24, 255" "\n\t" 265 | "sbci r25, 255" "\n\t" 266 | "L%=store:" "\n\t" 267 | "st -X, r25" "\n\t" 268 | "st -X, r24" "\n\t" 269 | "st -X, r23" "\n\t" 270 | "st -X, r22" "\n\t" 271 | "L%=end:" "\n" 272 | : : "x" (arg) : "r22", "r23", "r24", "r25", "r30", "r31"); 273 | #else 274 | uint8_t p1val = DIRECT_PIN_READ(arg->pin1_register, arg->pin1_bitmask); 275 | uint8_t p2val = DIRECT_PIN_READ(arg->pin2_register, arg->pin2_bitmask); 276 | uint8_t state = arg->state & 3; 277 | if (p1val) state |= 4; 278 | if (p2val) state |= 8; 279 | arg->state = (state >> 2); 280 | switch (state) { 281 | case 1: case 7: case 8: case 14: 282 | arg->position++; 283 | return; 284 | case 2: case 4: case 11: case 13: 285 | arg->position--; 286 | return; 287 | case 3: case 12: 288 | arg->position += 2; 289 | return; 290 | case 6: case 9: 291 | arg->position -= 2; 292 | return; 293 | } 294 | #endif 295 | } 296 | private: 297 | /* 298 | #if defined(__AVR__) 299 | // TODO: this must be a no inline function 300 | // even noinline does not seem to solve difficult 301 | // problems with this. Oh well, it was only meant 302 | // to shrink code size - there's no performance 303 | // improvement in this, only code size reduction. 304 | __attribute__((noinline)) void update_finishup(void) { 305 | asm volatile ( 306 | "ldi r30, lo8(pm(Ltable))" "\n\t" 307 | "ldi r31, hi8(pm(Ltable))" "\n\t" 308 | "Ltable:" "\n\t" 309 | "rjmp L%=end" "\n\t" // 0 310 | "rjmp L%=plus1" "\n\t" // 1 311 | "rjmp L%=minus1" "\n\t" // 2 312 | "rjmp L%=plus2" "\n\t" // 3 313 | "rjmp L%=minus1" "\n\t" // 4 314 | "rjmp L%=end" "\n\t" // 5 315 | "rjmp L%=minus2" "\n\t" // 6 316 | "rjmp L%=plus1" "\n\t" // 7 317 | "rjmp L%=plus1" "\n\t" // 8 318 | "rjmp L%=minus2" "\n\t" // 9 319 | "rjmp L%=end" "\n\t" // 10 320 | "rjmp L%=minus1" "\n\t" // 11 321 | "rjmp L%=plus2" "\n\t" // 12 322 | "rjmp L%=minus1" "\n\t" // 13 323 | "rjmp L%=plus1" "\n\t" // 14 324 | "rjmp L%=end" "\n\t" // 15 325 | "L%=minus2:" "\n\t" 326 | "subi r22, 2" "\n\t" 327 | "sbci r23, 0" "\n\t" 328 | "sbci r24, 0" "\n\t" 329 | "sbci r25, 0" "\n\t" 330 | "rjmp L%=store" "\n\t" 331 | "L%=minus1:" "\n\t" 332 | "subi r22, 1" "\n\t" 333 | "sbci r23, 0" "\n\t" 334 | "sbci r24, 0" "\n\t" 335 | "sbci r25, 0" "\n\t" 336 | "rjmp L%=store" "\n\t" 337 | "L%=plus2:" "\n\t" 338 | "subi r22, 254" "\n\t" 339 | "rjmp L%=z" "\n\t" 340 | "L%=plus1:" "\n\t" 341 | "subi r22, 255" "\n\t" 342 | "L%=z:" "sbci r23, 255" "\n\t" 343 | "sbci r24, 255" "\n\t" 344 | "sbci r25, 255" "\n\t" 345 | "L%=store:" "\n\t" 346 | "st -X, r25" "\n\t" 347 | "st -X, r24" "\n\t" 348 | "st -X, r23" "\n\t" 349 | "st -X, r22" "\n\t" 350 | "L%=end:" "\n" 351 | : : : "r22", "r23", "r24", "r25", "r30", "r31"); 352 | } 353 | #endif 354 | */ 355 | 356 | 357 | #ifdef ENCODER_USE_INTERRUPTS 358 | // this giant function is an unfortunate consequence of Arduino's 359 | // attachInterrupt function not supporting any way to pass a pointer 360 | // or other context to the attached function. 361 | static uint8_t attach_interrupt(uint8_t pin, Encoder_internal_state_t *state) { 362 | switch (pin) { 363 | #ifdef CORE_INT0_PIN 364 | case CORE_INT0_PIN: 365 | interruptArgs[0] = state; 366 | attachInterrupt(0, isr0, CHANGE); 367 | break; 368 | #endif 369 | #ifdef CORE_INT1_PIN 370 | case CORE_INT1_PIN: 371 | interruptArgs[1] = state; 372 | attachInterrupt(1, isr1, CHANGE); 373 | break; 374 | #endif 375 | #ifdef CORE_INT2_PIN 376 | case CORE_INT2_PIN: 377 | interruptArgs[2] = state; 378 | attachInterrupt(2, isr2, CHANGE); 379 | break; 380 | #endif 381 | #ifdef CORE_INT3_PIN 382 | case CORE_INT3_PIN: 383 | interruptArgs[3] = state; 384 | attachInterrupt(3, isr3, CHANGE); 385 | break; 386 | #endif 387 | #ifdef CORE_INT4_PIN 388 | case CORE_INT4_PIN: 389 | interruptArgs[4] = state; 390 | attachInterrupt(4, isr4, CHANGE); 391 | break; 392 | #endif 393 | #ifdef CORE_INT5_PIN 394 | case CORE_INT5_PIN: 395 | interruptArgs[5] = state; 396 | attachInterrupt(5, isr5, CHANGE); 397 | break; 398 | #endif 399 | #ifdef CORE_INT6_PIN 400 | case CORE_INT6_PIN: 401 | interruptArgs[6] = state; 402 | attachInterrupt(6, isr6, CHANGE); 403 | break; 404 | #endif 405 | #ifdef CORE_INT7_PIN 406 | case CORE_INT7_PIN: 407 | interruptArgs[7] = state; 408 | attachInterrupt(7, isr7, CHANGE); 409 | break; 410 | #endif 411 | #ifdef CORE_INT8_PIN 412 | case CORE_INT8_PIN: 413 | interruptArgs[8] = state; 414 | attachInterrupt(8, isr8, CHANGE); 415 | break; 416 | #endif 417 | #ifdef CORE_INT9_PIN 418 | case CORE_INT9_PIN: 419 | interruptArgs[9] = state; 420 | attachInterrupt(9, isr9, CHANGE); 421 | break; 422 | #endif 423 | #ifdef CORE_INT10_PIN 424 | case CORE_INT10_PIN: 425 | interruptArgs[10] = state; 426 | attachInterrupt(10, isr10, CHANGE); 427 | break; 428 | #endif 429 | #ifdef CORE_INT11_PIN 430 | case CORE_INT11_PIN: 431 | interruptArgs[11] = state; 432 | attachInterrupt(11, isr11, CHANGE); 433 | break; 434 | #endif 435 | #ifdef CORE_INT12_PIN 436 | case CORE_INT12_PIN: 437 | interruptArgs[12] = state; 438 | attachInterrupt(12, isr12, CHANGE); 439 | break; 440 | #endif 441 | #ifdef CORE_INT13_PIN 442 | case CORE_INT13_PIN: 443 | interruptArgs[13] = state; 444 | attachInterrupt(13, isr13, CHANGE); 445 | break; 446 | #endif 447 | #ifdef CORE_INT14_PIN 448 | case CORE_INT14_PIN: 449 | interruptArgs[14] = state; 450 | attachInterrupt(14, isr14, CHANGE); 451 | break; 452 | #endif 453 | #ifdef CORE_INT15_PIN 454 | case CORE_INT15_PIN: 455 | interruptArgs[15] = state; 456 | attachInterrupt(15, isr15, CHANGE); 457 | break; 458 | #endif 459 | #ifdef CORE_INT16_PIN 460 | case CORE_INT16_PIN: 461 | interruptArgs[16] = state; 462 | attachInterrupt(16, isr16, CHANGE); 463 | break; 464 | #endif 465 | #ifdef CORE_INT17_PIN 466 | case CORE_INT17_PIN: 467 | interruptArgs[17] = state; 468 | attachInterrupt(17, isr17, CHANGE); 469 | break; 470 | #endif 471 | #ifdef CORE_INT18_PIN 472 | case CORE_INT18_PIN: 473 | interruptArgs[18] = state; 474 | attachInterrupt(18, isr18, CHANGE); 475 | break; 476 | #endif 477 | #ifdef CORE_INT19_PIN 478 | case CORE_INT19_PIN: 479 | interruptArgs[19] = state; 480 | attachInterrupt(19, isr19, CHANGE); 481 | break; 482 | #endif 483 | #ifdef CORE_INT20_PIN 484 | case CORE_INT20_PIN: 485 | interruptArgs[20] = state; 486 | attachInterrupt(20, isr20, CHANGE); 487 | break; 488 | #endif 489 | #ifdef CORE_INT21_PIN 490 | case CORE_INT21_PIN: 491 | interruptArgs[21] = state; 492 | attachInterrupt(21, isr21, CHANGE); 493 | break; 494 | #endif 495 | #ifdef CORE_INT22_PIN 496 | case CORE_INT22_PIN: 497 | interruptArgs[22] = state; 498 | attachInterrupt(22, isr22, CHANGE); 499 | break; 500 | #endif 501 | #ifdef CORE_INT23_PIN 502 | case CORE_INT23_PIN: 503 | interruptArgs[23] = state; 504 | attachInterrupt(23, isr23, CHANGE); 505 | break; 506 | #endif 507 | #ifdef CORE_INT24_PIN 508 | case CORE_INT24_PIN: 509 | interruptArgs[24] = state; 510 | attachInterrupt(24, isr24, CHANGE); 511 | break; 512 | #endif 513 | #ifdef CORE_INT25_PIN 514 | case CORE_INT25_PIN: 515 | interruptArgs[25] = state; 516 | attachInterrupt(25, isr25, CHANGE); 517 | break; 518 | #endif 519 | #ifdef CORE_INT26_PIN 520 | case CORE_INT26_PIN: 521 | interruptArgs[26] = state; 522 | attachInterrupt(26, isr26, CHANGE); 523 | break; 524 | #endif 525 | #ifdef CORE_INT27_PIN 526 | case CORE_INT27_PIN: 527 | interruptArgs[27] = state; 528 | attachInterrupt(27, isr27, CHANGE); 529 | break; 530 | #endif 531 | #ifdef CORE_INT28_PIN 532 | case CORE_INT28_PIN: 533 | interruptArgs[28] = state; 534 | attachInterrupt(28, isr28, CHANGE); 535 | break; 536 | #endif 537 | #ifdef CORE_INT29_PIN 538 | case CORE_INT29_PIN: 539 | interruptArgs[29] = state; 540 | attachInterrupt(29, isr29, CHANGE); 541 | break; 542 | #endif 543 | 544 | #ifdef CORE_INT30_PIN 545 | case CORE_INT30_PIN: 546 | interruptArgs[30] = state; 547 | attachInterrupt(30, isr30, CHANGE); 548 | break; 549 | #endif 550 | #ifdef CORE_INT31_PIN 551 | case CORE_INT31_PIN: 552 | interruptArgs[31] = state; 553 | attachInterrupt(31, isr31, CHANGE); 554 | break; 555 | #endif 556 | #ifdef CORE_INT32_PIN 557 | case CORE_INT32_PIN: 558 | interruptArgs[32] = state; 559 | attachInterrupt(32, isr32, CHANGE); 560 | break; 561 | #endif 562 | #ifdef CORE_INT33_PIN 563 | case CORE_INT33_PIN: 564 | interruptArgs[33] = state; 565 | attachInterrupt(33, isr33, CHANGE); 566 | break; 567 | #endif 568 | #ifdef CORE_INT34_PIN 569 | case CORE_INT34_PIN: 570 | interruptArgs[34] = state; 571 | attachInterrupt(34, isr34, CHANGE); 572 | break; 573 | #endif 574 | #ifdef CORE_INT35_PIN 575 | case CORE_INT35_PIN: 576 | interruptArgs[35] = state; 577 | attachInterrupt(35, isr35, CHANGE); 578 | break; 579 | #endif 580 | #ifdef CORE_INT36_PIN 581 | case CORE_INT36_PIN: 582 | interruptArgs[36] = state; 583 | attachInterrupt(36, isr36, CHANGE); 584 | break; 585 | #endif 586 | #ifdef CORE_INT37_PIN 587 | case CORE_INT37_PIN: 588 | interruptArgs[37] = state; 589 | attachInterrupt(37, isr37, CHANGE); 590 | break; 591 | #endif 592 | #ifdef CORE_INT38_PIN 593 | case CORE_INT38_PIN: 594 | interruptArgs[38] = state; 595 | attachInterrupt(38, isr38, CHANGE); 596 | break; 597 | #endif 598 | #ifdef CORE_INT39_PIN 599 | case CORE_INT39_PIN: 600 | interruptArgs[39] = state; 601 | attachInterrupt(39, isr39, CHANGE); 602 | break; 603 | #endif 604 | #ifdef CORE_INT40_PIN 605 | case CORE_INT40_PIN: 606 | interruptArgs[40] = state; 607 | attachInterrupt(40, isr40, CHANGE); 608 | break; 609 | #endif 610 | #ifdef CORE_INT41_PIN 611 | case CORE_INT41_PIN: 612 | interruptArgs[41] = state; 613 | attachInterrupt(41, isr41, CHANGE); 614 | break; 615 | #endif 616 | #ifdef CORE_INT42_PIN 617 | case CORE_INT42_PIN: 618 | interruptArgs[42] = state; 619 | attachInterrupt(42, isr42, CHANGE); 620 | break; 621 | #endif 622 | #ifdef CORE_INT43_PIN 623 | case CORE_INT43_PIN: 624 | interruptArgs[43] = state; 625 | attachInterrupt(43, isr43, CHANGE); 626 | break; 627 | #endif 628 | #ifdef CORE_INT44_PIN 629 | case CORE_INT44_PIN: 630 | interruptArgs[44] = state; 631 | attachInterrupt(44, isr44, CHANGE); 632 | break; 633 | #endif 634 | #ifdef CORE_INT45_PIN 635 | case CORE_INT45_PIN: 636 | interruptArgs[45] = state; 637 | attachInterrupt(45, isr45, CHANGE); 638 | break; 639 | #endif 640 | #ifdef CORE_INT46_PIN 641 | case CORE_INT46_PIN: 642 | interruptArgs[46] = state; 643 | attachInterrupt(46, isr46, CHANGE); 644 | break; 645 | #endif 646 | #ifdef CORE_INT47_PIN 647 | case CORE_INT47_PIN: 648 | interruptArgs[47] = state; 649 | attachInterrupt(47, isr47, CHANGE); 650 | break; 651 | #endif 652 | #ifdef CORE_INT48_PIN 653 | case CORE_INT48_PIN: 654 | interruptArgs[48] = state; 655 | attachInterrupt(48, isr48, CHANGE); 656 | break; 657 | #endif 658 | #ifdef CORE_INT49_PIN 659 | case CORE_INT49_PIN: 660 | interruptArgs[49] = state; 661 | attachInterrupt(49, isr49, CHANGE); 662 | break; 663 | #endif 664 | #ifdef CORE_INT50_PIN 665 | case CORE_INT50_PIN: 666 | interruptArgs[50] = state; 667 | attachInterrupt(50, isr50, CHANGE); 668 | break; 669 | #endif 670 | #ifdef CORE_INT51_PIN 671 | case CORE_INT51_PIN: 672 | interruptArgs[51] = state; 673 | attachInterrupt(51, isr51, CHANGE); 674 | break; 675 | #endif 676 | #ifdef CORE_INT52_PIN 677 | case CORE_INT52_PIN: 678 | interruptArgs[52] = state; 679 | attachInterrupt(52, isr52, CHANGE); 680 | break; 681 | #endif 682 | #ifdef CORE_INT53_PIN 683 | case CORE_INT53_PIN: 684 | interruptArgs[53] = state; 685 | attachInterrupt(53, isr53, CHANGE); 686 | break; 687 | #endif 688 | #ifdef CORE_INT54_PIN 689 | case CORE_INT54_PIN: 690 | interruptArgs[54] = state; 691 | attachInterrupt(54, isr54, CHANGE); 692 | break; 693 | #endif 694 | #ifdef CORE_INT55_PIN 695 | case CORE_INT55_PIN: 696 | interruptArgs[55] = state; 697 | attachInterrupt(55, isr55, CHANGE); 698 | break; 699 | #endif 700 | #ifdef CORE_INT56_PIN 701 | case CORE_INT56_PIN: 702 | interruptArgs[56] = state; 703 | attachInterrupt(56, isr56, CHANGE); 704 | break; 705 | #endif 706 | #ifdef CORE_INT57_PIN 707 | case CORE_INT57_PIN: 708 | interruptArgs[57] = state; 709 | attachInterrupt(57, isr57, CHANGE); 710 | break; 711 | #endif 712 | #ifdef CORE_INT58_PIN 713 | case CORE_INT58_PIN: 714 | interruptArgs[58] = state; 715 | attachInterrupt(58, isr58, CHANGE); 716 | break; 717 | #endif 718 | #ifdef CORE_INT59_PIN 719 | case CORE_INT59_PIN: 720 | interruptArgs[59] = state; 721 | attachInterrupt(59, isr59, CHANGE); 722 | break; 723 | #endif 724 | default: 725 | return 0; 726 | } 727 | return 1; 728 | } 729 | #endif // ENCODER_USE_INTERRUPTS 730 | 731 | 732 | #if defined(ENCODER_USE_INTERRUPTS) && !defined(ENCODER_OPTIMIZE_INTERRUPTS) 733 | #ifdef CORE_INT0_PIN 734 | static void isr0(void) { update(interruptArgs[0]); } 735 | #endif 736 | #ifdef CORE_INT1_PIN 737 | static void isr1(void) { update(interruptArgs[1]); } 738 | #endif 739 | #ifdef CORE_INT2_PIN 740 | static void isr2(void) { update(interruptArgs[2]); } 741 | #endif 742 | #ifdef CORE_INT3_PIN 743 | static void isr3(void) { update(interruptArgs[3]); } 744 | #endif 745 | #ifdef CORE_INT4_PIN 746 | static void isr4(void) { update(interruptArgs[4]); } 747 | #endif 748 | #ifdef CORE_INT5_PIN 749 | static void isr5(void) { update(interruptArgs[5]); } 750 | #endif 751 | #ifdef CORE_INT6_PIN 752 | static void isr6(void) { update(interruptArgs[6]); } 753 | #endif 754 | #ifdef CORE_INT7_PIN 755 | static void isr7(void) { update(interruptArgs[7]); } 756 | #endif 757 | #ifdef CORE_INT8_PIN 758 | static void isr8(void) { update(interruptArgs[8]); } 759 | #endif 760 | #ifdef CORE_INT9_PIN 761 | static void isr9(void) { update(interruptArgs[9]); } 762 | #endif 763 | #ifdef CORE_INT10_PIN 764 | static void isr10(void) { update(interruptArgs[10]); } 765 | #endif 766 | #ifdef CORE_INT11_PIN 767 | static void isr11(void) { update(interruptArgs[11]); } 768 | #endif 769 | #ifdef CORE_INT12_PIN 770 | static void isr12(void) { update(interruptArgs[12]); } 771 | #endif 772 | #ifdef CORE_INT13_PIN 773 | static void isr13(void) { update(interruptArgs[13]); } 774 | #endif 775 | #ifdef CORE_INT14_PIN 776 | static void isr14(void) { update(interruptArgs[14]); } 777 | #endif 778 | #ifdef CORE_INT15_PIN 779 | static void isr15(void) { update(interruptArgs[15]); } 780 | #endif 781 | #ifdef CORE_INT16_PIN 782 | static void isr16(void) { update(interruptArgs[16]); } 783 | #endif 784 | #ifdef CORE_INT17_PIN 785 | static void isr17(void) { update(interruptArgs[17]); } 786 | #endif 787 | #ifdef CORE_INT18_PIN 788 | static void isr18(void) { update(interruptArgs[18]); } 789 | #endif 790 | #ifdef CORE_INT19_PIN 791 | static void isr19(void) { update(interruptArgs[19]); } 792 | #endif 793 | #ifdef CORE_INT20_PIN 794 | static void isr20(void) { update(interruptArgs[20]); } 795 | #endif 796 | #ifdef CORE_INT21_PIN 797 | static void isr21(void) { update(interruptArgs[21]); } 798 | #endif 799 | #ifdef CORE_INT22_PIN 800 | static void isr22(void) { update(interruptArgs[22]); } 801 | #endif 802 | #ifdef CORE_INT23_PIN 803 | static void isr23(void) { update(interruptArgs[23]); } 804 | #endif 805 | #ifdef CORE_INT24_PIN 806 | static void isr24(void) { update(interruptArgs[24]); } 807 | #endif 808 | #ifdef CORE_INT25_PIN 809 | static void isr25(void) { update(interruptArgs[25]); } 810 | #endif 811 | #ifdef CORE_INT26_PIN 812 | static void isr26(void) { update(interruptArgs[26]); } 813 | #endif 814 | #ifdef CORE_INT27_PIN 815 | static void isr27(void) { update(interruptArgs[27]); } 816 | #endif 817 | #ifdef CORE_INT28_PIN 818 | static void isr28(void) { update(interruptArgs[28]); } 819 | #endif 820 | #ifdef CORE_INT29_PIN 821 | static void isr29(void) { update(interruptArgs[29]); } 822 | #endif 823 | #ifdef CORE_INT30_PIN 824 | static void isr30(void) { update(interruptArgs[30]); } 825 | #endif 826 | #ifdef CORE_INT31_PIN 827 | static void isr31(void) { update(interruptArgs[31]); } 828 | #endif 829 | #ifdef CORE_INT32_PIN 830 | static void isr32(void) { update(interruptArgs[32]); } 831 | #endif 832 | #ifdef CORE_INT33_PIN 833 | static void isr33(void) { update(interruptArgs[33]); } 834 | #endif 835 | #ifdef CORE_INT34_PIN 836 | static void isr34(void) { update(interruptArgs[34]); } 837 | #endif 838 | #ifdef CORE_INT35_PIN 839 | static void isr35(void) { update(interruptArgs[35]); } 840 | #endif 841 | #ifdef CORE_INT36_PIN 842 | static void isr36(void) { update(interruptArgs[36]); } 843 | #endif 844 | #ifdef CORE_INT37_PIN 845 | static void isr37(void) { update(interruptArgs[37]); } 846 | #endif 847 | #ifdef CORE_INT38_PIN 848 | static void isr38(void) { update(interruptArgs[38]); } 849 | #endif 850 | #ifdef CORE_INT39_PIN 851 | static void isr39(void) { update(interruptArgs[39]); } 852 | #endif 853 | #ifdef CORE_INT40_PIN 854 | static void isr40(void) { update(interruptArgs[40]); } 855 | #endif 856 | #ifdef CORE_INT41_PIN 857 | static void isr41(void) { update(interruptArgs[41]); } 858 | #endif 859 | #ifdef CORE_INT42_PIN 860 | static void isr42(void) { update(interruptArgs[42]); } 861 | #endif 862 | #ifdef CORE_INT43_PIN 863 | static void isr43(void) { update(interruptArgs[43]); } 864 | #endif 865 | #ifdef CORE_INT44_PIN 866 | static void isr44(void) { update(interruptArgs[44]); } 867 | #endif 868 | #ifdef CORE_INT45_PIN 869 | static void isr45(void) { update(interruptArgs[45]); } 870 | #endif 871 | #ifdef CORE_INT46_PIN 872 | static void isr46(void) { update(interruptArgs[46]); } 873 | #endif 874 | #ifdef CORE_INT47_PIN 875 | static void isr47(void) { update(interruptArgs[47]); } 876 | #endif 877 | #ifdef CORE_INT48_PIN 878 | static void isr48(void) { update(interruptArgs[48]); } 879 | #endif 880 | #ifdef CORE_INT49_PIN 881 | static void isr49(void) { update(interruptArgs[49]); } 882 | #endif 883 | #ifdef CORE_INT50_PIN 884 | static void isr50(void) { update(interruptArgs[50]); } 885 | #endif 886 | #ifdef CORE_INT51_PIN 887 | static void isr51(void) { update(interruptArgs[51]); } 888 | #endif 889 | #ifdef CORE_INT52_PIN 890 | static void isr52(void) { update(interruptArgs[52]); } 891 | #endif 892 | #ifdef CORE_INT53_PIN 893 | static void isr53(void) { update(interruptArgs[53]); } 894 | #endif 895 | #ifdef CORE_INT54_PIN 896 | static void isr54(void) { update(interruptArgs[54]); } 897 | #endif 898 | #ifdef CORE_INT55_PIN 899 | static void isr55(void) { update(interruptArgs[55]); } 900 | #endif 901 | #ifdef CORE_INT56_PIN 902 | static void isr56(void) { update(interruptArgs[56]); } 903 | #endif 904 | #ifdef CORE_INT57_PIN 905 | static void isr57(void) { update(interruptArgs[57]); } 906 | #endif 907 | #ifdef CORE_INT58_PIN 908 | static void isr58(void) { update(interruptArgs[58]); } 909 | #endif 910 | #ifdef CORE_INT59_PIN 911 | static void isr59(void) { update(interruptArgs[59]); } 912 | #endif 913 | #endif 914 | }; 915 | 916 | #if defined(ENCODER_USE_INTERRUPTS) && defined(ENCODER_OPTIMIZE_INTERRUPTS) 917 | #if defined(__AVR__) 918 | #if defined(INT0_vect) && CORE_NUM_INTERRUPT > 0 919 | ISR(INT0_vect) { Encoder::update(Encoder::interruptArgs[SCRAMBLE_INT_ORDER(0)]); } 920 | #endif 921 | #if defined(INT1_vect) && CORE_NUM_INTERRUPT > 1 922 | ISR(INT1_vect) { Encoder::update(Encoder::interruptArgs[SCRAMBLE_INT_ORDER(1)]); } 923 | #endif 924 | #if defined(INT2_vect) && CORE_NUM_INTERRUPT > 2 925 | ISR(INT2_vect) { Encoder::update(Encoder::interruptArgs[SCRAMBLE_INT_ORDER(2)]); } 926 | #endif 927 | #if defined(INT3_vect) && CORE_NUM_INTERRUPT > 3 928 | ISR(INT3_vect) { Encoder::update(Encoder::interruptArgs[SCRAMBLE_INT_ORDER(3)]); } 929 | #endif 930 | #if defined(INT4_vect) && CORE_NUM_INTERRUPT > 4 931 | ISR(INT4_vect) { Encoder::update(Encoder::interruptArgs[SCRAMBLE_INT_ORDER(4)]); } 932 | #endif 933 | #if defined(INT5_vect) && CORE_NUM_INTERRUPT > 5 934 | ISR(INT5_vect) { Encoder::update(Encoder::interruptArgs[SCRAMBLE_INT_ORDER(5)]); } 935 | #endif 936 | #if defined(INT6_vect) && CORE_NUM_INTERRUPT > 6 937 | ISR(INT6_vect) { Encoder::update(Encoder::interruptArgs[SCRAMBLE_INT_ORDER(6)]); } 938 | #endif 939 | #if defined(INT7_vect) && CORE_NUM_INTERRUPT > 7 940 | ISR(INT7_vect) { Encoder::update(Encoder::interruptArgs[SCRAMBLE_INT_ORDER(7)]); } 941 | #endif 942 | #endif // AVR 943 | #if defined(attachInterrupt) 944 | // Don't intefere with other libraries or sketch use of attachInterrupt() 945 | // https://github.com/PaulStoffregen/Encoder/issues/8 946 | #undef attachInterrupt 947 | #endif 948 | #endif // ENCODER_OPTIMIZE_INTERRUPTS 949 | 950 | 951 | #endif 952 | -------------------------------------------------------------------------------- /nageki2.0 code/src/Encoder/utility/direct_pin_read.h: -------------------------------------------------------------------------------- 1 | #ifndef direct_pin_read_h_ 2 | #define direct_pin_read_h_ 3 | 4 | #if defined(__AVR__) || (defined(__arm__) && defined(CORE_TEENSY)) 5 | 6 | #define IO_REG_TYPE uint8_t 7 | #define PIN_TO_BASEREG(pin) (portInputRegister(digitalPinToPort(pin))) 8 | #define PIN_TO_BITMASK(pin) (digitalPinToBitMask(pin)) 9 | #define DIRECT_PIN_READ(base, mask) (((*(base)) & (mask)) ? 1 : 0) 10 | 11 | #elif defined(__SAM3X8E__) // || defined(ESP8266) 12 | 13 | #define IO_REG_TYPE uint32_t 14 | #define PIN_TO_BASEREG(pin) (portInputRegister(digitalPinToPort(pin))) 15 | #define PIN_TO_BITMASK(pin) (digitalPinToBitMask(pin)) 16 | #define DIRECT_PIN_READ(base, mask) (((*(base)) & (mask)) ? 1 : 0) 17 | 18 | #elif defined(__PIC32MX__) 19 | 20 | #define IO_REG_TYPE uint32_t 21 | #define PIN_TO_BASEREG(pin) (portModeRegister(digitalPinToPort(pin))) 22 | #define PIN_TO_BITMASK(pin) (digitalPinToBitMask(pin)) 23 | #define DIRECT_PIN_READ(base, mask) (((*(base+4)) & (mask)) ? 1 : 0) 24 | 25 | /* ESP8266 v2.0.0 Arduino workaround for bug https://github.com/esp8266/Arduino/issues/1110 */ 26 | #elif defined(ESP8266) 27 | 28 | #define IO_REG_TYPE uint32_t 29 | #define PIN_TO_BASEREG(pin) ((volatile uint32_t *)(0x60000000+(0x318))) 30 | #define PIN_TO_BITMASK(pin) (digitalPinToBitMask(pin)) 31 | #define DIRECT_PIN_READ(base, mask) (((*(base)) & (mask)) ? 1 : 0) 32 | 33 | #elif defined(__SAMD21G18A__) 34 | 35 | #define IO_REG_TYPE uint32_t 36 | #define PIN_TO_BASEREG(pin) portModeRegister(digitalPinToPort(pin)) 37 | #define PIN_TO_BITMASK(pin) (digitalPinToBitMask(pin)) 38 | #define DIRECT_PIN_READ(base, mask) (((*((base)+8)) & (mask)) ? 1 : 0) 39 | 40 | #elif defined(RBL_NRF51822) 41 | 42 | #define IO_REG_TYPE uint32_t 43 | #define PIN_TO_BASEREG(pin) (0) 44 | #define PIN_TO_BITMASK(pin) (pin) 45 | #define DIRECT_PIN_READ(base, pin) nrf_gpio_pin_read(pin) 46 | 47 | #elif defined(__arc__) /* Arduino101/Genuino101 specifics */ 48 | 49 | #include "scss_registers.h" 50 | #include "portable.h" 51 | #include "avr/pgmspace.h" 52 | #define GPIO_ID(pin) (g_APinDescription[pin].ulGPIOId) 53 | #define GPIO_TYPE(pin) (g_APinDescription[pin].ulGPIOType) 54 | #define GPIO_BASE(pin) (g_APinDescription[pin].ulGPIOBase) 55 | #define EXT_PORT_OFFSET_SS 0x0A 56 | #define EXT_PORT_OFFSET_SOC 0x50 57 | #define PIN_TO_BASEREG(pin) ((volatile uint32_t *)g_APinDescription[pin].ulGPIOBase) 58 | #define PIN_TO_BITMASK(pin) pin 59 | #define IO_REG_TYPE uint32_t 60 | static inline __attribute__((always_inline)) 61 | IO_REG_TYPE directRead(volatile IO_REG_TYPE *base, IO_REG_TYPE pin) 62 | { 63 | IO_REG_TYPE ret; 64 | if (SS_GPIO == GPIO_TYPE(pin)) { 65 | ret = READ_ARC_REG(((IO_REG_TYPE)base + EXT_PORT_OFFSET_SS)); 66 | } else { 67 | ret = MMIO_REG_VAL_FROM_BASE((IO_REG_TYPE)base, EXT_PORT_OFFSET_SOC); 68 | } 69 | return ((ret >> GPIO_ID(pin)) & 0x01); 70 | } 71 | #define DIRECT_PIN_READ(base, pin) directRead(base, pin) 72 | 73 | #endif 74 | 75 | #endif 76 | -------------------------------------------------------------------------------- /nageki2.0 code/src/Encoder/utility/interrupt_config.h: -------------------------------------------------------------------------------- 1 | #if defined(__AVR__) 2 | 3 | #include 4 | #include 5 | 6 | #define attachInterrupt(num, func, mode) enableInterrupt(num) 7 | #if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) 8 | #define SCRAMBLE_INT_ORDER(num) ((num < 4) ? num + 2 : ((num < 6) ? num - 4 : num)) 9 | #define DESCRAMBLE_INT_ORDER(num) ((num < 2) ? num + 4 : ((num < 6) ? num - 2 : num)) 10 | #else 11 | #define SCRAMBLE_INT_ORDER(num) (num) 12 | #define DESCRAMBLE_INT_ORDER(num) (num) 13 | #endif 14 | 15 | static void enableInterrupt(uint8_t num) 16 | { 17 | switch (DESCRAMBLE_INT_ORDER(num)) { 18 | #if defined(EICRA) && defined(EIMSK) 19 | case 0: 20 | EICRA = (EICRA & 0xFC) | 0x01; 21 | EIMSK |= 0x01; 22 | return; 23 | case 1: 24 | EICRA = (EICRA & 0xF3) | 0x04; 25 | EIMSK |= 0x02; 26 | return; 27 | case 2: 28 | EICRA = (EICRA & 0xCF) | 0x10; 29 | EIMSK |= 0x04; 30 | return; 31 | case 3: 32 | EICRA = (EICRA & 0x3F) | 0x40; 33 | EIMSK |= 0x08; 34 | return; 35 | #elif defined(MCUCR) && defined(GICR) 36 | case 0: 37 | MCUCR = (MCUCR & ~((1 << ISC00) | (1 << ISC01))) | (mode << ISC00); 38 | GICR |= (1 << INT0); 39 | return; 40 | case 1: 41 | MCUCR = (MCUCR & ~((1 << ISC10) | (1 << ISC11))) | (mode << ISC10); 42 | GICR |= (1 << INT1); 43 | return; 44 | #elif defined(MCUCR) && defined(GIMSK) 45 | case 0: 46 | MCUCR = (MCUCR & ~((1 << ISC00) | (1 << ISC01))) | (mode << ISC00); 47 | GIMSK |= (1 << INT0); 48 | return; 49 | case 1: 50 | MCUCR = (MCUCR & ~((1 << ISC10) | (1 << ISC11))) | (mode << ISC10); 51 | GIMSK |= (1 << INT1); 52 | return; 53 | #endif 54 | #if defined(EICRB) && defined(EIMSK) 55 | case 4: 56 | EICRB = (EICRB & 0xFC) | 0x01; 57 | EIMSK |= 0x10; 58 | return; 59 | case 5: 60 | EICRB = (EICRB & 0xF3) | 0x04; 61 | EIMSK |= 0x20; 62 | return; 63 | case 6: 64 | EICRB = (EICRB & 0xCF) | 0x10; 65 | EIMSK |= 0x40; 66 | return; 67 | case 7: 68 | EICRB = (EICRB & 0x3F) | 0x40; 69 | EIMSK |= 0x80; 70 | return; 71 | #endif 72 | } 73 | } 74 | 75 | #elif defined(__PIC32MX__) 76 | 77 | #ifdef ENCODER_OPTIMIZE_INTERRUPTS 78 | #undef ENCODER_OPTIMIZE_INTERRUPTS 79 | #endif 80 | 81 | #else 82 | 83 | #ifdef ENCODER_OPTIMIZE_INTERRUPTS 84 | #undef ENCODER_OPTIMIZE_INTERRUPTS 85 | #endif 86 | 87 | #endif 88 | -------------------------------------------------------------------------------- /nageki2.0 code/src/Encoder/utility/interrupt_pins.h: -------------------------------------------------------------------------------- 1 | // interrupt pins for known boards 2 | 3 | // Teensy (and maybe others) define these automatically 4 | #if !defined(CORE_NUM_INTERRUPT) 5 | 6 | // Wiring boards 7 | #if defined(WIRING) 8 | #define CORE_NUM_INTERRUPT NUM_EXTERNAL_INTERRUPTS 9 | #if NUM_EXTERNAL_INTERRUPTS > 0 10 | #define CORE_INT0_PIN EI0 11 | #endif 12 | #if NUM_EXTERNAL_INTERRUPTS > 1 13 | #define CORE_INT1_PIN EI1 14 | #endif 15 | #if NUM_EXTERNAL_INTERRUPTS > 2 16 | #define CORE_INT2_PIN EI2 17 | #endif 18 | #if NUM_EXTERNAL_INTERRUPTS > 3 19 | #define CORE_INT3_PIN EI3 20 | #endif 21 | #if NUM_EXTERNAL_INTERRUPTS > 4 22 | #define CORE_INT4_PIN EI4 23 | #endif 24 | #if NUM_EXTERNAL_INTERRUPTS > 5 25 | #define CORE_INT5_PIN EI5 26 | #endif 27 | #if NUM_EXTERNAL_INTERRUPTS > 6 28 | #define CORE_INT6_PIN EI6 29 | #endif 30 | #if NUM_EXTERNAL_INTERRUPTS > 7 31 | #define CORE_INT7_PIN EI7 32 | #endif 33 | 34 | // Arduino Uno, Duemilanove, Diecimila, LilyPad, Mini, Fio, etc... 35 | #elif defined(__AVR_ATmega328P__) || defined(__AVR_ATmega168__) || defined(__AVR_ATmega8__) 36 | #define CORE_NUM_INTERRUPT 2 37 | #define CORE_INT0_PIN 2 38 | #define CORE_INT1_PIN 3 39 | 40 | // Arduino Mega 41 | #elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) 42 | #define CORE_NUM_INTERRUPT 6 43 | #define CORE_INT0_PIN 2 44 | #define CORE_INT1_PIN 3 45 | #define CORE_INT2_PIN 21 46 | #define CORE_INT3_PIN 20 47 | #define CORE_INT4_PIN 19 48 | #define CORE_INT5_PIN 18 49 | 50 | // Arduino Leonardo (untested) 51 | #elif defined(__AVR_ATmega32U4__) && !defined(CORE_TEENSY) 52 | #define CORE_NUM_INTERRUPT 4 53 | #define CORE_INT0_PIN 3 54 | #define CORE_INT1_PIN 2 55 | #define CORE_INT2_PIN 0 56 | #define CORE_INT3_PIN 1 57 | 58 | // Sanguino (untested) 59 | #elif defined(__AVR_ATmega644P__) || defined(__AVR_ATmega644__) 60 | #define CORE_NUM_INTERRUPT 3 61 | #define CORE_INT0_PIN 10 62 | #define CORE_INT1_PIN 11 63 | #define CORE_INT2_PIN 2 64 | 65 | // Chipkit Uno32 - attachInterrupt may not support CHANGE option 66 | #elif defined(__PIC32MX__) && defined(_BOARD_UNO_) 67 | #define CORE_NUM_INTERRUPT 5 68 | #define CORE_INT0_PIN 38 69 | #define CORE_INT1_PIN 2 70 | #define CORE_INT2_PIN 7 71 | #define CORE_INT3_PIN 8 72 | #define CORE_INT4_PIN 35 73 | 74 | // Chipkit Uno32 - attachInterrupt may not support CHANGE option 75 | #elif defined(__PIC32MX__) && defined(_BOARD_MEGA_) 76 | #define CORE_NUM_INTERRUPT 5 77 | #define CORE_INT0_PIN 3 78 | #define CORE_INT1_PIN 2 79 | #define CORE_INT2_PIN 7 80 | #define CORE_INT3_PIN 21 81 | #define CORE_INT4_PIN 20 82 | 83 | // http://hlt.media.mit.edu/?p=1229 84 | #elif defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__) 85 | #define CORE_NUM_INTERRUPT 1 86 | #define CORE_INT0_PIN 2 87 | 88 | // Arduino Due 89 | #elif defined(__SAM3X8E__) 90 | #define CORE_NUM_INTERRUPT 54 91 | #define CORE_INT0_PIN 0 92 | #define CORE_INT1_PIN 1 93 | #define CORE_INT2_PIN 2 94 | #define CORE_INT3_PIN 3 95 | #define CORE_INT4_PIN 4 96 | #define CORE_INT5_PIN 5 97 | #define CORE_INT6_PIN 6 98 | #define CORE_INT7_PIN 7 99 | #define CORE_INT8_PIN 8 100 | #define CORE_INT9_PIN 9 101 | #define CORE_INT10_PIN 10 102 | #define CORE_INT11_PIN 11 103 | #define CORE_INT12_PIN 12 104 | #define CORE_INT13_PIN 13 105 | #define CORE_INT14_PIN 14 106 | #define CORE_INT15_PIN 15 107 | #define CORE_INT16_PIN 16 108 | #define CORE_INT17_PIN 17 109 | #define CORE_INT18_PIN 18 110 | #define CORE_INT19_PIN 19 111 | #define CORE_INT20_PIN 20 112 | #define CORE_INT21_PIN 21 113 | #define CORE_INT22_PIN 22 114 | #define CORE_INT23_PIN 23 115 | #define CORE_INT24_PIN 24 116 | #define CORE_INT25_PIN 25 117 | #define CORE_INT26_PIN 26 118 | #define CORE_INT27_PIN 27 119 | #define CORE_INT28_PIN 28 120 | #define CORE_INT29_PIN 29 121 | #define CORE_INT30_PIN 30 122 | #define CORE_INT31_PIN 31 123 | #define CORE_INT32_PIN 32 124 | #define CORE_INT33_PIN 33 125 | #define CORE_INT34_PIN 34 126 | #define CORE_INT35_PIN 35 127 | #define CORE_INT36_PIN 36 128 | #define CORE_INT37_PIN 37 129 | #define CORE_INT38_PIN 38 130 | #define CORE_INT39_PIN 39 131 | #define CORE_INT40_PIN 40 132 | #define CORE_INT41_PIN 41 133 | #define CORE_INT42_PIN 42 134 | #define CORE_INT43_PIN 43 135 | #define CORE_INT44_PIN 44 136 | #define CORE_INT45_PIN 45 137 | #define CORE_INT46_PIN 46 138 | #define CORE_INT47_PIN 47 139 | #define CORE_INT48_PIN 48 140 | #define CORE_INT49_PIN 49 141 | #define CORE_INT50_PIN 50 142 | #define CORE_INT51_PIN 51 143 | #define CORE_INT52_PIN 52 144 | #define CORE_INT53_PIN 53 145 | 146 | // ESP8266 (https://github.com/esp8266/Arduino/) 147 | #elif defined(ESP8266) 148 | #define CORE_NUM_INTERRUPT EXTERNAL_NUM_INTERRUPTS 149 | #define CORE_INT0_PIN 0 150 | #define CORE_INT1_PIN 1 151 | #define CORE_INT2_PIN 2 152 | #define CORE_INT3_PIN 3 153 | #define CORE_INT4_PIN 4 154 | #define CORE_INT5_PIN 5 155 | // GPIO6-GPIO11 are typically used to interface with the flash memory IC on 156 | // most esp8266 modules, so we should avoid adding interrupts to these pins. 157 | #define CORE_INT12_PIN 12 158 | #define CORE_INT13_PIN 13 159 | #define CORE_INT14_PIN 14 160 | #define CORE_INT15_PIN 15 161 | 162 | // Arduino Zero - TODO: interrupts do not seem to work 163 | // please help, contribute a fix! 164 | #elif defined(__SAMD21G18A__) 165 | #define CORE_NUM_INTERRUPT 20 166 | #define CORE_INT0_PIN 0 167 | #define CORE_INT1_PIN 1 168 | #define CORE_INT2_PIN 2 169 | #define CORE_INT3_PIN 3 170 | #define CORE_INT5_PIN 5 171 | #define CORE_INT6_PIN 6 172 | #define CORE_INT7_PIN 7 173 | #define CORE_INT8_PIN 8 174 | #define CORE_INT9_PIN 9 175 | #define CORE_INT10_PIN 10 176 | #define CORE_INT11_PIN 11 177 | #define CORE_INT12_PIN 12 178 | #define CORE_INT13_PIN 13 179 | #define CORE_INT14_PIN 14 180 | #define CORE_INT15_PIN 15 181 | #define CORE_INT16_PIN 16 182 | #define CORE_INT17_PIN 17 183 | #define CORE_INT18_PIN 18 184 | #define CORE_INT19_PIN 19 185 | 186 | // Arduino 101 187 | #elif defined(__arc__) 188 | #define CORE_NUM_INTERRUPT 14 189 | #define CORE_INT2_PIN 2 190 | #define CORE_INT5_PIN 5 191 | #define CORE_INT7_PIN 7 192 | #define CORE_INT8_PIN 8 193 | #define CORE_INT10_PIN 10 194 | #define CORE_INT11_PIN 11 195 | #define CORE_INT12_PIN 12 196 | #define CORE_INT13_PIN 13 197 | 198 | #endif 199 | #endif 200 | 201 | #if !defined(CORE_NUM_INTERRUPT) 202 | #error "Interrupts are unknown for this board, please add to this code" 203 | #endif 204 | #if CORE_NUM_INTERRUPT <= 0 205 | #error "Encoder requires interrupt pins, but this board does not have any :(" 206 | #error "You could try defining ENCODER_DO_NOT_USE_INTERRUPTS as a kludge." 207 | #endif 208 | 209 | -------------------------------------------------------------------------------- /nageki2.0 code/src/NeoPixel/light.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | class Strip 4 | { 5 | public: 6 | uint8_t effect; 7 | uint8_t effects; 8 | uint16_t effStep; 9 | unsigned long effStart; 10 | Adafruit_NeoPixel strip; 11 | Strip(uint16_t leds, uint8_t pin, uint8_t toteffects, uint16_t striptype) : strip(leds, pin, striptype) { 12 | effect = -1; 13 | effects = toteffects; 14 | Reset(); 15 | } 16 | void Reset(){ 17 | effStep = 0; 18 | effect = (effect + 1) % effects; 19 | effStart = millis(); 20 | } 21 | }; 22 | 23 | struct Loop 24 | { 25 | uint8_t currentChild; 26 | uint8_t childs; 27 | bool timeBased; 28 | uint16_t cycles; 29 | uint16_t currentTime; 30 | Loop(uint8_t totchilds, bool timebased, uint16_t tottime) {currentTime=0;currentChild=0;childs=totchilds;timeBased=timebased;cycles=tottime;} 31 | }; 32 | 33 | Strip strip_0(12, 21, 12, NEO_GRB + NEO_KHZ800); 34 | struct Loop strip0loop0(1, false, 1); 35 | 36 | //[GLOBAL_VARIABLES] 37 | 38 | 39 | void loop() { 40 | 41 | //Your code here: 42 | 43 | strips_loop(); 44 | } 45 | 46 | void strips_loop() { 47 | if(strip0_loop0() & 0x01) 48 | strip_0.strip.show(); 49 | } 50 | 51 | uint8_t strip0_loop0() { 52 | uint8_t ret = 0x00; 53 | switch(strip0loop0.currentChild) { 54 | case 0: 55 | ret = strip0_loop0_eff0();break; 56 | } 57 | if(ret & 0x02) { 58 | ret &= 0xfd; 59 | if(strip0loop0.currentChild + 1 >= strip0loop0.childs) { 60 | strip0loop0.currentChild = 0; 61 | if(++strip0loop0.currentTime >= strip0loop0.cycles) {strip0loop0.currentTime = 0; ret |= 0x02;} 62 | } 63 | else { 64 | strip0loop0.currentChild++; 65 | } 66 | }; 67 | return ret; 68 | } 69 | 70 | uint8_t strip0_loop0_eff0() { 71 | // Strip ID: 0 - Effect: Fade - LEDS: 12 72 | // Steps: 970 - Delay: 1 73 | // Colors: 2 (255.0.123, 196.0.0) 74 | // Options: duration=970, every=1, 75 | if(millis() - strip_0.effStart < 1 * (strip_0.effStep)) return 0x00; 76 | uint8_t r,g,b; 77 | double e; 78 | e = (strip_0.effStep * 1) / (double)970; 79 | r = ( e ) * 196 + 255 * ( 1.0 - e ); 80 | g = ( e ) * 0 + 0 * ( 1.0 - e ); 81 | b = ( e ) * 0 + 123 * ( 1.0 - e ); 82 | for(uint16_t j=0;j<12;j++) { 83 | if((j % 1) == 0) 84 | strip_0.strip.setPixelColor(j, r, g, b); 85 | else 86 | strip_0.strip.setPixelColor(j, 0, 0, 0); 87 | } 88 | if(strip_0.effStep >= 970) {strip_0.Reset(); return 0x03; } 89 | else strip_0.effStep++; 90 | return 0x01; 91 | } 92 | 93 | -------------------------------------------------------------------------------- /pic/Denoised beauty.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nana0Nana/NAGEKI/42f0009509a7cd1791d0e71a70f73c9ecc5fad9d/pic/Denoised beauty.png -------------------------------------------------------------------------------- /pic/IMG_8305.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nana0Nana/NAGEKI/42f0009509a7cd1791d0e71a70f73c9ecc5fad9d/pic/IMG_8305.JPG -------------------------------------------------------------------------------- /pic/IMG_8331.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nana0Nana/NAGEKI/42f0009509a7cd1791d0e71a70f73c9ecc5fad9d/pic/IMG_8331.JPG -------------------------------------------------------------------------------- /pic/IMG_8332.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nana0Nana/NAGEKI/42f0009509a7cd1791d0e71a70f73c9ecc5fad9d/pic/IMG_8332.JPG -------------------------------------------------------------------------------- /pic/IMG_8376.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nana0Nana/NAGEKI/42f0009509a7cd1791d0e71a70f73c9ecc5fad9d/pic/IMG_8376.PNG -------------------------------------------------------------------------------- /pic/IMG_8377.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nana0Nana/NAGEKI/42f0009509a7cd1791d0e71a70f73c9ecc5fad9d/pic/IMG_8377.PNG -------------------------------------------------------------------------------- /pic/IMG_8378.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nana0Nana/NAGEKI/42f0009509a7cd1791d0e71a70f73c9ecc5fad9d/pic/IMG_8378.PNG -------------------------------------------------------------------------------- /pic/IMG_8379.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nana0Nana/NAGEKI/42f0009509a7cd1791d0e71a70f73c9ecc5fad9d/pic/IMG_8379.PNG -------------------------------------------------------------------------------- /pic/NAGEKI 2.1 UV BRIGHT 2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nana0Nana/NAGEKI/42f0009509a7cd1791d0e71a70f73c9ecc5fad9d/pic/NAGEKI 2.1 UV BRIGHT 2.png -------------------------------------------------------------------------------- /pic/NAGEKI 3 side.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nana0Nana/NAGEKI/42f0009509a7cd1791d0e71a70f73c9ecc5fad9d/pic/NAGEKI 3 side.png -------------------------------------------------------------------------------- /pic/NAGEKI 3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nana0Nana/NAGEKI/42f0009509a7cd1791d0e71a70f73c9ecc5fad9d/pic/NAGEKI 3.png -------------------------------------------------------------------------------- /pic/PCB 2.0 B.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nana0Nana/NAGEKI/42f0009509a7cd1791d0e71a70f73c9ecc5fad9d/pic/PCB 2.0 B.png -------------------------------------------------------------------------------- /pic/PCB 2.0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nana0Nana/NAGEKI/42f0009509a7cd1791d0e71a70f73c9ecc5fad9d/pic/PCB 2.0.png -------------------------------------------------------------------------------- /pic/PCB3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nana0Nana/NAGEKI/42f0009509a7cd1791d0e71a70f73c9ecc5fad9d/pic/PCB3.png -------------------------------------------------------------------------------- /pic/QQ截图20211012202125.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nana0Nana/NAGEKI/42f0009509a7cd1791d0e71a70f73c9ecc5fad9d/pic/QQ截图20211012202125.png -------------------------------------------------------------------------------- /pic/lever.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nana0Nana/NAGEKI/42f0009509a7cd1791d0e71a70f73c9ecc5fad9d/pic/lever.png -------------------------------------------------------------------------------- /pic/leverd.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nana0Nana/NAGEKI/42f0009509a7cd1791d0e71a70f73c9ecc5fad9d/pic/leverd.jpg -------------------------------------------------------------------------------- /pic/main.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nana0Nana/NAGEKI/42f0009509a7cd1791d0e71a70f73c9ecc5fad9d/pic/main.png -------------------------------------------------------------------------------- /pic/pcb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nana0Nana/NAGEKI/42f0009509a7cd1791d0e71a70f73c9ecc5fad9d/pic/pcb.png -------------------------------------------------------------------------------- /skin/NAGEKI 2.1 UV BRIGHT 2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nana0Nana/NAGEKI/42f0009509a7cd1791d0e71a70f73c9ecc5fad9d/skin/NAGEKI 2.1 UV BRIGHT 2.png -------------------------------------------------------------------------------- /skin/NAGEKI 2.1 UV BRIGHT.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nana0Nana/NAGEKI/42f0009509a7cd1791d0e71a70f73c9ecc5fad9d/skin/NAGEKI 2.1 UV BRIGHT.png -------------------------------------------------------------------------------- /skin/NAGEKI 2.1 UV.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nana0Nana/NAGEKI/42f0009509a7cd1791d0e71a70f73c9ecc5fad9d/skin/NAGEKI 2.1 UV.png --------------------------------------------------------------------------------