├── .gitattributes ├── .gitignore ├── Arduino_Sketches ├── LE_AVR_slim │ └── LE_AVR_slim.ino ├── LE_Reactor_Zero_0.5 │ └── LE_Reactor_Zero_0.5.ino ├── LE_Reactor_Zero_V6_basic │ ├── LE_Reactor_Zero_V6_basic.ino │ ├── font_fld_5px.h │ ├── font_rld_staggered_left.h │ ├── functions.h │ └── settings.h ├── LE_Teensy_Reactor_Jawalite_0.5 │ └── LE_Teensy_Reactor_Jawalite_0.5.ino ├── LE_Teensy_Reactor_Jawalite_0.6 │ └── LE_Teensy_Reactor_Jawalite_0.6.ino ├── LE_Teensy_Reactor_Jawalite_0.7 │ └── LE_Teensy_Reactor_Jawalite_0.7.ino ├── LE_bare_bones │ └── LE_bare_bones.ino └── README.md ├── Hardware Designs ├── Logic Engine - AVR.brd ├── Logic Engine - AVR.sch ├── Logic Engine - Front LED.brd ├── Logic Engine - Front LED.sch ├── Logic Engine - Front SK6812.brd ├── Logic Engine - Front SK6812.sch ├── Logic Engine - Rear LED.brd ├── Logic Engine - Rear LED.sch ├── Logic Engine - Rear SK6812.brd ├── Logic Engine - Rear SK6812.sch ├── Reactor to RLD mounty thing.stl ├── Reactor_Mount.pdf ├── Reactor_Zero.brd ├── Reactor_Zero.sch ├── Teeces PSI.brd ├── Teeces PSI.sch ├── Teensy Reactor.brd └── Teensy Reactor.sch ├── README.md ├── docs ├── Logic Engine V7 cheat sheet.pdf ├── Logic Engine V8 cheat sheet.pdf ├── Logic_Engine_2_cheat_sheet.pdf ├── Logic_Engine_3_cheat_sheet.pdf ├── Logic_Engine_V6_cheat_sheet.pdf └── img │ ├── 2016front1.jpg │ ├── 2016front2.jpg │ ├── Deathstar1.jpg │ ├── Deathstar2.jpg │ ├── Deathstar3.jpg │ ├── ImaharaRLD1.jpg │ ├── ImaharaRLD2.jpg │ ├── ImaharaRLD3.jpg │ ├── Logic-Engine-LED-board-front.png │ ├── Logic-Engine-LED-board-rear.png │ ├── LogicEngineAVRBoard.png │ ├── LogicEngineDMX.jpg │ ├── LogicEngineDMX_2.jpg │ ├── LogicEngineDMX_3.jpg │ ├── LogicEngineDMX_4.jpg │ ├── Logic_Engine_Parts.png │ ├── Logic_Engine_V6_cheat_sheet.png │ ├── Logic_Engine_V6_cheat_sheet_th.png │ ├── Reactor Zero to Teeces PSI Hookup.s.png │ ├── Reactor-Zero-20181125.jpg │ ├── Reactor-Zero-20190915.jpg │ ├── Reactor-Zero-20200830.jpg │ ├── Reactor-Zero-New-Pins.jpg │ ├── Reactor-Zero-SerialAdapter.jpg │ ├── Reactor-Zero-V6-overview.jpg │ ├── ReactorZero-board-only.png │ ├── TeensyReactorPrototype.jpg │ ├── TeensyReactor_full.jpg │ ├── TeensyReactor_th.jpg │ ├── WREACTOR32-PCB.png │ ├── WReactor32_2024.jpg │ ├── avr_ftdi.png │ ├── avr_microsd.png │ ├── avr_mode.png │ ├── avr_powering.png │ ├── avr_speed.png │ ├── avr_to_teeces_psi.png │ ├── front_bez_orientation1.jpg │ ├── front_bez_orientation2.jpg │ ├── rld-pattern-numbered.png │ ├── uploadZeroFW │ ├── 1-install_Boards.png │ ├── 2-install_Libraries.png │ ├── 3-select_Board.png │ ├── 4-select_Port.png │ ├── 5-upload_Success.png │ └── flashStorage.png │ └── wreactor32 │ ├── 1-home.png │ ├── 1-home_th.png │ ├── 2-logics.png │ ├── 2-logics_th.png │ ├── 3-setup.png │ ├── 3-setup_th.png │ ├── 4-firmware.png │ ├── 4-firmware_th.png │ ├── 5-marcduino.png │ ├── 5-marcduino_th.png │ ├── 6-wifi.png │ ├── 6-wifi_th.png │ ├── 7-setuplogics.png │ └── 7-setuplogics_th.png ├── libraries ├── FastLED │ ├── FastLED.cpp │ ├── FastLED.h │ ├── FastSPI_LED2.h │ ├── LICENSE │ ├── PORTING.md │ ├── README.md │ ├── bitswap.cpp │ ├── bitswap.h │ ├── block_clockless.h │ ├── chipsets.h │ ├── clockless.h │ ├── clockless2.h │ ├── clockless_arm_k20.h │ ├── clockless_arm_sam.h │ ├── clockless_trinket.h │ ├── color.h │ ├── colorpalettes.cpp │ ├── colorpalettes.h │ ├── colorutils.cpp │ ├── colorutils.h │ ├── controller.h │ ├── cpp_compat.h │ ├── delay.h │ ├── dmx.h │ ├── docs │ │ ├── Doxyfile │ │ └── mainpage.dox │ ├── examples │ │ ├── AnalogOutput │ │ │ └── AnalogOutput.ino │ │ ├── Blink │ │ │ └── Blink.ino │ │ ├── ColorPalette │ │ │ └── ColorPalette.ino │ │ ├── ColorTemperature │ │ │ └── ColorTemperature.ino │ │ ├── Cylon │ │ │ └── Cylon.ino │ │ ├── DemoReel100 │ │ │ └── DemoReel100.ino │ │ ├── Fire2012 │ │ │ └── Fire2012.ino │ │ ├── Fire2012WithPalette │ │ │ └── Fire2012WithPalette.ino │ │ ├── FirstLight │ │ │ └── FirstLight.ino │ │ ├── Multiple │ │ │ ├── ArrayOfLedArrays │ │ │ │ └── ArrayOfLedArrays.ino │ │ │ ├── MirroringSample │ │ │ │ └── MirroringSample.ino │ │ │ ├── MultiArrays │ │ │ │ └── MultiArrays.ino │ │ │ ├── MultipleStripsInOneArray │ │ │ │ └── MultipleStripsInOneArray.ino │ │ │ ├── OctoWS2811Demo │ │ │ │ └── OctoWS2811Demo.ino │ │ │ └── ParallelOutputDemo │ │ │ │ └── ParallelOutputDemo.ino │ │ ├── Noise │ │ │ └── Noise.ino │ │ ├── NoisePlayground │ │ │ └── NoisePlayground.ino │ │ ├── NoisePlusPalette │ │ │ └── NoisePlusPalette.ino │ │ ├── Pintest │ │ │ └── Pintest.ino │ │ ├── Ports │ │ │ └── PJRCSpectrumAnalyzer │ │ │ │ └── PJRCSpectrumAnalyzer.ino │ │ ├── RGBCalibrate │ │ │ └── RGBCalibrate.ino │ │ ├── RGBSetDemo │ │ │ └── RGBSetDemo.ino │ │ ├── SmartMatrix │ │ │ └── SmartMatrix.ino │ │ └── XYMatrix │ │ │ └── XYMatrix.ino │ ├── extras │ │ ├── AppleII.s65 │ │ ├── FastLED6502.s65 │ │ ├── RainbowDemo.bin.zip │ │ └── RainbowDemo.s65 │ ├── fastled_config.h │ ├── fastled_delay.h │ ├── fastled_progmem.h │ ├── fastpin.h │ ├── fastpin_arm_k20.h │ ├── fastpin_arm_sam.h │ ├── fastpin_avr.h │ ├── fastspi.h │ ├── fastspi_arm_k20.h │ ├── fastspi_arm_sam.h │ ├── fastspi_avr.h │ ├── fastspi_bitbang.h │ ├── fastspi_dma.h │ ├── fastspi_nop.h │ ├── fastspi_ref.h │ ├── fastspi_types.h │ ├── hsv2rgb.cpp │ ├── hsv2rgb.h │ ├── keywords.txt │ ├── led_sysdefs.h │ ├── lib8tion.cpp │ ├── lib8tion.h │ ├── lib8tion │ │ ├── math8.h │ │ ├── random8.h │ │ ├── scale8.h │ │ └── trig8.h │ ├── library.json │ ├── library.properties │ ├── noise.cpp │ ├── noise.h │ ├── pixelset.h │ ├── pixeltypes.h │ ├── platforms.h │ ├── platforms │ │ ├── arm │ │ │ ├── common │ │ │ │ └── m0clockless.h │ │ │ ├── d21 │ │ │ │ ├── clockless_arm_d21.h │ │ │ │ ├── fastled_arm_d21.h │ │ │ │ ├── fastpin_arm_d21.h │ │ │ │ └── led_sysdefs_arm_d21.h │ │ │ ├── k20 │ │ │ │ ├── clockless_arm_k20.h │ │ │ │ ├── clockless_block_arm_k20.h │ │ │ │ ├── fastled_arm_k20.h │ │ │ │ ├── fastpin_arm_k20.h │ │ │ │ ├── fastspi_arm_k20.h │ │ │ │ ├── led_sysdefs_arm_k20.h │ │ │ │ ├── octows2811_controller.h │ │ │ │ └── smartmatrix_t3.h │ │ │ ├── kl26 │ │ │ │ ├── clockless_arm_kl26.h │ │ │ │ ├── fastled_arm_kl26.h │ │ │ │ ├── fastpin_arm_kl26.h │ │ │ │ ├── fastspi_arm_kl26.h │ │ │ │ └── led_sysdefs_arm_kl26.h │ │ │ ├── nrf51 │ │ │ │ ├── clockless_arm_nrf51.h │ │ │ │ ├── fastled_arm_nrf51.h │ │ │ │ ├── fastpin_arm_nrf51.h │ │ │ │ ├── fastspi_arm_nrf51.h │ │ │ │ └── led_sysdefs_arm_nrf51.h │ │ │ ├── sam │ │ │ │ ├── clockless_arm_sam.h │ │ │ │ ├── clockless_block_arm_sam.h │ │ │ │ ├── fastled_arm_sam.h │ │ │ │ ├── fastpin_arm_sam.h │ │ │ │ ├── fastspi_arm_sam.h │ │ │ │ └── led_sysdefs_arm_sam.h │ │ │ └── stm32 │ │ │ │ ├── clockless_arm_stm32.h │ │ │ │ ├── fastled_arm_stm32.h │ │ │ │ ├── fastpin_arm_stm32.h │ │ │ │ └── led_sysdefs_arm_stm32.h │ │ ├── avr │ │ │ ├── clockless_trinket.h │ │ │ ├── fastled_avr.h │ │ │ ├── fastpin_avr.h │ │ │ ├── fastspi_avr.h │ │ │ └── led_sysdefs_avr.h │ │ └── esp │ │ │ └── 8266 │ │ │ ├── clockless_block_esp8266.h │ │ │ ├── clockless_esp8266.h │ │ │ ├── fastled_esp8266.h │ │ │ ├── fastpin_esp8266.h │ │ │ └── led_sysdefs_esp8266.h │ ├── power_mgt.cpp │ ├── power_mgt.h │ ├── preview_changes.txt │ ├── release_notes.md │ ├── smartmatrix_t3.h │ └── wiring.cpp └── TeecesControl │ ├── TeecesControl.cpp │ ├── TeecesControl.h │ └── keywords.txt ├── old_sketches ├── LogicEngineBasic7c │ └── LogicEngineBasic7c.ino └── LogicEngineBasic9 │ └── LogicEngineBasic9.ino ├── wreactor32_firmware ├── LEngine_20211009.bin ├── LEngine_20211013.bin ├── LEngine_20211016.bin ├── LEngine_20220410.bin ├── LEngine_20220426.bin └── LEngine_250302.bin └── wreactor32_rework ├── rework1.jpg ├── rework2.jpg ├── rework3.jpg ├── rework4.jpg └── rework5.jpg /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | 7 | # Standard to msysgit 8 | *.doc diff=astextplain 9 | *.DOC diff=astextplain 10 | *.docx diff=astextplain 11 | *.DOCX diff=astextplain 12 | *.dot diff=astextplain 13 | *.DOT diff=astextplain 14 | *.pdf diff=astextplain 15 | *.PDF diff=astextplain 16 | *.rtf diff=astextplain 17 | *.RTF diff=astextplain 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Eagle Backup files 2 | *.s#? 3 | *.b#? 4 | *.l#? 5 | 6 | # Windows image file caches 7 | Thumbs.db 8 | ehthumbs.db 9 | 10 | # Folder config file 11 | Desktop.ini 12 | 13 | # Recycle Bin used on file shares 14 | $RECYCLE.BIN/ 15 | 16 | # Windows Installer files 17 | *.cab 18 | *.msi 19 | *.msm 20 | *.msp 21 | 22 | # Windows shortcuts 23 | *.lnk 24 | 25 | # ========================= 26 | # Operating System Files 27 | # ========================= 28 | 29 | # OSX 30 | # ========================= 31 | 32 | .DS_Store 33 | .AppleDouble 34 | .LSOverride 35 | 36 | # Thumbnails 37 | ._* 38 | 39 | # Files that might appear on external disk 40 | .Spotlight-V100 41 | .Trashes 42 | 43 | # Directories potentially created on remote AFP share 44 | .AppleDB 45 | .AppleDesktop 46 | Network Trash Folder 47 | Temporary Items 48 | .apdisk 49 | -------------------------------------------------------------------------------- /Arduino_Sketches/LE_Reactor_Zero_V6_basic/font_fld_5px.h: -------------------------------------------------------------------------------- 1 | const uint8_t fld_5pxBitmaps[] PROGMEM = { 2 | 0xC8, 0xB4, 0x5F, 0x5F, 0x50, 0x58, 0x71, 0xD5, 0x92, 0x49, 0x4A, 0x49, 3 | 0x60, 0xC0, 0x6A, 0x40, 0x95, 0x80, 0xAA, 0x80, 0x5D, 0x00, 0xC0, 0x80, 4 | 0x80, 0x11, 0x24, 0x80, 0x69, 0x99, 0x60, 0xC9, 0x2E, 0xF1, 0x78, 0xF0, 5 | 0xF1, 0x61, 0xF0, 0x99, 0x9F, 0x10, 0xF8, 0x71, 0xF0, 0x78, 0xF9, 0x70, 6 | 0xF1, 0x31, 0x10, 0x79, 0x69, 0x70, 0x69, 0xF1, 0x60, 0xA0, 0xB0, 0x64, 7 | 0xF0, 0xF0, 0x98, 0xF1, 0x70, 0x40, 0x79, 0xBB, 0x79, 0xF9, 0x90, 0xF9, 8 | 0xE9, 0xF0, 0x79, 0x89, 0x70, 0xF9, 0x99, 0xF0, 0xF8, 0xE8, 0xF0, 0xF8, 9 | 0xE8, 0x80, 0x78, 0xB9, 0x70, 0x99, 0xF9, 0x90, 0xE9, 0x2E, 0xF1, 0x19, 10 | 0x60, 0x99, 0xE9, 0x90, 0x88, 0x88, 0xF0, 0xCE, 0xD9, 0x65, 0x94, 0x9D, 11 | 0xB9, 0x90, 0x79, 0x99, 0x70, 0xF9, 0xE8, 0x80, 0x69, 0x9B, 0x70, 0xF9, 12 | 0xE9, 0x90, 0x78, 0x71, 0xE0, 0xF2, 0x22, 0x20, 0x99, 0x99, 0x70, 0x99, 13 | 0x95, 0x20, 0x96, 0x59, 0x6D, 0x48, 0x95, 0x25, 0x90, 0x95, 0x22, 0x20, 14 | 0xF3, 0x48, 0xF0 15 | }; 16 | 17 | const GFXglyph fld_5pxGlyphs[] PROGMEM = { 18 | { 0, 0, 0, 5, 0, 1 } // ' ' 19 | ,{ 0, 1, 5, 2, 1, -4 } // '!' 20 | ,{ 1, 3, 2, 4, 1, -4 } // '"' 21 | ,{ 2, 4, 5, 5, 1, -4 } // '#' 22 | ,{ 5, 4, 6, 5, 1, -4 } // '$' 23 | ,{ 8, 4, 4, 5, 1, -3 } // '%' 24 | ,{ 10, 4, 5, 5, 1, -4 } // '&' 25 | ,{ 13, 1, 2, 2, 1, -4 } // ''' 26 | ,{ 14, 2, 5, 3, 1, -4 } // '(' 27 | ,{ 16, 2, 5, 3, 1, -4 } // ')' 28 | ,{ 18, 3, 3, 4, 1, -4 } // '*' 29 | ,{ 20, 3, 3, 4, 1, -3 } // '+' 30 | ,{ 22, 1, 2, 2, 1, 0 } // ',' 31 | ,{ 23, 1, 1, 2, 1, -2 } // '-' 32 | ,{ 24, 1, 1, 2, 1, 0 } // '.' 33 | ,{ 25, 4, 5, 5, 1, -4 } // '/' 34 | ,{ 28, 4, 5, 5, 1, -4 } // '0' 35 | ,{ 31, 3, 5, 4, 1, -4 } // '1' 36 | ,{ 33, 4, 5, 5, 1, -4 } // '2' 37 | ,{ 36, 4, 5, 5, 1, -4 } // '3' 38 | ,{ 39, 4, 5, 5, 1, -4 } // '4' 39 | ,{ 42, 4, 5, 5, 1, -4 } // '5' 40 | ,{ 45, 4, 5, 5, 1, -4 } // '6' 41 | ,{ 48, 4, 5, 5, 1, -4 } // '7' 42 | ,{ 51, 4, 5, 5, 1, -4 } // '8' 43 | ,{ 54, 4, 5, 5, 1, -4 } // '9' 44 | ,{ 57, 1, 3, 2, 1, -2 } // ':' 45 | ,{ 58, 1, 4, 2, 1, -2 } // ';' 46 | ,{ 59, 2, 3, 3, 1, -3 } // '<' 47 | ,{ 60, 4, 3, 5, 1, -3 } // '=' 48 | ,{ 62, 2, 3, 3, 1, -3 } // '>' 49 | ,{ 63, 4, 5, 5, 1, -4 } // '?' 50 | ,{ 66, 4, 4, 5, 1, -4 } // '@' 51 | ,{ 68, 4, 5, 5, 1, -4 } // 'A' 52 | ,{ 71, 4, 5, 5, 1, -4 } // 'B' 53 | ,{ 74, 4, 5, 5, 1, -4 } // 'C' 54 | ,{ 77, 4, 5, 5, 1, -4 } // 'D' 55 | ,{ 80, 4, 5, 5, 1, -4 } // 'E' 56 | ,{ 83, 4, 5, 5, 1, -4 } // 'F' 57 | ,{ 86, 4, 5, 5, 1, -4 } // 'G' 58 | ,{ 89, 4, 5, 5, 1, -4 } // 'H' 59 | ,{ 92, 3, 5, 4, 1, -4 } // 'I' 60 | ,{ 94, 4, 5, 5, 1, -4 } // 'J' 61 | ,{ 97, 4, 5, 5, 1, -4 } // 'K' 62 | ,{ 100, 4, 5, 5, 1, -4 } // 'L' 63 | ,{ 103, 6, 5, 7, 1, -4 } // 'M' 64 | ,{ 107, 4, 5, 5, 1, -4 } // 'N' 65 | ,{ 110, 4, 5, 5, 1, -4 } // 'O' 66 | ,{ 113, 4, 5, 5, 1, -4 } // 'P' 67 | ,{ 116, 4, 5, 5, 1, -4 } // 'Q' 68 | ,{ 119, 4, 5, 5, 1, -4 } // 'R' 69 | ,{ 122, 4, 5, 5, 1, -4 } // 'S' 70 | ,{ 125, 4, 5, 5, 1, -4 } // 'T' 71 | ,{ 128, 4, 5, 5, 1, -4 } // 'U' 72 | ,{ 131, 4, 5, 5, 1, -4 } // 'V' 73 | ,{ 134, 6, 5, 7, 1, -4 } // 'W' 74 | ,{ 138, 4, 5, 5, 1, -4 } // 'X' 75 | ,{ 141, 4, 5, 5, 1, -4 } // 'Y' 76 | ,{ 144, 4, 5, 5, 1, -4 } // 'Z' 77 | }; 78 | 79 | const GFXfont fld_5px PROGMEM = { 80 | (uint8_t *)fld_5pxBitmaps, 81 | (GFXglyph *)fld_5pxGlyphs, 82 | 0x20, 0x5A, 12 }; 83 | 84 | // Approx. 567 bytes 85 | -------------------------------------------------------------------------------- /Arduino_Sketches/LE_Reactor_Zero_V6_basic/font_rld_staggered_left.h: -------------------------------------------------------------------------------- 1 | const uint8_t rld_4pxBitmaps[] PROGMEM = { 2 | 0xA1, 0x80, 0x80, 0x80, 0xFF, 0x9F, 0x51, 0x10, 0x88, 0xA0, 0x47, 0x20, 3 | 0x48, 0x00, 0x00, 0xE0, 0x40, 0x22, 0x44, 0x6A, 0x56, 0xC8, 0x90, 0xE2, 4 | 0x67, 0xE2, 0x37, 0xAA, 0x71, 0xEC, 0x16, 0x66, 0x14, 0xC0, 0xE2, 0x44, 5 | 0x75, 0x9A, 0xE0, 0x6A, 0x71, 0xA0, 0x4C, 0x71, 0x80, 0xCC, 0xC7, 0x00, 6 | 0xEC, 0x20, 0xFF, 0x9F, 0x4A, 0x75, 0x8C, 0x56, 0x68, 0x43, 0xCA, 0x56, 7 | 0xE8, 0x67, 0xE8, 0x64, 0x68, 0x53, 0xAA, 0x75, 0xA5, 0x22, 0x16, 0xAC, 8 | 0x75, 0x88, 0x47, 0xAE, 0x55, 0xAE, 0x75, 0x6A, 0x56, 0xEA, 0x74, 0x65, 9 | 0x14, 0xF0, 0xEA, 0x65, 0x7C, 0x16, 0xE4, 0x22, 0xAA, 0x57, 0x95, 0x18, 10 | 0x80, 0x94, 0x9A, 0xB0, 0xA6, 0x0C, 0xA0, 0xAA, 0x44, 0xE4, 0x47 11 | }; 12 | 13 | const GFXglyph rld_4pxGlyphs[] PROGMEM = { 14 | { 0, 0, 0, 3, 0, 1 } // ' ' 15 | ,{ 0, 2, 4, 2, 0, -3 } // '!' 16 | ,{ 1, 0, 0, 0, 0, -2 } // '"' 17 | ,{ 1, 1, 1, 0, 0, -3 } // '#' 18 | ,{ 2, 1, 1, 0, 0, -3 } // '$' 19 | ,{ 3, 1, 1, 0, 0, -3 } // '%' 20 | ,{ 4, 4, 4, 0, 0, -3 } // '&' 21 | ,{ 6, 0, 0, 0, 0, -2 } // ''' 22 | ,{ 6, 3, 4, 3, 0, -3 } // '(' 23 | ,{ 8, 3, 4, 3, 0, -3 } // ')' 24 | ,{ 10, 0, 0, 0, 0, -2 } // '*' 25 | ,{ 10, 4, 3, 4, 0, -2 } // '+' 26 | ,{ 12, 3, 5, 3, 0, -1 } // ',' 27 | ,{ 15, 4, 1, 4, 0, -1 } // '-' 28 | ,{ 16, 4, 1, 2, 0, 0 } // '.' 29 | ,{ 17, 4, 4, 4, 0, -3 } // '/' 30 | ,{ 19, 4, 4, 4, 0, -3 } // '0' 31 | ,{ 21, 3, 4, 3, 0, -3 } // '1' 32 | ,{ 23, 4, 4, 4, 0, -3 } // '2' 33 | ,{ 25, 4, 4, 4, 0, -3 } // '3' 34 | ,{ 27, 4, 4, 4, 0, -3 } // '4' 35 | ,{ 29, 4, 4, 4, 0, -3 } // '5' 36 | ,{ 31, 5, 4, 4, 0, -3 } // '6' 37 | ,{ 34, 4, 4, 4, 0, -3 } // '7' 38 | ,{ 36, 5, 4, 5, 0, -3 } // '8' 39 | ,{ 39, 4, 4, 4, 0, -3 } // '9' 40 | ,{ 41, 1, 3, 2, 0, -2 } // ':' 41 | ,{ 42, 2, 3, 3, 0, -2 } // ';' 42 | ,{ 43, 3, 3, 4, 0, -2 } // '<' 43 | ,{ 45, 2, 3, 3, 0, -2 } // '=' 44 | ,{ 46, 3, 3, 4, 0, -2 } // '>' 45 | ,{ 48, 3, 4, 4, 0, -3 } // '?' 46 | ,{ 50, 4, 4, 0, 0, -3 } // '@' 47 | ,{ 52, 4, 4, 4, 0, -3 } // 'A' 48 | ,{ 54, 4, 4, 4, 0, -3 } // 'B' 49 | ,{ 56, 4, 4, 4, 0, -3 } // 'C' 50 | ,{ 58, 4, 4, 4, 0, -3 } // 'D' 51 | ,{ 60, 4, 4, 4, 0, -3 } // 'E' 52 | ,{ 62, 4, 4, 4, 0, -3 } // 'F' 53 | ,{ 64, 4, 4, 4, 0, -3 } // 'G' 54 | ,{ 66, 4, 4, 4, 0, -3 } // 'H' 55 | ,{ 68, 2, 4, 2, 0, -3 } // 'I' 56 | ,{ 69, 4, 4, 4, 0, -3 } // 'J' 57 | ,{ 71, 4, 4, 4, 0, -3 } // 'K' 58 | ,{ 73, 4, 4, 4, 0, -3 } // 'L' 59 | ,{ 75, 4, 4, 4, 0, -3 } // 'M' 60 | ,{ 77, 4, 4, 4, 0, -3 } // 'N' 61 | ,{ 79, 4, 4, 4, 0, -3 } // 'O' 62 | ,{ 81, 4, 4, 4, 0, -3 } // 'P' 63 | ,{ 83, 5, 4, 5, 0, -3 } // 'Q' 64 | ,{ 86, 4, 4, 4, 0, -3 } // 'R' 65 | ,{ 88, 4, 4, 4, 0, -3 } // 'S' 66 | ,{ 90, 4, 4, 4, 0, -3 } // 'T' 67 | ,{ 92, 4, 4, 4, 0, -3 } // 'U' 68 | ,{ 94, 5, 4, 5, 0, -3 } // 'V' 69 | ,{ 97, 5, 4, 5, 0, -3 } // 'W' 70 | ,{ 100, 5, 4, 4, 0, -3 } // 'X' 71 | ,{ 103, 4, 4, 4, 0, -3 } // 'Y' 72 | ,{ 105, 4, 4, 4, 0, -3 } // 'Z' 73 | }; 74 | 75 | const GFXfont rld_4px PROGMEM = { 76 | (uint8_t *)rld_4pxBitmaps, 77 | (GFXglyph *)rld_4pxGlyphs, 78 | 0x20, 0x5A, 4 }; 79 | 80 | // Approx. 520 bytes 81 | -------------------------------------------------------------------------------- /Arduino_Sketches/LE_Reactor_Zero_V6_basic/settings.h: -------------------------------------------------------------------------------- 1 | #define RLD112 true 2 | 3 | #define BAUDRATE 2400 //this is the baudrate that we use to listen for incoming commands over JEDI_SERIAL 4 | #define DEBUG_SERIAL SerialUSB 5 | #define JEDI_SERIAL Serial1 6 | #define DEBUG 0 //change to 1 to print some useful stuff to the serial monitor, 2 will also check loops-per-second 7 | #define TEECESPSI 1 8 | 9 | //default "factory" settings... 10 | #define DFLT_FRONT_FADE 1 //was 3 11 | #define DFLT_FRONT_DELAY 20 //was 60 12 | #define DFLT_REAR_FADE 5 //was 10 13 | #define DFLT_REAR_DELAY 200 //was 400 14 | #define MAX_BRIGHTNESS 180 15 | #define DFLT_FRONT_HUE 0 16 | #define DFLT_REAR_HUE 0 17 | #define DFLT_FRONT_PAL 0 18 | #define DFLT_REAR_PAL 1 19 | #define DFLT_FRONT_BRI 120 20 | #define DFLT_REAR_BRI 100 21 | #define DFLT_FRONT_DESAT 0 22 | #define DFLT_REAR_DESAT 0 23 | #define DFLT_FRONT_SCROLL 60 24 | #define DFLT_REAR_SCROLL 40 25 | 26 | #define MAX_FADE 15 27 | #define MAX_DELAY 500 28 | #define MIN_DELAY 10 29 | #define MIN_BRI 10 30 | 31 | #define TWEENS 8 // was 20 32 | 33 | #define delayPin A0 34 | #define fadePin A1 35 | #define briPin A2 36 | #define huePin A3 37 | #define FADJ_PIN 2 38 | #define RADJ_PIN 4 39 | #define PAL_PIN 9 40 | #define FRONT_PIN 5 41 | #define REAR_PIN 3 42 | #define REAR_DAT_PIN 11 43 | #define REAR_CLK_PIN 3 44 | #define STATUSLED_PIN 8 45 | 46 | //we store the colour pallettes here as an array of colors in HSV (Hue,Saturation,Value) format 47 | #define NUM_PALS 4 48 | const byte keyColors[NUM_PALS][4][3] = { 49 | { {170, 255, 0} , {170, 255, 85} , {170, 255, 170} , {170, 0,170} } , //front colors 50 | { {90, 235, 0} , {75, 255, 250} , {30, 255, 184} , {0, 255, 250} } , //rear colors (hues: 87=bright green, 79=yellow green, 45=orangey yellow, 0=red) 51 | { {0, 255, 0} , {0, 255, 0} , {0, 255, 100} , {0, 255, 250} } , //monotone (black to solid red) 52 | { {0, 255, 0} , {0, 255, 250} , {40, 255, 0} , {40, 255, 250}} //dual color red and yellow 53 | }; 54 | 55 | //Teeces PSI related settings... 56 | #define TEECES_D_PIN 12 57 | #define TEECES_C_PIN 10 58 | #define TEECES_L_PIN 6 59 | #define RPSIbright 15 //rear PSI 60 | #define FPSIbright 15 //front PSI 61 | #define PSIstuck 5 //odds (in 100) that a PSI will get partially stuck between 2 colors 62 | 63 | -------------------------------------------------------------------------------- /Arduino_Sketches/README.md: -------------------------------------------------------------------------------- 1 | # Arduino Sketches 2 | 3 | These are the Logic Engine sketches by Paul Murphy, and include basic functions to get logics doing their thing. 4 | 5 | For sketches with more advanced functionality, see Neil's firmware here : https://github.com/nhutchison/LogicEngine 6 | 7 | ## LE_AVR_slim 8 | A super basic sketch, intended to run front and rear logics from a single AVR board (or an Arduino UNO) 9 | 10 | ## LE_Reactor_Zero_V6_basic 11 | The sketch that ships out with the V6 (2021) Reactor Zero boards. Uses standard Adafruit libraries to make text scrolling easy. Includes support for new 112 rear LED board. 12 | 13 | ## LE_bare_bones 14 | This sketch is a intended to be a minimal implimentation. It includes code for standard logic display animations only (no communication or PSI code). Intended for using as groundwork for a more complicated sketch. 15 | 16 | ## LE_Teensy_Reactor_Jawalite_0.5 17 | This is the sketch that shipped with the Teensy Reactor board in the 2017 Logic Engine kits. It runs front and rear logic displays from a single Teensy 3.2 board. Adjustable settings (delay, fade, brightness, color) are stored in EEPROM and can be adjusted via the trimpots on the Teensy Reactor board, or via Jawalite serial commands (from a JEDI controller, Marcduino or other microcontroller). It will recognise and respond to a small handful of display sequence commands (Alarm, March, Leia, Failure). 18 | -------------------------------------------------------------------------------- /Hardware Designs/Reactor to RLD mounty thing.stl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joymonkey/logicengine/b7f17ec6ea922488af02227f457b47cb958590fd/Hardware Designs/Reactor to RLD mounty thing.stl -------------------------------------------------------------------------------- /Hardware Designs/Reactor_Mount.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joymonkey/logicengine/b7f17ec6ea922488af02227f457b47cb958590fd/Hardware Designs/Reactor_Mount.pdf -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # logicengine 2 | Info, Hardware Files and Arduino Sketches for the RSeries Logic Engine. 3 | 4 | Assembly instructions and documentation can be found in the GitHub wiki here... 5 | https://github.com/joymonkey/logicengine/wiki 6 | -------------------------------------------------------------------------------- /docs/Logic Engine V7 cheat sheet.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joymonkey/logicengine/b7f17ec6ea922488af02227f457b47cb958590fd/docs/Logic Engine V7 cheat sheet.pdf -------------------------------------------------------------------------------- /docs/Logic Engine V8 cheat sheet.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joymonkey/logicengine/b7f17ec6ea922488af02227f457b47cb958590fd/docs/Logic Engine V8 cheat sheet.pdf -------------------------------------------------------------------------------- /docs/Logic_Engine_2_cheat_sheet.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joymonkey/logicengine/b7f17ec6ea922488af02227f457b47cb958590fd/docs/Logic_Engine_2_cheat_sheet.pdf -------------------------------------------------------------------------------- /docs/Logic_Engine_3_cheat_sheet.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joymonkey/logicengine/b7f17ec6ea922488af02227f457b47cb958590fd/docs/Logic_Engine_3_cheat_sheet.pdf -------------------------------------------------------------------------------- /docs/Logic_Engine_V6_cheat_sheet.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joymonkey/logicengine/b7f17ec6ea922488af02227f457b47cb958590fd/docs/Logic_Engine_V6_cheat_sheet.pdf -------------------------------------------------------------------------------- /docs/img/2016front1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joymonkey/logicengine/b7f17ec6ea922488af02227f457b47cb958590fd/docs/img/2016front1.jpg -------------------------------------------------------------------------------- /docs/img/2016front2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joymonkey/logicengine/b7f17ec6ea922488af02227f457b47cb958590fd/docs/img/2016front2.jpg -------------------------------------------------------------------------------- /docs/img/Deathstar1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joymonkey/logicengine/b7f17ec6ea922488af02227f457b47cb958590fd/docs/img/Deathstar1.jpg -------------------------------------------------------------------------------- /docs/img/Deathstar2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joymonkey/logicengine/b7f17ec6ea922488af02227f457b47cb958590fd/docs/img/Deathstar2.jpg -------------------------------------------------------------------------------- /docs/img/Deathstar3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joymonkey/logicengine/b7f17ec6ea922488af02227f457b47cb958590fd/docs/img/Deathstar3.jpg -------------------------------------------------------------------------------- /docs/img/ImaharaRLD1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joymonkey/logicengine/b7f17ec6ea922488af02227f457b47cb958590fd/docs/img/ImaharaRLD1.jpg -------------------------------------------------------------------------------- /docs/img/ImaharaRLD2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joymonkey/logicengine/b7f17ec6ea922488af02227f457b47cb958590fd/docs/img/ImaharaRLD2.jpg -------------------------------------------------------------------------------- /docs/img/ImaharaRLD3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joymonkey/logicengine/b7f17ec6ea922488af02227f457b47cb958590fd/docs/img/ImaharaRLD3.jpg -------------------------------------------------------------------------------- /docs/img/Logic-Engine-LED-board-front.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joymonkey/logicengine/b7f17ec6ea922488af02227f457b47cb958590fd/docs/img/Logic-Engine-LED-board-front.png -------------------------------------------------------------------------------- /docs/img/Logic-Engine-LED-board-rear.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joymonkey/logicengine/b7f17ec6ea922488af02227f457b47cb958590fd/docs/img/Logic-Engine-LED-board-rear.png -------------------------------------------------------------------------------- /docs/img/LogicEngineAVRBoard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joymonkey/logicengine/b7f17ec6ea922488af02227f457b47cb958590fd/docs/img/LogicEngineAVRBoard.png -------------------------------------------------------------------------------- /docs/img/LogicEngineDMX.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joymonkey/logicengine/b7f17ec6ea922488af02227f457b47cb958590fd/docs/img/LogicEngineDMX.jpg -------------------------------------------------------------------------------- /docs/img/LogicEngineDMX_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joymonkey/logicengine/b7f17ec6ea922488af02227f457b47cb958590fd/docs/img/LogicEngineDMX_2.jpg -------------------------------------------------------------------------------- /docs/img/LogicEngineDMX_3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joymonkey/logicengine/b7f17ec6ea922488af02227f457b47cb958590fd/docs/img/LogicEngineDMX_3.jpg -------------------------------------------------------------------------------- /docs/img/LogicEngineDMX_4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joymonkey/logicengine/b7f17ec6ea922488af02227f457b47cb958590fd/docs/img/LogicEngineDMX_4.jpg -------------------------------------------------------------------------------- /docs/img/Logic_Engine_Parts.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joymonkey/logicengine/b7f17ec6ea922488af02227f457b47cb958590fd/docs/img/Logic_Engine_Parts.png -------------------------------------------------------------------------------- /docs/img/Logic_Engine_V6_cheat_sheet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joymonkey/logicengine/b7f17ec6ea922488af02227f457b47cb958590fd/docs/img/Logic_Engine_V6_cheat_sheet.png -------------------------------------------------------------------------------- /docs/img/Logic_Engine_V6_cheat_sheet_th.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joymonkey/logicengine/b7f17ec6ea922488af02227f457b47cb958590fd/docs/img/Logic_Engine_V6_cheat_sheet_th.png -------------------------------------------------------------------------------- /docs/img/Reactor Zero to Teeces PSI Hookup.s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joymonkey/logicengine/b7f17ec6ea922488af02227f457b47cb958590fd/docs/img/Reactor Zero to Teeces PSI Hookup.s.png -------------------------------------------------------------------------------- /docs/img/Reactor-Zero-20181125.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joymonkey/logicengine/b7f17ec6ea922488af02227f457b47cb958590fd/docs/img/Reactor-Zero-20181125.jpg -------------------------------------------------------------------------------- /docs/img/Reactor-Zero-20190915.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joymonkey/logicengine/b7f17ec6ea922488af02227f457b47cb958590fd/docs/img/Reactor-Zero-20190915.jpg -------------------------------------------------------------------------------- /docs/img/Reactor-Zero-20200830.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joymonkey/logicengine/b7f17ec6ea922488af02227f457b47cb958590fd/docs/img/Reactor-Zero-20200830.jpg -------------------------------------------------------------------------------- /docs/img/Reactor-Zero-New-Pins.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joymonkey/logicengine/b7f17ec6ea922488af02227f457b47cb958590fd/docs/img/Reactor-Zero-New-Pins.jpg -------------------------------------------------------------------------------- /docs/img/Reactor-Zero-SerialAdapter.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joymonkey/logicengine/b7f17ec6ea922488af02227f457b47cb958590fd/docs/img/Reactor-Zero-SerialAdapter.jpg -------------------------------------------------------------------------------- /docs/img/Reactor-Zero-V6-overview.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joymonkey/logicengine/b7f17ec6ea922488af02227f457b47cb958590fd/docs/img/Reactor-Zero-V6-overview.jpg -------------------------------------------------------------------------------- /docs/img/ReactorZero-board-only.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joymonkey/logicengine/b7f17ec6ea922488af02227f457b47cb958590fd/docs/img/ReactorZero-board-only.png -------------------------------------------------------------------------------- /docs/img/TeensyReactorPrototype.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joymonkey/logicengine/b7f17ec6ea922488af02227f457b47cb958590fd/docs/img/TeensyReactorPrototype.jpg -------------------------------------------------------------------------------- /docs/img/TeensyReactor_full.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joymonkey/logicengine/b7f17ec6ea922488af02227f457b47cb958590fd/docs/img/TeensyReactor_full.jpg -------------------------------------------------------------------------------- /docs/img/TeensyReactor_th.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joymonkey/logicengine/b7f17ec6ea922488af02227f457b47cb958590fd/docs/img/TeensyReactor_th.jpg -------------------------------------------------------------------------------- /docs/img/WREACTOR32-PCB.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joymonkey/logicengine/b7f17ec6ea922488af02227f457b47cb958590fd/docs/img/WREACTOR32-PCB.png -------------------------------------------------------------------------------- /docs/img/WReactor32_2024.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joymonkey/logicengine/b7f17ec6ea922488af02227f457b47cb958590fd/docs/img/WReactor32_2024.jpg -------------------------------------------------------------------------------- /docs/img/avr_ftdi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joymonkey/logicengine/b7f17ec6ea922488af02227f457b47cb958590fd/docs/img/avr_ftdi.png -------------------------------------------------------------------------------- /docs/img/avr_microsd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joymonkey/logicengine/b7f17ec6ea922488af02227f457b47cb958590fd/docs/img/avr_microsd.png -------------------------------------------------------------------------------- /docs/img/avr_mode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joymonkey/logicengine/b7f17ec6ea922488af02227f457b47cb958590fd/docs/img/avr_mode.png -------------------------------------------------------------------------------- /docs/img/avr_powering.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joymonkey/logicengine/b7f17ec6ea922488af02227f457b47cb958590fd/docs/img/avr_powering.png -------------------------------------------------------------------------------- /docs/img/avr_speed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joymonkey/logicengine/b7f17ec6ea922488af02227f457b47cb958590fd/docs/img/avr_speed.png -------------------------------------------------------------------------------- /docs/img/avr_to_teeces_psi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joymonkey/logicengine/b7f17ec6ea922488af02227f457b47cb958590fd/docs/img/avr_to_teeces_psi.png -------------------------------------------------------------------------------- /docs/img/front_bez_orientation1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joymonkey/logicengine/b7f17ec6ea922488af02227f457b47cb958590fd/docs/img/front_bez_orientation1.jpg -------------------------------------------------------------------------------- /docs/img/front_bez_orientation2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joymonkey/logicengine/b7f17ec6ea922488af02227f457b47cb958590fd/docs/img/front_bez_orientation2.jpg -------------------------------------------------------------------------------- /docs/img/rld-pattern-numbered.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joymonkey/logicengine/b7f17ec6ea922488af02227f457b47cb958590fd/docs/img/rld-pattern-numbered.png -------------------------------------------------------------------------------- /docs/img/uploadZeroFW/1-install_Boards.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joymonkey/logicengine/b7f17ec6ea922488af02227f457b47cb958590fd/docs/img/uploadZeroFW/1-install_Boards.png -------------------------------------------------------------------------------- /docs/img/uploadZeroFW/2-install_Libraries.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joymonkey/logicengine/b7f17ec6ea922488af02227f457b47cb958590fd/docs/img/uploadZeroFW/2-install_Libraries.png -------------------------------------------------------------------------------- /docs/img/uploadZeroFW/3-select_Board.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joymonkey/logicengine/b7f17ec6ea922488af02227f457b47cb958590fd/docs/img/uploadZeroFW/3-select_Board.png -------------------------------------------------------------------------------- /docs/img/uploadZeroFW/4-select_Port.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joymonkey/logicengine/b7f17ec6ea922488af02227f457b47cb958590fd/docs/img/uploadZeroFW/4-select_Port.png -------------------------------------------------------------------------------- /docs/img/uploadZeroFW/5-upload_Success.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joymonkey/logicengine/b7f17ec6ea922488af02227f457b47cb958590fd/docs/img/uploadZeroFW/5-upload_Success.png -------------------------------------------------------------------------------- /docs/img/uploadZeroFW/flashStorage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joymonkey/logicengine/b7f17ec6ea922488af02227f457b47cb958590fd/docs/img/uploadZeroFW/flashStorage.png -------------------------------------------------------------------------------- /docs/img/wreactor32/1-home.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joymonkey/logicengine/b7f17ec6ea922488af02227f457b47cb958590fd/docs/img/wreactor32/1-home.png -------------------------------------------------------------------------------- /docs/img/wreactor32/1-home_th.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joymonkey/logicengine/b7f17ec6ea922488af02227f457b47cb958590fd/docs/img/wreactor32/1-home_th.png -------------------------------------------------------------------------------- /docs/img/wreactor32/2-logics.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joymonkey/logicengine/b7f17ec6ea922488af02227f457b47cb958590fd/docs/img/wreactor32/2-logics.png -------------------------------------------------------------------------------- /docs/img/wreactor32/2-logics_th.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joymonkey/logicengine/b7f17ec6ea922488af02227f457b47cb958590fd/docs/img/wreactor32/2-logics_th.png -------------------------------------------------------------------------------- /docs/img/wreactor32/3-setup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joymonkey/logicengine/b7f17ec6ea922488af02227f457b47cb958590fd/docs/img/wreactor32/3-setup.png -------------------------------------------------------------------------------- /docs/img/wreactor32/3-setup_th.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joymonkey/logicengine/b7f17ec6ea922488af02227f457b47cb958590fd/docs/img/wreactor32/3-setup_th.png -------------------------------------------------------------------------------- /docs/img/wreactor32/4-firmware.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joymonkey/logicengine/b7f17ec6ea922488af02227f457b47cb958590fd/docs/img/wreactor32/4-firmware.png -------------------------------------------------------------------------------- /docs/img/wreactor32/4-firmware_th.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joymonkey/logicengine/b7f17ec6ea922488af02227f457b47cb958590fd/docs/img/wreactor32/4-firmware_th.png -------------------------------------------------------------------------------- /docs/img/wreactor32/5-marcduino.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joymonkey/logicengine/b7f17ec6ea922488af02227f457b47cb958590fd/docs/img/wreactor32/5-marcduino.png -------------------------------------------------------------------------------- /docs/img/wreactor32/5-marcduino_th.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joymonkey/logicengine/b7f17ec6ea922488af02227f457b47cb958590fd/docs/img/wreactor32/5-marcduino_th.png -------------------------------------------------------------------------------- /docs/img/wreactor32/6-wifi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joymonkey/logicengine/b7f17ec6ea922488af02227f457b47cb958590fd/docs/img/wreactor32/6-wifi.png -------------------------------------------------------------------------------- /docs/img/wreactor32/6-wifi_th.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joymonkey/logicengine/b7f17ec6ea922488af02227f457b47cb958590fd/docs/img/wreactor32/6-wifi_th.png -------------------------------------------------------------------------------- /docs/img/wreactor32/7-setuplogics.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joymonkey/logicengine/b7f17ec6ea922488af02227f457b47cb958590fd/docs/img/wreactor32/7-setuplogics.png -------------------------------------------------------------------------------- /docs/img/wreactor32/7-setuplogics_th.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joymonkey/logicengine/b7f17ec6ea922488af02227f457b47cb958590fd/docs/img/wreactor32/7-setuplogics_th.png -------------------------------------------------------------------------------- /libraries/FastLED/FastSPI_LED2.h: -------------------------------------------------------------------------------- 1 | #warning "This file is going away, please us FastLED.h in the future!" 2 | #include 3 | -------------------------------------------------------------------------------- /libraries/FastLED/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013 FastLED 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /libraries/FastLED/PORTING.md: -------------------------------------------------------------------------------- 1 | =New platform porting guide= 2 | 3 | == Setting up the basic files/folders == 4 | 5 | * Create platform directory (e.g. platforms/arm/kl26) 6 | * Create configuration header led_sysdefs_arm_kl26.h: 7 | * Define platform flags (like FASTLED_ARM/FASTLED_TEENSY) 8 | * Define configuration parameters re: interrupts, or clock doubling 9 | * Include extar system header files if needed 10 | * Create main platform include, fastled_arm_kl26.h 11 | * Include the various other header files as needed 12 | * Modify led_sysdefs.h to conditionally include platform sysdefs header file 13 | * Modify platforms.h to conditionally include platform fastled header 14 | 15 | == Porting fastpin.h == 16 | 17 | The heart of the FastLED library is the fast pin accesss. This is a templated class that provides 1-2 cycle pin access, bypassing digital write and other such things. As such, this will usually be the first bit of the library that you will want to port when moving to a new platform. Once you have FastPIN up and running then you can do some basic work like testing toggles or running bit-bang'd SPI output. 18 | 19 | There's two low level FastPin classes. There's the base FastPIN template class, and then there is FastPinBB which is for bit-banded access on those MCUs that support bitbanding. Note that the bitband class is optional and primarily useful in the implementation of other functionality internal to the platform. This file is also where you would do the pin to port/bit mapping defines. 20 | 21 | Explaining how the macros work and should be used is currently beyond the scope of this document. 22 | 23 | == Porting fastspi.h == 24 | 25 | This is where you define the low level interface to the hardware SPI system (including a writePixels method that does a bunch of housekeeping for writing led data). Use the fastspi_nop.h file as a reference for the methods that need to be implemented. There are ofteh other useful methods that can help with the internals of the SPI code, I recommend taking a look at how the various platforms implement their SPI classes. 26 | 27 | == Porting clockless.h == 28 | 29 | This is where you define the code for the clockless controllers. Across ARM platforms this will usually be fairly similar - though different arm platforms will have different clock sources that you can/should use. 30 | -------------------------------------------------------------------------------- /libraries/FastLED/bitswap.cpp: -------------------------------------------------------------------------------- 1 | #define FASTLED_INTERNAL 2 | #include "FastLED.h" 3 | 4 | /// Simplified form of bits rotating function. Based on code found here - http://www.hackersdelight.org/hdcodetxt/transpose8.c.txt - rotating 5 | /// data into LSB for a faster write (the code using this data can happily walk the array backwards) 6 | void transpose8x1_noinline(unsigned char *A, unsigned char *B) { 7 | uint32_t x, y, t; 8 | 9 | // Load the array and pack it into x and y. 10 | y = *(unsigned int*)(A); 11 | x = *(unsigned int*)(A+4); 12 | 13 | // pre-transform x 14 | t = (x ^ (x >> 7)) & 0x00AA00AA; x = x ^ t ^ (t << 7); 15 | t = (x ^ (x >>14)) & 0x0000CCCC; x = x ^ t ^ (t <<14); 16 | 17 | // pre-transform y 18 | t = (y ^ (y >> 7)) & 0x00AA00AA; y = y ^ t ^ (t << 7); 19 | t = (y ^ (y >>14)) & 0x0000CCCC; y = y ^ t ^ (t <<14); 20 | 21 | // final transform 22 | t = (x & 0xF0F0F0F0) | ((y >> 4) & 0x0F0F0F0F); 23 | y = ((x << 4) & 0xF0F0F0F0) | (y & 0x0F0F0F0F); 24 | x = t; 25 | 26 | *((uint32_t*)B) = y; 27 | *((uint32_t*)(B+4)) = x; 28 | } 29 | -------------------------------------------------------------------------------- /libraries/FastLED/clockless.h: -------------------------------------------------------------------------------- 1 | #ifndef __INC_CLOCKLESS_H 2 | #define __INC_CLOCKLESS_H 3 | 4 | #include "controller.h" 5 | #include "lib8tion.h" 6 | #include "led_sysdefs.h" 7 | #include "delay.h" 8 | 9 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 10 | // 11 | // Base template for clockless controllers. These controllers have 3 control points in their cycle for each bit. The first point 12 | // is where the line is raised hi. The second pointsnt is where the line is dropped low for a zero. The third point is where the 13 | // line is dropped low for a one. T1, T2, and T3 correspond to the timings for those three in clock cycles. 14 | // 15 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 16 | 17 | // Convinience macros to wrap around the toggling of hi vs. lo 18 | #define SET_LO FLIP ? FastPin::fastset(port, hi) : FastPin::fastset(port, lo); 19 | #define SET_HI FLIP ? FastPin::fastset(port, lo) : FastPin::fastset(port, hi); 20 | 21 | // #include "clockless_avr.h" 22 | #include "clockless_trinket.h" 23 | #include "clockless_arm_k20.h" 24 | #include "clockless_arm_sam.h" 25 | #include "clockless2.h" 26 | #include "block_clockless.h" 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /libraries/FastLED/clockless_arm_k20.h: -------------------------------------------------------------------------------- 1 | #ifndef __INC_CLOCKLESS_ARM_K20_H 2 | #define __INC_CLOCKLESS_ARM_K20_H 3 | 4 | // Definition for a single channel clockless controller for the k20 family of chips, like that used in the teensy 3.0/3.1 5 | // See clockless.h for detailed info on how the template parameters are used. 6 | #if defined(FASTLED_TEENSY3) 7 | template 8 | class ClocklessController : public CLEDController { 9 | typedef typename FastPin::port_ptr_t data_ptr_t; 10 | typedef typename FastPin::port_t data_t; 11 | 12 | data_t mPinMask; 13 | data_ptr_t mPort; 14 | CMinWait mWait; 15 | public: 16 | virtual void init() { 17 | FastPin::setOutput(); 18 | mPinMask = FastPin::mask(); 19 | mPort = FastPin::port(); 20 | } 21 | 22 | virtual void clearLeds(int nLeds) { 23 | showColor(CRGB(0, 0, 0), nLeds, 0); 24 | } 25 | 26 | protected: 27 | 28 | // set all the leds on the controller to a given color 29 | virtual void showColor(const struct CRGB & rgbdata, int nLeds, CRGB scale) { 30 | PixelController pixels(rgbdata, nLeds, scale, getDither()); 31 | 32 | mWait.wait(); 33 | cli(); 34 | 35 | uint32_t clocks = showRGBInternal(pixels); 36 | 37 | // Adjust the timer 38 | long microsTaken = CLKS_TO_MICROS(clocks); 39 | MS_COUNTER += (1 + (microsTaken / 1000)); 40 | sei(); 41 | mWait.mark(); 42 | } 43 | 44 | virtual void show(const struct CRGB *rgbdata, int nLeds, CRGB scale) { 45 | PixelController pixels(rgbdata, nLeds, scale, getDither()); 46 | 47 | mWait.wait(); 48 | cli(); 49 | 50 | uint32_t clocks = showRGBInternal(pixels); 51 | 52 | // Adjust the timer 53 | long microsTaken = CLKS_TO_MICROS(clocks); 54 | MS_COUNTER += (1 + (microsTaken / 1000)); 55 | sei(); 56 | mWait.mark(); 57 | } 58 | 59 | #ifdef SUPPORT_ARGB 60 | virtual void show(const struct CARGB *rgbdata, int nLeds, CRGB scale) { 61 | PixelController pixels(rgbdata, nLeds, scale, getDither()); 62 | mWait.wait(); 63 | cli(); 64 | 65 | uint32_t clocks = showRGBInternal(pixels); 66 | 67 | 68 | // Adjust the timer 69 | long microsTaken = CLKS_TO_MICROS(clocks); 70 | MS_COUNTER += (1 + (microsTaken / 1000)); 71 | sei(); 72 | mWait.mark(); 73 | } 74 | #endif 75 | 76 | template __attribute__ ((always_inline)) inline static void writeBits(register uint32_t & next_mark, register data_ptr_t port, register data_t hi, register data_t lo, register uint8_t & b) { 77 | for(register uint32_t i = BITS-1; i > 0; i--) { 78 | while(ARM_DWT_CYCCNT < next_mark); 79 | next_mark = ARM_DWT_CYCCNT + (T1+T2+T3); 80 | FastPin::fastset(port, hi); 81 | if(b&0x80) { 82 | while((next_mark - ARM_DWT_CYCCNT) > (T3+(2*(F_CPU/24000000)))); 83 | FastPin::fastset(port, lo); 84 | } else { 85 | while((next_mark - ARM_DWT_CYCCNT) > (T2+T3+(2*(F_CPU/24000000)))); 86 | FastPin::fastset(port, lo); 87 | } 88 | b <<= 1; 89 | } 90 | 91 | while(ARM_DWT_CYCCNT < next_mark); 92 | next_mark = ARM_DWT_CYCCNT + (T1+T2+T3); 93 | FastPin::fastset(port, hi); 94 | 95 | if(b&0x80) { 96 | while((next_mark - ARM_DWT_CYCCNT) > (T3+(2*(F_CPU/24000000)))); 97 | FastPin::fastset(port, lo); 98 | } else { 99 | while((next_mark - ARM_DWT_CYCCNT) > (T2+T3+(2*(F_CPU/24000000)))); 100 | FastPin::fastset(port, lo); 101 | } 102 | } 103 | 104 | // This method is made static to force making register Y available to use for data on AVR - if the method is non-static, then 105 | // gcc will use register Y for the this pointer. 106 | static uint32_t showRGBInternal(PixelController & pixels) { 107 | // Get access to the clock 108 | ARM_DEMCR |= ARM_DEMCR_TRCENA; 109 | ARM_DWT_CTRL |= ARM_DWT_CTRL_CYCCNTENA; 110 | ARM_DWT_CYCCNT = 0; 111 | 112 | register data_ptr_t port = FastPin::port(); 113 | register data_t hi = *port | FastPin::mask();; 114 | register data_t lo = *port & ~FastPin::mask();; 115 | *port = lo; 116 | 117 | // Setup the pixel controller and load/scale the first byte 118 | pixels.preStepFirstByteDithering(); 119 | register uint8_t b = pixels.loadAndScale0(); 120 | 121 | uint32_t next_mark = ARM_DWT_CYCCNT + (T1+T2+T3); 122 | 123 | while(pixels.has(1)) { 124 | pixels.stepDithering(); 125 | 126 | // Write first byte, read next byte 127 | writeBits<8+XTRA0>(next_mark, port, hi, lo, b); 128 | b = pixels.loadAndScale1(); 129 | 130 | // Write second byte, read 3rd byte 131 | writeBits<8+XTRA0>(next_mark, port, hi, lo, b); 132 | b = pixels.loadAndScale2(); 133 | 134 | // Write third byte, read 1st byte of next pixel 135 | writeBits<8+XTRA0>(next_mark, port, hi, lo, b); 136 | b = pixels.advanceAndLoadAndScale0(); 137 | }; 138 | 139 | return ARM_DWT_CYCCNT; 140 | } 141 | }; 142 | #endif 143 | 144 | #endif 145 | -------------------------------------------------------------------------------- /libraries/FastLED/color.h: -------------------------------------------------------------------------------- 1 | #ifndef __INC_COLOR_H 2 | #define __INC_COLOR_H 3 | 4 | #include "FastLED.h" 5 | 6 | FASTLED_NAMESPACE_BEGIN 7 | 8 | ///@file color.h 9 | /// contains definitions for color correction and temperature 10 | ///@defgroup ColorEnums Color correction/temperature 11 | /// definitions for color correction and light temperatures 12 | ///@{ 13 | typedef enum { 14 | // Color correction starting points 15 | 16 | /// typical values for SMD5050 LEDs 17 | ///@{ 18 | TypicalSMD5050=0xFFB0F0 /* 255, 176, 240 */, 19 | TypicalLEDStrip=0xFFB0F0 /* 255, 176, 240 */, 20 | ///@} 21 | 22 | /// typical values for 8mm "pixels on a string" 23 | /// also for many through-hole 'T' package LEDs 24 | ///@{ 25 | Typical8mmPixel=0xFFE08C /* 255, 224, 140 */, 26 | TypicalPixelString=0xFFE08C /* 255, 224, 140 */, 27 | ///@} 28 | 29 | /// uncorrected color 30 | UncorrectedColor=0xFFFFFF 31 | 32 | } LEDColorCorrection; 33 | 34 | 35 | typedef enum { 36 | /// @name Black-body radiation light sources 37 | /// Black-body radiation light sources emit a (relatively) continuous 38 | /// spectrum, and can be described as having a Kelvin 'temperature' 39 | ///@{ 40 | /// 1900 Kelvin 41 | Candle=0xFF9329 /* 1900 K, 255, 147, 41 */, 42 | /// 2600 Kelvin 43 | Tungsten40W=0xFFC58F /* 2600 K, 255, 197, 143 */, 44 | /// 2850 Kelvin 45 | Tungsten100W=0xFFD6AA /* 2850 K, 255, 214, 170 */, 46 | /// 3200 Kelvin 47 | Halogen=0xFFF1E0 /* 3200 K, 255, 241, 224 */, 48 | /// 5200 Kelvin 49 | CarbonArc=0xFFFAF4 /* 5200 K, 255, 250, 244 */, 50 | /// 5400 Kelvin 51 | HighNoonSun=0xFFFFFB /* 5400 K, 255, 255, 251 */, 52 | /// 6000 Kelvin 53 | DirectSunlight=0xFFFFFF /* 6000 K, 255, 255, 255 */, 54 | /// 7000 Kelvin 55 | OvercastSky=0xC9E2FF /* 7000 K, 201, 226, 255 */, 56 | /// 20000 Kelvin 57 | ClearBlueSky=0x409CFF /* 20000 K, 64, 156, 255 */, 58 | ///@} 59 | 60 | /// @name Gaseous light sources 61 | /// Gaseous light sources emit discrete spectral bands, and while we can 62 | /// approximate their aggregate hue with RGB values, they don't actually 63 | /// have a proper Kelvin temperature. 64 | ///@{ 65 | WarmFluorescent=0xFFF4E5 /* 0 K, 255, 244, 229 */, 66 | StandardFluorescent=0xF4FFFA /* 0 K, 244, 255, 250 */, 67 | CoolWhiteFluorescent=0xD4EBFF /* 0 K, 212, 235, 255 */, 68 | FullSpectrumFluorescent=0xFFF4F2 /* 0 K, 255, 244, 242 */, 69 | GrowLightFluorescent=0xFFEFF7 /* 0 K, 255, 239, 247 */, 70 | BlackLightFluorescent=0xA700FF /* 0 K, 167, 0, 255 */, 71 | MercuryVapor=0xD8F7FF /* 0 K, 216, 247, 255 */, 72 | SodiumVapor=0xFFD1B2 /* 0 K, 255, 209, 178 */, 73 | MetalHalide=0xF2FCFF /* 0 K, 242, 252, 255 */, 74 | HighPressureSodium=0xFFB74C /* 0 K, 255, 183, 76 */, 75 | ///@} 76 | 77 | /// Uncorrected temperature 0xFFFFFF 78 | UncorrectedTemperature=0xFFFFFF 79 | } ColorTemperature; 80 | 81 | FASTLED_NAMESPACE_END 82 | 83 | ///@} 84 | #endif 85 | -------------------------------------------------------------------------------- /libraries/FastLED/colorpalettes.cpp: -------------------------------------------------------------------------------- 1 | #ifndef __INC_COLORPALETTES_H 2 | #define __INC_COLORPALETTES_H 3 | #define FASTLED_INTERNAL 4 | #include "FastLED.h" 5 | #include "colorutils.h" 6 | #include "colorpalettes.h" 7 | 8 | FASTLED_USING_NAMESPACE 9 | 10 | 11 | // Preset color schemes, such as they are. 12 | 13 | // These schemes are all declared as "PROGMEM", meaning 14 | // that they won't take up SRAM on AVR chips until used. 15 | // Furthermore, the compiler won't even include these 16 | // in your PROGMEM (flash) storage unless you specifically 17 | // use each one, so you only 'pay for' those you actually use. 18 | 19 | 20 | extern const TProgmemRGBPalette16 CloudColors_p FL_PROGMEM = 21 | { 22 | CRGB::Blue, 23 | CRGB::DarkBlue, 24 | CRGB::DarkBlue, 25 | CRGB::DarkBlue, 26 | 27 | CRGB::DarkBlue, 28 | CRGB::DarkBlue, 29 | CRGB::DarkBlue, 30 | CRGB::DarkBlue, 31 | 32 | CRGB::Blue, 33 | CRGB::DarkBlue, 34 | CRGB::SkyBlue, 35 | CRGB::SkyBlue, 36 | 37 | CRGB::LightBlue, 38 | CRGB::White, 39 | CRGB::LightBlue, 40 | CRGB::SkyBlue 41 | }; 42 | 43 | extern const TProgmemRGBPalette16 LavaColors_p FL_PROGMEM = 44 | { 45 | CRGB::Black, 46 | CRGB::Maroon, 47 | CRGB::Black, 48 | CRGB::Maroon, 49 | 50 | CRGB::DarkRed, 51 | CRGB::Maroon, 52 | CRGB::DarkRed, 53 | 54 | CRGB::DarkRed, 55 | CRGB::DarkRed, 56 | CRGB::Red, 57 | CRGB::Orange, 58 | 59 | CRGB::White, 60 | CRGB::Orange, 61 | CRGB::Red, 62 | CRGB::DarkRed 63 | }; 64 | 65 | 66 | extern const TProgmemRGBPalette16 OceanColors_p FL_PROGMEM = 67 | { 68 | CRGB::MidnightBlue, 69 | CRGB::DarkBlue, 70 | CRGB::MidnightBlue, 71 | CRGB::Navy, 72 | 73 | CRGB::DarkBlue, 74 | CRGB::MediumBlue, 75 | CRGB::SeaGreen, 76 | CRGB::Teal, 77 | 78 | CRGB::CadetBlue, 79 | CRGB::Blue, 80 | CRGB::DarkCyan, 81 | CRGB::CornflowerBlue, 82 | 83 | CRGB::Aquamarine, 84 | CRGB::SeaGreen, 85 | CRGB::Aqua, 86 | CRGB::LightSkyBlue 87 | }; 88 | 89 | extern const TProgmemRGBPalette16 ForestColors_p FL_PROGMEM = 90 | { 91 | CRGB::DarkGreen, 92 | CRGB::DarkGreen, 93 | CRGB::DarkOliveGreen, 94 | CRGB::DarkGreen, 95 | 96 | CRGB::Green, 97 | CRGB::ForestGreen, 98 | CRGB::OliveDrab, 99 | CRGB::Green, 100 | 101 | CRGB::SeaGreen, 102 | CRGB::MediumAquamarine, 103 | CRGB::LimeGreen, 104 | CRGB::YellowGreen, 105 | 106 | CRGB::LightGreen, 107 | CRGB::LawnGreen, 108 | CRGB::MediumAquamarine, 109 | CRGB::ForestGreen 110 | }; 111 | 112 | /// HSV Rainbow 113 | extern const TProgmemRGBPalette16 RainbowColors_p FL_PROGMEM = 114 | { 115 | 0xFF0000, 0xD52A00, 0xAB5500, 0xAB7F00, 116 | 0xABAB00, 0x56D500, 0x00FF00, 0x00D52A, 117 | 0x00AB55, 0x0056AA, 0x0000FF, 0x2A00D5, 118 | 0x5500AB, 0x7F0081, 0xAB0055, 0xD5002B 119 | }; 120 | 121 | /// HSV Rainbow colors with alternatating stripes of black 122 | #define RainbowStripesColors_p RainbowStripeColors_p 123 | extern const TProgmemRGBPalette16 RainbowStripeColors_p FL_PROGMEM = 124 | { 125 | 0xFF0000, 0x000000, 0xAB5500, 0x000000, 126 | 0xABAB00, 0x000000, 0x00FF00, 0x000000, 127 | 0x00AB55, 0x000000, 0x0000FF, 0x000000, 128 | 0x5500AB, 0x000000, 0xAB0055, 0x000000 129 | }; 130 | 131 | /// HSV color ramp: blue purple ping red orange yellow (and back) 132 | /// Basically, everything but the greens, which tend to make 133 | /// people's skin look unhealthy. This palette is good for 134 | /// lighting at a club or party, where it'll be shining on people. 135 | extern const TProgmemRGBPalette16 PartyColors_p FL_PROGMEM = 136 | { 137 | 0x5500AB, 0x84007C, 0xB5004B, 0xE5001B, 138 | 0xE81700, 0xB84700, 0xAB7700, 0xABAB00, 139 | 0xAB5500, 0xDD2200, 0xF2000E, 0xC2003E, 140 | 0x8F0071, 0x5F00A1, 0x2F00D0, 0x0007F9 141 | }; 142 | 143 | /// Approximate "black body radiation" palette, akin to 144 | /// the FastLED 'HeatColor' function. 145 | /// Recommend that you use values 0-240 rather than 146 | /// the usual 0-255, as the last 15 colors will be 147 | /// 'wrapping around' from the hot end to the cold end, 148 | /// which looks wrong. 149 | extern const TProgmemRGBPalette16 HeatColors_p FL_PROGMEM = 150 | { 151 | 0x000000, 152 | 0x330000, 0x660000, 0x990000, 0xCC0000, 0xFF0000, 153 | 0xFF3300, 0xFF6600, 0xFF9900, 0xFFCC00, 0xFFFF00, 154 | 0xFFFF33, 0xFFFF66, 0xFFFF99, 0xFFFFCC, 0xFFFFFF 155 | }; 156 | 157 | 158 | // Gradient palette "Rainbow_gp", 159 | // provided for situations where you're going 160 | // to use a number of other gradient palettes, AND 161 | // you want a 'standard' FastLED rainbow as well. 162 | 163 | DEFINE_GRADIENT_PALETTE( Rainbow_gp ) { 164 | 0, 255, 0, 0, // Red 165 | 32, 171, 85, 0, // Orange 166 | 64, 171,171, 0, // Yellow 167 | 96, 0,255, 0, // Green 168 | 128, 0,171, 85, // Aqua 169 | 160, 0, 0,255, // Blue 170 | 192, 85, 0,171, // Purple 171 | 224, 171, 0, 85, // Pink 172 | 255, 255, 0, 0};// and back to Red 173 | 174 | #endif 175 | -------------------------------------------------------------------------------- /libraries/FastLED/colorpalettes.h: -------------------------------------------------------------------------------- 1 | #ifndef __INC_COLORPALETTES_H 2 | #define __INC_COLORPALETTES_H 3 | 4 | #include "FastLED.h" 5 | #include "colorutils.h" 6 | 7 | ///@file colorpalettes.h 8 | /// contains definitions for the predefined color palettes supplied by FastLED. 9 | 10 | FASTLED_NAMESPACE_BEGIN 11 | 12 | ///@defgroup Colorpalletes Pre-defined color palletes 13 | /// These schemes are all declared as "PROGMEM", meaning 14 | /// that they won't take up SRAM on AVR chips until used. 15 | /// Furthermore, the compiler won't even include these 16 | /// in your PROGMEM (flash) storage unless you specifically 17 | /// use each one, so you only 'pay for' those you actually use. 18 | 19 | ///@{ 20 | 21 | /// Cloudy color pallete 22 | extern const TProgmemRGBPalette16 CloudColors_p FL_PROGMEM; 23 | /// Lava colors 24 | extern const TProgmemRGBPalette16 LavaColors_p FL_PROGMEM; 25 | /// Ocean colors, blues and whites 26 | extern const TProgmemRGBPalette16 OceanColors_p FL_PROGMEM; 27 | /// Forest colors, greens 28 | extern const TProgmemRGBPalette16 ForestColors_p FL_PROGMEM; 29 | 30 | /// HSV Rainbow 31 | extern const TProgmemRGBPalette16 RainbowColors_p FL_PROGMEM; 32 | 33 | #define RainbowStripesColors_p RainbowStripeColors_p 34 | /// HSV Rainbow colors with alternatating stripes of black 35 | extern const TProgmemRGBPalette16 RainbowStripeColors_p FL_PROGMEM; 36 | 37 | /// HSV color ramp: blue purple ping red orange yellow (and back) 38 | /// Basically, everything but the greens, which tend to make 39 | /// people's skin look unhealthy. This palette is good for 40 | /// lighting at a club or party, where it'll be shining on people. 41 | extern const TProgmemRGBPalette16 PartyColors_p FL_PROGMEM; 42 | 43 | /// Approximate "black body radiation" palette, akin to 44 | /// the FastLED 'HeatColor' function. 45 | /// Recommend that you use values 0-240 rather than 46 | /// the usual 0-255, as the last 15 colors will be 47 | /// 'wrapping around' from the hot end to the cold end, 48 | /// which looks wrong. 49 | extern const TProgmemRGBPalette16 HeatColors_p FL_PROGMEM; 50 | 51 | 52 | DECLARE_GRADIENT_PALETTE( Rainbow_gp); 53 | 54 | FASTLED_NAMESPACE_END 55 | 56 | ///@} 57 | #endif 58 | -------------------------------------------------------------------------------- /libraries/FastLED/cpp_compat.h: -------------------------------------------------------------------------------- 1 | #ifndef __INC_CPP_COMPAT_H 2 | #define __INC_CPP_COMPAT_H 3 | 4 | #include "FastLED.h" 5 | 6 | #if __cplusplus <= 199711L 7 | 8 | #define static_assert(expression, message) 9 | #define constexpr const 10 | 11 | #else 12 | 13 | // things that we can turn on if we're in a C++11 environment 14 | #endif 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /libraries/FastLED/dmx.h: -------------------------------------------------------------------------------- 1 | #ifndef __INC_DMX_H 2 | #define __INC_DMX_H 3 | 4 | #include "FastLED.h" 5 | 6 | #ifdef DmxSimple_h 7 | #include 8 | #define HAS_DMX_SIMPLE 9 | 10 | ///@ingroup chipsets 11 | ///@{ 12 | FASTLED_NAMESPACE_BEGIN 13 | 14 | // note - dmx simple must be included before FastSPI for this code to be enabled 15 | template class DMXSimpleController : public CPixelLEDController { 16 | public: 17 | // initialize the LED controller 18 | virtual void init() { DmxSimple.usePin(DATA_PIN); } 19 | 20 | protected: 21 | virtual void showPixels(PixelController & pixels) { 22 | int iChannel = 1; 23 | while(pixels.has(1)) { 24 | DmxSimple.write(iChannel++, pixels.loadAndScale0()); 25 | DmxSimple.write(iChannel++, pixels.loadAndScale1()); 26 | DmxSimple.write(iChannel++, pixels.loadAndScale2()); 27 | pixels.advanceData(); 28 | pixels.stepDithering(); 29 | } 30 | } 31 | }; 32 | 33 | FASTLED_NAMESPACE_END 34 | 35 | #endif 36 | 37 | #ifdef DmxSerial_h 38 | #include 39 | 40 | FASTLED_NAMESPACE_BEGIN 41 | 42 | template class DMXSerialController : public CPixelLEDController { 43 | public: 44 | // initialize the LED controller 45 | virtual void init() { DMXSerial.init(DMXController); } 46 | 47 | virtual void showPixels(PixelController & pixels) { 48 | int iChannel = 1; 49 | while(pixels.has(1)) { 50 | DMXSerial.write(iChannel++, pixels.loadAndScale0()); 51 | DMXSerial.write(iChannel++, pixels.loadAndScale1()); 52 | DMXSerial.write(iChannel++, pixels.loadAndScale2()); 53 | pixels.advanceData(); 54 | pixels.stepDithering(); 55 | } 56 | } 57 | }; 58 | 59 | FASTLED_NAMESPACE_END 60 | ///@} 61 | 62 | #define HAS_DMX_SERIAL 63 | #endif 64 | 65 | #endif 66 | -------------------------------------------------------------------------------- /libraries/FastLED/docs/mainpage.dox: -------------------------------------------------------------------------------- 1 | /** 2 | @brief Documentation file for FastLED 3 | @author dgarcia at fastled dot io 4 | @file 5 | */ 6 | /** @defgroup FastLED Sources */ 7 | /** 8 | @mainpage FastLED - let there be light! 9 | */ 10 | EOF 11 | -------------------------------------------------------------------------------- /libraries/FastLED/examples/AnalogOutput/AnalogOutput.ino: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | // Example showing how to use FastLED color functions 4 | // even when you're NOT using a "pixel-addressible" smart LED strip. 5 | // 6 | // This example is designed to control an "analog" RGB LED strip 7 | // (or a single RGB LED) being driven by Arduino PWM output pins. 8 | // So this code never calls FastLED.addLEDs() or FastLED.show(). 9 | // 10 | // This example illustrates one way you can use just the portions 11 | // of FastLED that you need. In this case, this code uses just the 12 | // fast HSV color conversion code. 13 | // 14 | // In this example, the RGB values are output on three separate 15 | // 'analog' PWM pins, one for red, one for green, and one for blue. 16 | 17 | #define REDPIN 5 18 | #define GREENPIN 6 19 | #define BLUEPIN 3 20 | 21 | // showAnalogRGB: this is like FastLED.show(), but outputs on 22 | // analog PWM output pins instead of sending data to an intelligent, 23 | // pixel-addressable LED strip. 24 | // 25 | // This function takes the incoming RGB values and outputs the values 26 | // on three analog PWM output pins to the r, g, and b values respectively. 27 | void showAnalogRGB( const CRGB& rgb) 28 | { 29 | analogWrite(REDPIN, rgb.r ); 30 | analogWrite(GREENPIN, rgb.g ); 31 | analogWrite(BLUEPIN, rgb.b ); 32 | } 33 | 34 | 35 | 36 | // colorBars: flashes Red, then Green, then Blue, then Black. 37 | // Helpful for diagnosing if you've mis-wired which is which. 38 | void colorBars() 39 | { 40 | showAnalogRGB( CRGB::Red ); delay(500); 41 | showAnalogRGB( CRGB::Green ); delay(500); 42 | showAnalogRGB( CRGB::Blue ); delay(500); 43 | showAnalogRGB( CRGB::Black ); delay(500); 44 | } 45 | 46 | void loop() 47 | { 48 | static uint8_t hue; 49 | hue = hue + 1; 50 | // Use FastLED automatic HSV->RGB conversion 51 | showAnalogRGB( CHSV( hue, 255, 255) ); 52 | 53 | delay(20); 54 | } 55 | 56 | 57 | void setup() { 58 | pinMode(REDPIN, OUTPUT); 59 | pinMode(GREENPIN, OUTPUT); 60 | pinMode(BLUEPIN, OUTPUT); 61 | 62 | // Flash the "hello" color sequence: R, G, B, black. 63 | colorBars(); 64 | } 65 | 66 | -------------------------------------------------------------------------------- /libraries/FastLED/examples/Blink/Blink.ino: -------------------------------------------------------------------------------- 1 | #include "FastLED.h" 2 | 3 | // How many leds in your strip? 4 | #define NUM_LEDS 1 5 | 6 | // For led chips like Neopixels, which have a data line, ground, and power, you just 7 | // need to define DATA_PIN. For led chipsets that are SPI based (four wires - data, clock, 8 | // ground, and power), like the LPD8806 define both DATA_PIN and CLOCK_PIN 9 | #define DATA_PIN 3 10 | #define CLOCK_PIN 13 11 | 12 | // Define the array of leds 13 | CRGB leds[NUM_LEDS]; 14 | 15 | void setup() { 16 | // Uncomment/edit one of the following lines for your leds arrangement. 17 | // FastLED.addLeds(leds, NUM_LEDS); 18 | // FastLED.addLeds(leds, NUM_LEDS); 19 | // FastLED.addLeds(leds, NUM_LEDS); 20 | // FastLED.addLeds(leds, NUM_LEDS); 21 | // FastLED.addLeds(leds, NUM_LEDS); 22 | // FastLED.addLeds(leds, NUM_LEDS); 23 | FastLED.addLeds(leds, NUM_LEDS); 24 | // FastLED.addLeds(leds, NUM_LEDS); 25 | // FastLED.addLeds(leds, NUM_LEDS); 26 | // FastLED.addLeds(leds, NUM_LEDS); 27 | // FastLED.addLeds(leds, NUM_LEDS); 28 | // FastLED.addLeds(leds, NUM_LEDS); 29 | 30 | // FastLED.addLeds(leds, NUM_LEDS); 31 | // FastLED.addLeds(leds, NUM_LEDS); 32 | // FastLED.addLeds(leds, NUM_LEDS); 33 | // FastLED.addLeds(leds, NUM_LEDS); 34 | // FastLED.addLeds(leds, NUM_LEDS); 35 | // FastLED.addLeds(leds, NUM_LEDS); 36 | 37 | // FastLED.addLeds(leds, NUM_LEDS); 38 | // FastLED.addLeds(leds, NUM_LEDS); 39 | // FastLED.addLeds(leds, NUM_LEDS); 40 | // FastLED.addLeds(leds, NUM_LEDS); 41 | // FastLED.addLeds(leds, NUM_LEDS); 42 | // FastLED.addLeds(leds, NUM_LEDS); 43 | } 44 | 45 | void loop() { 46 | // Turn the LED on, then pause 47 | leds[0] = CRGB::Red; 48 | FastLED.show(); 49 | delay(500); 50 | // Now turn the LED off, then pause 51 | leds[0] = CRGB::Black; 52 | FastLED.show(); 53 | delay(500); 54 | } 55 | -------------------------------------------------------------------------------- /libraries/FastLED/examples/ColorTemperature/ColorTemperature.ino: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #define LED_PIN 3 4 | 5 | // Information about the LED strip itself 6 | #define NUM_LEDS 60 7 | #define CHIPSET WS2811 8 | #define COLOR_ORDER GRB 9 | CRGB leds[NUM_LEDS]; 10 | 11 | #define BRIGHTNESS 128 12 | 13 | 14 | // FastLED v2.1 provides two color-management controls: 15 | // (1) color correction settings for each LED strip, and 16 | // (2) master control of the overall output 'color temperature' 17 | // 18 | // THIS EXAMPLE demonstrates the second, "color temperature" control. 19 | // It shows a simple rainbow animation first with one temperature profile, 20 | // and a few seconds later, with a different temperature profile. 21 | // 22 | // The first pixel of the strip will show the color temperature. 23 | // 24 | // HELPFUL HINTS for "seeing" the effect in this demo: 25 | // * Don't look directly at the LED pixels. Shine the LEDs aganst 26 | // a white wall, table, or piece of paper, and look at the reflected light. 27 | // 28 | // * If you watch it for a bit, and then walk away, and then come back 29 | // to it, you'll probably be able to "see" whether it's currently using 30 | // the 'redder' or the 'bluer' temperature profile, even not counting 31 | // the lowest 'indicator' pixel. 32 | // 33 | // 34 | // FastLED provides these pre-conigured incandescent color profiles: 35 | // Candle, Tungsten40W, Tungsten100W, Halogen, CarbonArc, 36 | // HighNoonSun, DirectSunlight, OvercastSky, ClearBlueSky, 37 | // FastLED provides these pre-configured gaseous-light color profiles: 38 | // WarmFluorescent, StandardFluorescent, CoolWhiteFluorescent, 39 | // FullSpectrumFluorescent, GrowLightFluorescent, BlackLightFluorescent, 40 | // MercuryVapor, SodiumVapor, MetalHalide, HighPressureSodium, 41 | // FastLED also provides an "Uncorrected temperature" profile 42 | // UncorrectedTemperature; 43 | 44 | #define TEMPERATURE_1 Tungsten100W 45 | #define TEMPERATURE_2 OvercastSky 46 | 47 | // How many seconds to show each temperature before switching 48 | #define DISPLAYTIME 20 49 | // How many seconds to show black between switches 50 | #define BLACKTIME 3 51 | 52 | void loop() 53 | { 54 | // draw a generic, no-name rainbow 55 | static uint8_t starthue = 0; 56 | fill_rainbow( leds + 5, NUM_LEDS - 5, --starthue, 20); 57 | 58 | // Choose which 'color temperature' profile to enable. 59 | uint8_t secs = (millis() / 1000) % (DISPLAYTIME * 2); 60 | if( secs < DISPLAYTIME) { 61 | FastLED.setTemperature( TEMPERATURE_1 ); // first temperature 62 | leds[0] = TEMPERATURE_1; // show indicator pixel 63 | } else { 64 | FastLED.setTemperature( TEMPERATURE_2 ); // second temperature 65 | leds[0] = TEMPERATURE_2; // show indicator pixel 66 | } 67 | 68 | // Black out the LEDs for a few secnds between color changes 69 | // to let the eyes and brains adjust 70 | if( (secs % DISPLAYTIME) < BLACKTIME) { 71 | memset8( leds, 0, NUM_LEDS * sizeof(CRGB)); 72 | } 73 | 74 | FastLED.show(); 75 | FastLED.delay(8); 76 | } 77 | 78 | void setup() { 79 | delay( 3000 ); // power-up safety delay 80 | // It's important to set the color correction for your LED strip here, 81 | // so that colors can be more accurately rendered through the 'temperature' profiles 82 | FastLED.addLeds(leds, NUM_LEDS).setCorrection( TypicalSMD5050 ); 83 | FastLED.setBrightness( BRIGHTNESS ); 84 | } 85 | 86 | -------------------------------------------------------------------------------- /libraries/FastLED/examples/Cylon/Cylon.ino: -------------------------------------------------------------------------------- 1 | #include "FastLED.h" 2 | 3 | // How many leds in your strip? 4 | #define NUM_LEDS 64 5 | 6 | // For led chips like Neopixels, which have a data line, ground, and power, you just 7 | // need to define DATA_PIN. For led chipsets that are SPI based (four wires - data, clock, 8 | // ground, and power), like the LPD8806, define both DATA_PIN and CLOCK_PIN 9 | #define DATA_PIN 7 10 | #define CLOCK_PIN 13 11 | 12 | // Define the array of leds 13 | CRGB leds[NUM_LEDS]; 14 | 15 | void setup() { 16 | Serial.begin(57600); 17 | Serial.println("resetting"); 18 | LEDS.addLeds(leds,NUM_LEDS); 19 | LEDS.setBrightness(84); 20 | } 21 | 22 | void fadeall() { for(int i = 0; i < NUM_LEDS; i++) { leds[i].nscale8(250); } } 23 | 24 | void loop() { 25 | static uint8_t hue = 0; 26 | Serial.print("x"); 27 | // First slide the led in one direction 28 | for(int i = 0; i < NUM_LEDS; i++) { 29 | // Set the i'th led to red 30 | leds[i] = CHSV(hue++, 255, 255); 31 | // Show the leds 32 | FastLED.show(); 33 | // now that we've shown the leds, reset the i'th led to black 34 | // leds[i] = CRGB::Black; 35 | fadeall(); 36 | // Wait a little bit before we loop around and do it again 37 | delay(10); 38 | } 39 | Serial.print("x"); 40 | 41 | // Now go in the other direction. 42 | for(int i = (NUM_LEDS)-1; i >= 0; i--) { 43 | // Set the i'th led to red 44 | leds[i] = CHSV(hue++, 255, 255); 45 | // Show the leds 46 | FastLED.show(); 47 | // now that we've shown the leds, reset the i'th led to black 48 | // leds[i] = CRGB::Black; 49 | fadeall(); 50 | // Wait a little bit before we loop around and do it again 51 | delay(10); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /libraries/FastLED/examples/DemoReel100/DemoReel100.ino: -------------------------------------------------------------------------------- 1 | #include "FastLED.h" 2 | 3 | FASTLED_USING_NAMESPACE 4 | 5 | // FastLED "100-lines-of-code" demo reel, showing just a few 6 | // of the kinds of animation patterns you can quickly and easily 7 | // compose using FastLED. 8 | // 9 | // This example also shows one easy way to define multiple 10 | // animations patterns and have them automatically rotate. 11 | // 12 | // -Mark Kriegsman, December 2014 13 | 14 | #if defined(FASTLED_VERSION) && (FASTLED_VERSION < 3001000) 15 | #warning "Requires FastLED 3.1 or later; check github for latest code." 16 | #endif 17 | 18 | #define DATA_PIN 3 19 | //#define CLK_PIN 4 20 | #define LED_TYPE WS2811 21 | #define COLOR_ORDER GRB 22 | #define NUM_LEDS 64 23 | CRGB leds[NUM_LEDS]; 24 | 25 | #define BRIGHTNESS 96 26 | #define FRAMES_PER_SECOND 120 27 | 28 | void setup() { 29 | delay(3000); // 3 second delay for recovery 30 | 31 | // tell FastLED about the LED strip configuration 32 | FastLED.addLeds(leds, NUM_LEDS).setCorrection(TypicalLEDStrip); 33 | //FastLED.addLeds(leds, NUM_LEDS).setCorrection(TypicalLEDStrip); 34 | 35 | // set master brightness control 36 | FastLED.setBrightness(BRIGHTNESS); 37 | } 38 | 39 | 40 | // List of patterns to cycle through. Each is defined as a separate function below. 41 | typedef void (*SimplePatternList[])(); 42 | SimplePatternList gPatterns = { rainbow, rainbowWithGlitter, confetti, sinelon, juggle, bpm }; 43 | 44 | uint8_t gCurrentPatternNumber = 0; // Index number of which pattern is current 45 | uint8_t gHue = 0; // rotating "base color" used by many of the patterns 46 | 47 | void loop() 48 | { 49 | // Call the current pattern function once, updating the 'leds' array 50 | gPatterns[gCurrentPatternNumber](); 51 | 52 | // send the 'leds' array out to the actual LED strip 53 | FastLED.show(); 54 | // insert a delay to keep the framerate modest 55 | FastLED.delay(1000/FRAMES_PER_SECOND); 56 | 57 | // do some periodic updates 58 | EVERY_N_MILLISECONDS( 20 ) { gHue++; } // slowly cycle the "base color" through the rainbow 59 | EVERY_N_SECONDS( 10 ) { nextPattern(); } // change patterns periodically 60 | } 61 | 62 | #define ARRAY_SIZE(A) (sizeof(A) / sizeof((A)[0])) 63 | 64 | void nextPattern() 65 | { 66 | // add one to the current pattern number, and wrap around at the end 67 | gCurrentPatternNumber = (gCurrentPatternNumber + 1) % ARRAY_SIZE( gPatterns); 68 | } 69 | 70 | void rainbow() 71 | { 72 | // FastLED's built-in rainbow generator 73 | fill_rainbow( leds, NUM_LEDS, gHue, 7); 74 | } 75 | 76 | void rainbowWithGlitter() 77 | { 78 | // built-in FastLED rainbow, plus some random sparkly glitter 79 | rainbow(); 80 | addGlitter(80); 81 | } 82 | 83 | void addGlitter( fract8 chanceOfGlitter) 84 | { 85 | if( random8() < chanceOfGlitter) { 86 | leds[ random16(NUM_LEDS) ] += CRGB::White; 87 | } 88 | } 89 | 90 | void confetti() 91 | { 92 | // random colored speckles that blink in and fade smoothly 93 | fadeToBlackBy( leds, NUM_LEDS, 10); 94 | int pos = random16(NUM_LEDS); 95 | leds[pos] += CHSV( gHue + random8(64), 200, 255); 96 | } 97 | 98 | void sinelon() 99 | { 100 | // a colored dot sweeping back and forth, with fading trails 101 | fadeToBlackBy( leds, NUM_LEDS, 20); 102 | int pos = beatsin16(13,0,NUM_LEDS); 103 | leds[pos] += CHSV( gHue, 255, 192); 104 | } 105 | 106 | void bpm() 107 | { 108 | // colored stripes pulsing at a defined Beats-Per-Minute (BPM) 109 | uint8_t BeatsPerMinute = 62; 110 | CRGBPalette16 palette = PartyColors_p; 111 | uint8_t beat = beatsin8( BeatsPerMinute, 64, 255); 112 | for( int i = 0; i < NUM_LEDS; i++) { //9948 113 | leds[i] = ColorFromPalette(palette, gHue+(i*2), beat-gHue+(i*10)); 114 | } 115 | } 116 | 117 | void juggle() { 118 | // eight colored dots, weaving in and out of sync with each other 119 | fadeToBlackBy( leds, NUM_LEDS, 20); 120 | byte dothue = 0; 121 | for( int i = 0; i < 8; i++) { 122 | leds[beatsin16(i+7,0,NUM_LEDS)] |= CHSV(dothue, 200, 255); 123 | dothue += 32; 124 | } 125 | } 126 | 127 | -------------------------------------------------------------------------------- /libraries/FastLED/examples/Fire2012/Fire2012.ino: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #define LED_PIN 5 4 | #define COLOR_ORDER GRB 5 | #define CHIPSET WS2811 6 | #define NUM_LEDS 30 7 | 8 | #define BRIGHTNESS 200 9 | #define FRAMES_PER_SECOND 60 10 | 11 | bool gReverseDirection = false; 12 | 13 | CRGB leds[NUM_LEDS]; 14 | 15 | void setup() { 16 | delay(3000); // sanity delay 17 | FastLED.addLeds(leds, NUM_LEDS).setCorrection( TypicalLEDStrip ); 18 | FastLED.setBrightness( BRIGHTNESS ); 19 | } 20 | 21 | void loop() 22 | { 23 | // Add entropy to random number generator; we use a lot of it. 24 | // random16_add_entropy( random()); 25 | 26 | Fire2012(); // run simulation frame 27 | 28 | FastLED.show(); // display this frame 29 | FastLED.delay(1000 / FRAMES_PER_SECOND); 30 | } 31 | 32 | 33 | // Fire2012 by Mark Kriegsman, July 2012 34 | // as part of "Five Elements" shown here: http://youtu.be/knWiGsmgycY 35 | //// 36 | // This basic one-dimensional 'fire' simulation works roughly as follows: 37 | // There's a underlying array of 'heat' cells, that model the temperature 38 | // at each point along the line. Every cycle through the simulation, 39 | // four steps are performed: 40 | // 1) All cells cool down a little bit, losing heat to the air 41 | // 2) The heat from each cell drifts 'up' and diffuses a little 42 | // 3) Sometimes randomly new 'sparks' of heat are added at the bottom 43 | // 4) The heat from each cell is rendered as a color into the leds array 44 | // The heat-to-color mapping uses a black-body radiation approximation. 45 | // 46 | // Temperature is in arbitrary units from 0 (cold black) to 255 (white hot). 47 | // 48 | // This simulation scales it self a bit depending on NUM_LEDS; it should look 49 | // "OK" on anywhere from 20 to 100 LEDs without too much tweaking. 50 | // 51 | // I recommend running this simulation at anywhere from 30-100 frames per second, 52 | // meaning an interframe delay of about 10-35 milliseconds. 53 | // 54 | // Looks best on a high-density LED setup (60+ pixels/meter). 55 | // 56 | // 57 | // There are two main parameters you can play with to control the look and 58 | // feel of your fire: COOLING (used in step 1 above), and SPARKING (used 59 | // in step 3 above). 60 | // 61 | // COOLING: How much does the air cool as it rises? 62 | // Less cooling = taller flames. More cooling = shorter flames. 63 | // Default 50, suggested range 20-100 64 | #define COOLING 55 65 | 66 | // SPARKING: What chance (out of 255) is there that a new spark will be lit? 67 | // Higher chance = more roaring fire. Lower chance = more flickery fire. 68 | // Default 120, suggested range 50-200. 69 | #define SPARKING 120 70 | 71 | 72 | void Fire2012() 73 | { 74 | // Array of temperature readings at each simulation cell 75 | static byte heat[NUM_LEDS]; 76 | 77 | // Step 1. Cool down every cell a little 78 | for( int i = 0; i < NUM_LEDS; i++) { 79 | heat[i] = qsub8( heat[i], random8(0, ((COOLING * 10) / NUM_LEDS) + 2)); 80 | } 81 | 82 | // Step 2. Heat from each cell drifts 'up' and diffuses a little 83 | for( int k= NUM_LEDS - 1; k >= 2; k--) { 84 | heat[k] = (heat[k - 1] + heat[k - 2] + heat[k - 2] ) / 3; 85 | } 86 | 87 | // Step 3. Randomly ignite new 'sparks' of heat near the bottom 88 | if( random8() < SPARKING ) { 89 | int y = random8(7); 90 | heat[y] = qadd8( heat[y], random8(160,255) ); 91 | } 92 | 93 | // Step 4. Map from heat cells to LED colors 94 | for( int j = 0; j < NUM_LEDS; j++) { 95 | CRGB color = HeatColor( heat[j]); 96 | int pixelnumber; 97 | if( gReverseDirection ) { 98 | pixelnumber = (NUM_LEDS-1) - j; 99 | } else { 100 | pixelnumber = j; 101 | } 102 | leds[pixelnumber] = color; 103 | } 104 | } 105 | 106 | -------------------------------------------------------------------------------- /libraries/FastLED/examples/FirstLight/FirstLight.ino: -------------------------------------------------------------------------------- 1 | // Use if you want to force the software SPI subsystem to be used for some reason (generally, you don't) 2 | // #define FASTLED_FORCE_SOFTWARE_SPI 3 | // Use if you want to force non-accelerated pin access (hint: you really don't, it breaks lots of things) 4 | // #define FASTLED_FORCE_SOFTWARE_SPI 5 | // #define FASTLED_FORCE_SOFTWARE_PINS 6 | #include "FastLED.h" 7 | 8 | /////////////////////////////////////////////////////////////////////////////////////////// 9 | // 10 | // Move a white dot along the strip of leds. This program simply shows how to configure the leds, 11 | // and then how to turn a single pixel white and then off, moving down the line of pixels. 12 | // 13 | 14 | // How many leds are in the strip? 15 | #define NUM_LEDS 60 16 | 17 | // Data pin that led data will be written out over 18 | #define DATA_PIN 3 19 | 20 | // Clock pin only needed for SPI based chipsets when not using hardware SPI 21 | //#define CLOCK_PIN 8 22 | 23 | // This is an array of leds. One item for each led in your strip. 24 | CRGB leds[NUM_LEDS]; 25 | 26 | // This function sets up the ledsand tells the controller about them 27 | void setup() { 28 | // sanity check delay - allows reprogramming if accidently blowing power w/leds 29 | delay(2000); 30 | 31 | // Uncomment one of the following lines for your leds arrangement. 32 | // FastLED.addLeds(leds, NUM_LEDS); 33 | // FastLED.addLeds(leds, NUM_LEDS); 34 | // FastLED.addLeds(leds, NUM_LEDS); 35 | FastLED.addLeds(leds, NUM_LEDS); 36 | // FastLED.addLeds(leds, NUM_LEDS); 37 | // FastLED.addLeds(leds, NUM_LEDS); 38 | // FastLED.addLeds(leds, NUM_LEDS); 39 | // FastLED.addLeds(leds, NUM_LEDS); 40 | // FastLED.addLeds(leds, NUM_LEDS); 41 | // FastLED.addLeds(leds, NUM_LEDS); 42 | // FastLED.addLeds(leds, NUM_LEDS); 43 | // FastLED.addLeds(leds, NUM_LEDS); 44 | // FastLED.addLeds(leds, NUM_LEDS); 45 | 46 | // FastLED.addLeds(leds, NUM_LEDS); 47 | // FastLED.addLeds(leds, NUM_LEDS); 48 | // FastLED.addLeds(leds, NUM_LEDS); 49 | // FastLED.addLeds(leds, NUM_LEDS); 50 | // FastLED.addLeds(leds, NUM_LEDS); 51 | // FastLED.addLeds(leds, NUM_LEDS); 52 | 53 | // FastLED.addLeds(leds, NUM_LEDS); 54 | // FastLED.addLeds(leds, NUM_LEDS); 55 | // FastLED.addLeds(leds, NUM_LEDS); 56 | // FastLED.addLeds(leds, NUM_LEDS); 57 | // FastLED.addLeds(leds, NUM_LEDS); 58 | // FastLED.addLeds(leds, NUM_LEDS); 59 | } 60 | 61 | // This function runs over and over, and is where you do the magic to light 62 | // your leds. 63 | void loop() { 64 | // Move a single white led 65 | for(int whiteLed = 0; whiteLed < NUM_LEDS; whiteLed = whiteLed + 1) { 66 | // Turn our current led on to white, then show the leds 67 | leds[whiteLed] = CRGB::White; 68 | 69 | // Show the leds (only one of which is set to white, from above) 70 | FastLED.show(); 71 | 72 | // Wait a little bit 73 | delay(100); 74 | 75 | // Turn our current led back to black for the next loop around 76 | leds[whiteLed] = CRGB::Black; 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /libraries/FastLED/examples/Multiple/ArrayOfLedArrays/ArrayOfLedArrays.ino: -------------------------------------------------------------------------------- 1 | // ArrayOfLedArrays - see https://github.com/FastLED/FastLED/wiki/Multiple-Controller-Examples for more info on 2 | // using multiple controllers. In this example, we're going to set up four NEOPIXEL strips on three 3 | // different pins, each strip getting its own CRGB array to be played with, only this time they're going 4 | // to be all parts of an array of arrays. 5 | 6 | #include "FastLED.h" 7 | 8 | #define NUM_STRIPS 3 9 | #define NUM_LEDS_PER_STRIP 60 10 | CRGB leds[NUM_STRIPS][NUM_LEDS_PER_STRIP]; 11 | 12 | // For mirroring strips, all the "special" stuff happens just in setup. We 13 | // just addLeds multiple times, once for each strip 14 | void setup() { 15 | // tell FastLED there's 60 NEOPIXEL leds on pin 10 16 | FastLED.addLeds(leds[0], NUM_LEDS_PER_STRIP); 17 | 18 | // tell FastLED there's 60 NEOPIXEL leds on pin 11 19 | FastLED.addLeds(leds[1], NUM_LEDS_PER_STRIP); 20 | 21 | // tell FastLED there's 60 NEOPIXEL leds on pin 12 22 | FastLED.addLeds(leds[2], NUM_LEDS_PER_STRIP); 23 | 24 | } 25 | 26 | void loop() { 27 | // This outer loop will go over each strip, one at a time 28 | for(int x = 0; x < NUM_STRIPS; x++) { 29 | // This inner loop will go over each led in the current strip, one at a time 30 | for(int i = 0; i < NUM_LEDS_PER_STRIP; i++) { 31 | leds[x][i] = CRGB::Red; 32 | FastLED.show(); 33 | leds[x][i] = CRGB::Black; 34 | delay(100); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /libraries/FastLED/examples/Multiple/MirroringSample/MirroringSample.ino: -------------------------------------------------------------------------------- 1 | // MirroringSample - see https://github.com/FastLED/FastLED/wiki/Multiple-Controller-Examples for more info on 2 | // using multiple controllers. In this example, we're going to set up four NEOPIXEL strips on four 3 | // different pins, and show the same thing on all four of them, a simple bouncing dot/cyclon type pattern 4 | 5 | #include "FastLED.h" 6 | 7 | #define NUM_LEDS_PER_STRIP 60 8 | CRGB leds[NUM_LEDS_PER_STRIP]; 9 | 10 | // For mirroring strips, all the "special" stuff happens just in setup. We 11 | // just addLeds multiple times, once for each strip 12 | void setup() { 13 | // tell FastLED there's 60 NEOPIXEL leds on pin 4 14 | FastLED.addLeds(leds, NUM_LEDS_PER_STRIP); 15 | 16 | // tell FastLED there's 60 NEOPIXEL leds on pin 5 17 | FastLED.addLeds(leds, NUM_LEDS_PER_STRIP); 18 | 19 | // tell FastLED there's 60 NEOPIXEL leds on pin 6 20 | FastLED.addLeds(leds, NUM_LEDS_PER_STRIP); 21 | 22 | // tell FastLED there's 60 NEOPIXEL leds on pin 7 23 | FastLED.addLeds(leds, NUM_LEDS_PER_STRIP); 24 | } 25 | 26 | void loop() { 27 | for(int i = 0; i < NUM_LEDS_PER_STRIP; i++) { 28 | // set our current dot to red 29 | leds[i] = CRGB::Red; 30 | FastLED.show(); 31 | // clear our current dot before we move on 32 | leds[i] = CRGB::Black; 33 | delay(100); 34 | } 35 | 36 | for(int i = NUM_LEDS_PER_STRIP-1; i >= 0; i--) { 37 | // set our current dot to red 38 | leds[i] = CRGB::Red; 39 | FastLED.show(); 40 | // clear our current dot before we move on 41 | leds[i] = CRGB::Black; 42 | delay(100); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /libraries/FastLED/examples/Multiple/MultiArrays/MultiArrays.ino: -------------------------------------------------------------------------------- 1 | // MultiArrays - see https://github.com/FastLED/FastLED/wiki/Multiple-Controller-Examples for more info on 2 | // using multiple controllers. In this example, we're going to set up four NEOPIXEL strips on three 3 | // different pins, each strip getting its own CRGB array to be played with 4 | 5 | #include "FastLED.h" 6 | 7 | #define NUM_LEDS_PER_STRIP 60 8 | CRGB redLeds[NUM_LEDS_PER_STRIP]; 9 | CRGB greenLeds[NUM_LEDS_PER_STRIP]; 10 | CRGB blueLeds[NUM_LEDS_PER_STRIP]; 11 | 12 | // For mirroring strips, all the "special" stuff happens just in setup. We 13 | // just addLeds multiple times, once for each strip 14 | void setup() { 15 | // tell FastLED there's 60 NEOPIXEL leds on pin 10 16 | FastLED.addLeds(redLeds, NUM_LEDS_PER_STRIP); 17 | 18 | // tell FastLED there's 60 NEOPIXEL leds on pin 11 19 | FastLED.addLeds(greenLeds, NUM_LEDS_PER_STRIP); 20 | 21 | // tell FastLED there's 60 NEOPIXEL leds on pin 12 22 | FastLED.addLeds(blueLeds, NUM_LEDS_PER_STRIP); 23 | 24 | } 25 | 26 | void loop() { 27 | for(int i = 0; i < NUM_LEDS_PER_STRIP; i++) { 28 | // set our current dot to red, green, and blue 29 | redLeds[i] = CRGB::Red; 30 | greenLeds[i] = CRGB::Green; 31 | blueLeds[i] = CRGB::Blue; 32 | FastLED.show(); 33 | // clear our current dot before we move on 34 | redLeds[i] = CRGB::Black; 35 | greenLeds[i] = CRGB::Black; 36 | blueLeds[i] = CRGB::Blue; 37 | delay(100); 38 | } 39 | 40 | for(int i = NUM_LEDS_PER_STRIP-1; i >= 0; i--) { 41 | // set our current dot to red, green, and blue 42 | redLeds[i] = CRGB::Red; 43 | greenLeds[i] = CRGB::Green; 44 | blueLeds[i] = CRGB::Blue; 45 | FastLED.show(); 46 | // clear our current dot before we move on 47 | redLeds[i] = CRGB::Black; 48 | greenLeds[i] = CRGB::Black; 49 | blueLeds[i] = CRGB::Blue; 50 | delay(100); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /libraries/FastLED/examples/Multiple/MultipleStripsInOneArray/MultipleStripsInOneArray.ino: -------------------------------------------------------------------------------- 1 | // MultipleStripsInOneArray - see https://github.com/FastLED/FastLED/wiki/Multiple-Controller-Examples for more info on 2 | // using multiple controllers. In this example, we're going to set up four NEOPIXEL strips on three 3 | // different pins, each strip will be referring to a different part of the single led array 4 | 5 | #include "FastLED.h" 6 | 7 | #define NUM_STRIPS 3 8 | #define NUM_LEDS_PER_STRIP 60 9 | #define NUM_LEDS NUM_LEDS_PER_STRIP * NUM_STRIPS 10 | 11 | CRGB leds[NUM_STRIPS * NUM_LEDS_PER_STRIP]; 12 | 13 | // For mirroring strips, all the "special" stuff happens just in setup. We 14 | // just addLeds multiple times, once for each strip 15 | void setup() { 16 | // tell FastLED there's 60 NEOPIXEL leds on pin 10, starting at index 0 in the led array 17 | FastLED.addLeds(leds, 0, NUM_LEDS_PER_STRIP); 18 | 19 | // tell FastLED there's 60 NEOPIXEL leds on pin 11, starting at index 60 in the led array 20 | FastLED.addLeds(leds, NUM_LEDS_PER_STRIP, NUM_LEDS_PER_STRIP); 21 | 22 | // tell FastLED there's 60 NEOPIXEL leds on pin 12, starting at index 120 in the led array 23 | FastLED.addLeds(leds, 2 * NUM_LEDS_PER_STRIP, NUM_LEDS_PER_STRIP); 24 | 25 | } 26 | 27 | void loop() { 28 | for(int i = 0; i < NUM_LEDS; i++) { 29 | leds[i] = CRGB::Red; 30 | FastLED.show(); 31 | leds[i] = CRGB::Black; 32 | delay(100); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /libraries/FastLED/examples/Multiple/OctoWS2811Demo/OctoWS2811Demo.ino: -------------------------------------------------------------------------------- 1 | #define USE_OCTOWS2811 2 | #include 3 | #include 4 | 5 | #define NUM_LEDS_PER_STRIP 64 6 | #define NUM_STRIPS 8 7 | 8 | CRGB leds[NUM_STRIPS * NUM_LEDS_PER_STRIP]; 9 | 10 | // Pin layouts on the teensy 3: 11 | // OctoWS2811: 2,14,7,8,6,20,21,5 12 | 13 | void setup() { 14 | LEDS.addLeds(leds, NUM_LEDS_PER_STRIP); 15 | LEDS.setBrightness(32); 16 | } 17 | 18 | void loop() { 19 | static uint8_t hue = 0; 20 | for(int i = 0; i < NUM_STRIPS; i++) { 21 | for(int j = 0; j < NUM_LEDS_PER_STRIP; j++) { 22 | leds[(i*NUM_LEDS_PER_STRIP) + j] = CHSV((32*i) + hue+j,192,255); 23 | } 24 | } 25 | 26 | // Set the first n leds on each strip to show which strip it is 27 | for(int i = 0; i < NUM_STRIPS; i++) { 28 | for(int j = 0; j <= i; j++) { 29 | leds[(i*NUM_LEDS_PER_STRIP) + j] = CRGB::Red; 30 | } 31 | } 32 | 33 | hue++; 34 | 35 | LEDS.show(); 36 | LEDS.delay(10); 37 | } 38 | -------------------------------------------------------------------------------- /libraries/FastLED/examples/Multiple/ParallelOutputDemo/ParallelOutputDemo.ino: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #define NUM_LEDS_PER_STRIP 64 4 | // Note: this can be 12 if you're using a teensy 3 and don't mind soldering the pads on the back 5 | #define NUM_STRIPS 16 6 | 7 | CRGB leds[NUM_STRIPS * NUM_LEDS_PER_STRIP]; 8 | 9 | // Pin layouts on the teensy 3/3.1: 10 | // WS2811_PORTD: 2,14,7,8,6,20,21,5 11 | // WS2811_PORTC: 15,22,23,9,10,13,11,12,28,27,29,30 (these last 4 are pads on the bottom of the teensy) 12 | // WS2811_PORTDC: 2,14,7,8,6,20,21,5,15,22,23,9,10,13,11,12 - 16 way parallel 13 | // 14 | // Pin layouts on the due 15 | // WS2811_PORTA: 69,68,61,60,59,100,58,31 (note: pin 100 only available on the digix) 16 | // WS2811_PORTB: 90,91,92,93,94,95,96,97 (note: only available on the digix) 17 | // WS2811_PORTD: 25,26,27,28,14,15,29,11 18 | // 19 | 20 | void setup() { 21 | // LEDS.addLeds(leds, NUM_LEDS_PER_STRIP); 22 | // LEDS.addLeds(leds, NUM_LEDS_PER_STRIP); 23 | // LEDS.addLeds(leds, NUM_LEDS_PER_STRIP).setCorrection(TypicalLEDStrip); 24 | LEDS.addLeds(leds, NUM_LEDS_PER_STRIP); 25 | LEDS.setBrightness(32); 26 | } 27 | 28 | void loop() { 29 | static uint8_t hue = 0; 30 | for(int i = 0; i < NUM_STRIPS; i++) { 31 | for(int j = 0; j < NUM_LEDS_PER_STRIP; j++) { 32 | leds[(i*NUM_LEDS_PER_STRIP) + j] = CHSV((32*i) + hue+j,192,255); 33 | } 34 | } 35 | 36 | // Set the first n leds on each strip to show which strip it is 37 | for(int i = 0; i < NUM_STRIPS; i++) { 38 | for(int j = 0; j <= i; j++) { 39 | leds[(i*NUM_LEDS_PER_STRIP) + j] = CRGB::Red; 40 | } 41 | } 42 | 43 | hue++; 44 | 45 | LEDS.show(); 46 | LEDS.delay(10); 47 | } 48 | -------------------------------------------------------------------------------- /libraries/FastLED/examples/Noise/Noise.ino: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | // 4 | // Mark's xy coordinate mapping code. See the XYMatrix for more information on it. 5 | // 6 | 7 | // Params for width and height 8 | const uint8_t kMatrixWidth = 16; 9 | const uint8_t kMatrixHeight = 16; 10 | #define MAX_DIMENSION ((kMatrixWidth>kMatrixHeight) ? kMatrixWidth : kMatrixHeight) 11 | #define NUM_LEDS (kMatrixWidth * kMatrixHeight) 12 | // Param for different pixel layouts 13 | const bool kMatrixSerpentineLayout = true; 14 | 15 | 16 | uint16_t XY( uint8_t x, uint8_t y) 17 | { 18 | uint16_t i; 19 | 20 | if( kMatrixSerpentineLayout == false) { 21 | i = (y * kMatrixWidth) + x; 22 | } 23 | 24 | if( kMatrixSerpentineLayout == true) { 25 | if( y & 0x01) { 26 | // Odd rows run backwards 27 | uint8_t reverseX = (kMatrixWidth - 1) - x; 28 | i = (y * kMatrixWidth) + reverseX; 29 | } else { 30 | // Even rows run forwards 31 | i = (y * kMatrixWidth) + x; 32 | } 33 | } 34 | 35 | return i; 36 | } 37 | 38 | // The leds 39 | CRGB leds[kMatrixWidth * kMatrixHeight]; 40 | 41 | // The 32bit version of our coordinates 42 | static uint16_t x; 43 | static uint16_t y; 44 | static uint16_t z; 45 | 46 | // We're using the x/y dimensions to map to the x/y pixels on the matrix. We'll 47 | // use the z-axis for "time". speed determines how fast time moves forward. Try 48 | // 1 for a very slow moving effect, or 60 for something that ends up looking like 49 | // water. 50 | // uint16_t speed = 1; // almost looks like a painting, moves very slowly 51 | uint16_t speed = 20; // a nice starting speed, mixes well with a scale of 100 52 | // uint16_t speed = 33; 53 | // uint16_t speed = 100; // wicked fast! 54 | 55 | // Scale determines how far apart the pixels in our noise matrix are. Try 56 | // changing these values around to see how it affects the motion of the display. The 57 | // higher the value of scale, the more "zoomed out" the noise iwll be. A value 58 | // of 1 will be so zoomed in, you'll mostly see solid colors. 59 | 60 | // uint16_t scale = 1; // mostly just solid colors 61 | // uint16_t scale = 4011; // very zoomed out and shimmery 62 | uint16_t scale = 311; 63 | 64 | // This is the array that we keep our computed noise values in 65 | uint8_t noise[MAX_DIMENSION][MAX_DIMENSION]; 66 | 67 | void setup() { 68 | // uncomment the following lines if you want to see FPS count information 69 | // Serial.begin(38400); 70 | // Serial.println("resetting!"); 71 | delay(3000); 72 | LEDS.addLeds(leds,NUM_LEDS); 73 | LEDS.setBrightness(96); 74 | 75 | // Initialize our coordinates to some random values 76 | x = random16(); 77 | y = random16(); 78 | z = random16(); 79 | } 80 | 81 | // Fill the x/y array of 8-bit noise values using the inoise8 function. 82 | void fillnoise8() { 83 | for(int i = 0; i < MAX_DIMENSION; i++) { 84 | int ioffset = scale * i; 85 | for(int j = 0; j < MAX_DIMENSION; j++) { 86 | int joffset = scale * j; 87 | noise[i][j] = inoise8(x + ioffset,y + joffset,z); 88 | } 89 | } 90 | z += speed; 91 | } 92 | 93 | 94 | void loop() { 95 | static uint8_t ihue=0; 96 | fillnoise8(); 97 | for(int i = 0; i < kMatrixWidth; i++) { 98 | for(int j = 0; j < kMatrixHeight; j++) { 99 | // We use the value at the (i,j) coordinate in the noise 100 | // array for our brightness, and the flipped value from (j,i) 101 | // for our pixel's hue. 102 | leds[XY(i,j)] = CHSV(noise[j][i],255,noise[i][j]); 103 | 104 | // You can also explore other ways to constrain the hue used, like below 105 | // leds[XY(i,j)] = CHSV(ihue + (noise[j][i]>>2),255,noise[i][j]); 106 | } 107 | } 108 | ihue+=1; 109 | 110 | LEDS.show(); 111 | // delay(10); 112 | } 113 | -------------------------------------------------------------------------------- /libraries/FastLED/examples/NoisePlayground/NoisePlayground.ino: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #define kMatrixWidth 16 4 | #define kMatrixHeight 16 5 | 6 | #define NUM_LEDS (kMatrixWidth * kMatrixHeight) 7 | // Param for different pixel layouts 8 | #define kMatrixSerpentineLayout true 9 | 10 | // led array 11 | CRGB leds[kMatrixWidth * kMatrixHeight]; 12 | 13 | // x,y, & time values 14 | uint32_t x,y,v_time,hue_time,hxy; 15 | 16 | // Play with the values of the variables below and see what kinds of effects they 17 | // have! More octaves will make things slower. 18 | 19 | // how many octaves to use for the brightness and hue functions 20 | uint8_t octaves=1; 21 | uint8_t hue_octaves=3; 22 | 23 | // the 'distance' between points on the x and y axis 24 | int xscale=57771; 25 | int yscale=57771; 26 | 27 | // the 'distance' between x/y points for the hue noise 28 | int hue_scale=1; 29 | 30 | // how fast we move through time & hue noise 31 | int time_speed=1111; 32 | int hue_speed=31; 33 | 34 | // adjust these values to move along the x or y axis between frames 35 | int x_speed=331; 36 | int y_speed=1111; 37 | 38 | void loop() { 39 | // fill the led array 2/16-bit noise values 40 | fill_2dnoise16(LEDS.leds(), kMatrixWidth, kMatrixHeight, kMatrixSerpentineLayout, 41 | octaves,x,xscale,y,yscale,v_time, 42 | hue_octaves,hxy,hue_scale,hxy,hue_scale,hue_time, false); 43 | 44 | LEDS.show(); 45 | 46 | // adjust the intra-frame time values 47 | x += x_speed; 48 | y += y_speed; 49 | v_time += time_speed; 50 | hue_time += hue_speed; 51 | // delay(50); 52 | } 53 | 54 | 55 | void setup() { 56 | // initialize the x/y and time values 57 | random16_set_seed(8934); 58 | random16_add_entropy(analogRead(3)); 59 | 60 | Serial.begin(57600); 61 | Serial.println("resetting!"); 62 | 63 | delay(3000); 64 | LEDS.addLeds(leds,NUM_LEDS); 65 | LEDS.setBrightness(96); 66 | 67 | hxy = (uint32_t)((uint32_t)random16() << 16) + (uint32_t)random16(); 68 | x = (uint32_t)((uint32_t)random16() << 16) + (uint32_t)random16(); 69 | y = (uint32_t)((uint32_t)random16() << 16) + (uint32_t)random16(); 70 | v_time = (uint32_t)((uint32_t)random16() << 16) + (uint32_t)random16(); 71 | hue_time = (uint32_t)((uint32_t)random16() << 16) + (uint32_t)random16(); 72 | 73 | } 74 | -------------------------------------------------------------------------------- /libraries/FastLED/examples/Pintest/Pintest.ino: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | const char *getPort(void *portPtr) { 5 | #ifdef PORTA 6 | if(portPtr == (void*)&PORTA) { return "PORTA"; } 7 | #endif 8 | #ifdef PORTB 9 | if(portPtr == (void*)&PORTB) { return "PORTB"; } 10 | #endif 11 | #ifdef PORTC 12 | if(portPtr == (void*)&PORTC) { return "PORTC"; } 13 | #endif 14 | #ifdef PORTD 15 | if(portPtr == (void*)&PORTD) { return "PORTD"; } 16 | #endif 17 | #ifdef PORTE 18 | if(portPtr == (void*)&PORTE) { return "PORTE"; } 19 | #endif 20 | #ifdef PORTF 21 | if(portPtr == (void*)&PORTF) { return "PORTF"; } 22 | #endif 23 | #ifdef PORTG 24 | if(portPtr == (void*)&PORTG) { return "PORTG"; } 25 | #endif 26 | #ifdef PORTH 27 | if(portPtr == (void*)&PORTH) { return "PORTH"; } 28 | #endif 29 | #ifdef PORTI 30 | if(portPtr == (void*)&PORTI) { return "PORTI"; } 31 | #endif 32 | #ifdef PORTJ 33 | if(portPtr == (void*)&PORTJ) { return "PORTJ"; } 34 | #endif 35 | #ifdef PORTK 36 | if(portPtr == (void*)&PORTK) { return "PORTK"; } 37 | #endif 38 | #ifdef PORTL 39 | if(portPtr == (void*)&PORTL) { return "PORTL"; } 40 | #endif 41 | #ifdef GPIO_A_PDOR 42 | if(portPtr == (void*)&GPIO_A_PDOR) { return "GPIO_A_PDOR"; } 43 | #endif 44 | #ifdef GPIO_B_PDOR 45 | if(portPtr == (void*)&GPIO_B_PDOR) { return "GPIO_B_PDOR"; } 46 | #endif 47 | #ifdef GPIO_C_PDOR 48 | if(portPtr == (void*)&GPIO_C_PDOR) { return "GPIO_C_PDOR"; } 49 | #endif 50 | #ifdef GPIO_D_PDOR 51 | if(portPtr == (void*)&GPIO_D_PDOR) { return "GPIO_D_PDOR"; } 52 | #endif 53 | #ifdef GPIO_E_PDOR 54 | if(portPtr == (void*)&GPIO_E_PDOR) { return "GPIO_E_PDOR"; } 55 | #endif 56 | #ifdef REG_PIO_A_ODSR 57 | if(portPtr == (void*)®_PIO_A_ODSR) { return "REG_PIO_A_ODSR"; } 58 | #endif 59 | #ifdef REG_PIO_B_ODSR 60 | if(portPtr == (void*)®_PIO_B_ODSR) { return "REG_PIO_B_ODSR"; } 61 | #endif 62 | #ifdef REG_PIO_C_ODSR 63 | if(portPtr == (void*)®_PIO_C_ODSR) { return "REG_PIO_C_ODSR"; } 64 | #endif 65 | #ifdef REG_PIO_D_ODSR 66 | if(portPtr == (void*)®_PIO_D_ODSR) { return "REG_PIO_D_ODSR"; } 67 | #endif 68 | return "unknown"; 69 | } 70 | 71 | template void CheckPin() 72 | { 73 | CheckPin(); 74 | 75 | RwReg *systemThinksPortIs = portOutputRegister(digitalPinToPort(PIN)); 76 | RwReg systemThinksMaskIs = digitalPinToBitMask(PIN); 77 | 78 | Serial.print("Pin "); Serial.print(PIN); Serial.print(": Port "); 79 | 80 | if(systemThinksPortIs == FastPin::port()) { 81 | Serial.print("valid & mask "); 82 | } else { 83 | Serial.print("invalid, is "); Serial.print(getPort((void*)FastPin::port())); Serial.print(" should be "); 84 | Serial.print(getPort((void*)systemThinksPortIs)); 85 | Serial.print(" & mask "); 86 | } 87 | 88 | if(systemThinksMaskIs == FastPin::mask()) { 89 | Serial.println("valid."); 90 | } else { 91 | Serial.print("invalid, is "); Serial.print(FastPin::mask()); Serial.print(" should be "); Serial.println(systemThinksMaskIs); 92 | } 93 | } 94 | 95 | template<> void CheckPin<-1> () {} 96 | 97 | void setup() { 98 | Serial.begin(38400); 99 | Serial.println("resetting!"); 100 | } 101 | 102 | void loop() { 103 | CheckPin(); 104 | delay(10000); 105 | } -------------------------------------------------------------------------------- /libraries/FastLED/examples/Ports/PJRCSpectrumAnalyzer/PJRCSpectrumAnalyzer.ino: -------------------------------------------------------------------------------- 1 | // LED Audio Spectrum Analyzer Display 2 | // 3 | // Creates an impressive LED light show to music input 4 | // using Teensy 3.1 with the OctoWS2811 adaptor board 5 | // http://www.pjrc.com/store/teensy31.html 6 | // http://www.pjrc.com/store/octo28_adaptor.html 7 | // 8 | // Line Level Audio Input connects to analog pin A3 9 | // Recommended input circuit: 10 | // http://www.pjrc.com/teensy/gui/?info=AudioInputAnalog 11 | // 12 | // This example code is in the public domain. 13 | 14 | #define USE_OCTOWS2811 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | 22 | // The display size and color to use 23 | const unsigned int matrix_width = 60; 24 | const unsigned int matrix_height = 32; 25 | const unsigned int myColor = 0x400020; 26 | 27 | // These parameters adjust the vertical thresholds 28 | const float maxLevel = 0.5; // 1.0 = max, lower is more "sensitive" 29 | const float dynamicRange = 40.0; // total range to display, in decibels 30 | const float linearBlend = 0.3; // useful range is 0 to 0.7 31 | 32 | CRGB leds[matrix_width * matrix_height]; 33 | 34 | // Audio library objects 35 | AudioInputAnalog adc1(A3); //xy=99,55 36 | AudioAnalyzeFFT1024 fft; //xy=265,75 37 | AudioConnection patchCord1(adc1, fft); 38 | 39 | 40 | // This array holds the volume level (0 to 1.0) for each 41 | // vertical pixel to turn on. Computed in setup() using 42 | // the 3 parameters above. 43 | float thresholdVertical[matrix_height]; 44 | 45 | // This array specifies how many of the FFT frequency bin 46 | // to use for each horizontal pixel. Because humans hear 47 | // in octaves and FFT bins are linear, the low frequencies 48 | // use a small number of bins, higher frequencies use more. 49 | int frequencyBinsHorizontal[matrix_width] = { 50 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 51 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 52 | 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 53 | 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 54 | 9, 9, 10, 10, 11, 12, 12, 13, 14, 15, 55 | 15, 16, 17, 18, 19, 20, 22, 23, 24, 25 56 | }; 57 | 58 | 59 | 60 | // Run setup once 61 | void setup() { 62 | // the audio library needs to be given memory to start working 63 | AudioMemory(12); 64 | 65 | // compute the vertical thresholds before starting 66 | computeVerticalLevels(); 67 | 68 | // turn on the display 69 | FastLED.addLeds(leds,(matrix_width * matrix_height) / 8); 70 | } 71 | 72 | // A simple xy() function to turn display matrix coordinates 73 | // into the index numbers OctoWS2811 requires. If your LEDs 74 | // are arranged differently, edit this code... 75 | unsigned int xy(unsigned int x, unsigned int y) { 76 | if ((y & 1) == 0) { 77 | // even numbered rows (0, 2, 4...) are left to right 78 | return y * matrix_width + x; 79 | } else { 80 | // odd numbered rows (1, 3, 5...) are right to left 81 | return y * matrix_width + matrix_width - 1 - x; 82 | } 83 | } 84 | 85 | // Run repetitively 86 | void loop() { 87 | unsigned int x, y, freqBin; 88 | float level; 89 | 90 | if (fft.available()) { 91 | // freqBin counts which FFT frequency data has been used, 92 | // starting at low frequency 93 | freqBin = 0; 94 | 95 | for (x=0; x < matrix_width; x++) { 96 | // get the volume for each horizontal pixel position 97 | level = fft.read(freqBin, freqBin + frequencyBinsHorizontal[x] - 1); 98 | 99 | // uncomment to see the spectrum in Arduino's Serial Monitor 100 | // Serial.print(level); 101 | // Serial.print(" "); 102 | 103 | for (y=0; y < matrix_height; y++) { 104 | // for each vertical pixel, check if above the threshold 105 | // and turn the LED on or off 106 | if (level >= thresholdVertical[y]) { 107 | leds[xy(x,y)] = CRGB(myColor); 108 | } else { 109 | leds[xy(x,y)] = CRGB::Black; 110 | } 111 | } 112 | // increment the frequency bin count, so we display 113 | // low to higher frequency from left to right 114 | freqBin = freqBin + frequencyBinsHorizontal[x]; 115 | } 116 | // after all pixels set, show them all at the same instant 117 | FastLED.show(); 118 | // Serial.println(); 119 | } 120 | } 121 | 122 | 123 | // Run once from setup, the compute the vertical levels 124 | void computeVerticalLevels() { 125 | unsigned int y; 126 | float n, logLevel, linearLevel; 127 | 128 | for (y=0; y < matrix_height; y++) { 129 | n = (float)y / (float)(matrix_height - 1); 130 | logLevel = pow10f(n * -1.0 * (dynamicRange / 20.0)); 131 | linearLevel = 1.0 - n; 132 | linearLevel = linearLevel * linearBlend; 133 | logLevel = logLevel * (1.0 - linearBlend); 134 | thresholdVertical[y] = (logLevel + linearLevel) * maxLevel; 135 | } 136 | } 137 | -------------------------------------------------------------------------------- /libraries/FastLED/examples/RGBCalibrate/RGBCalibrate.ino: -------------------------------------------------------------------------------- 1 | #include "FastLED.h" 2 | 3 | 4 | //////////////////////////////////////////////////////////////////////////////////////////////////// 5 | // 6 | // RGB Calibration code 7 | // 8 | // Use this sketch to determine what the RGB ordering for your chipset should be. Steps for setting up to use: 9 | 10 | // * Uncomment the line in setup that corresponds to the LED chipset that you are using. (Note that they 11 | // all explicitly specify the RGB order as RGB) 12 | // * Define DATA_PIN to the pin that data is connected to. 13 | // * (Optional) if using software SPI for chipsets that are SPI based, define CLOCK_PIN to the clock pin 14 | // * Compile/upload/run the sketch 15 | 16 | // You should see six leds on. If the RGB ordering is correct, you should see 1 red led, 2 green 17 | // leds, and 3 blue leds. If you see different colors, the count of each color tells you what the 18 | // position for that color in the rgb orering should be. So, for example, if you see 1 Blue, and 2 19 | // Red, and 3 Green leds then the rgb ordering should be BRG (Blue, Red, Green). 20 | 21 | // You can then test this ordering by setting the RGB ordering in the addLeds line below to the new ordering 22 | // and it should come out correctly, 1 red, 2 green, and 3 blue. 23 | // 24 | ////////////////////////////////////////////////// 25 | 26 | #define NUM_LEDS 6 27 | 28 | // Data pin that led data will be written out over 29 | #define DATA_PIN 6 30 | // Clock pin only needed for SPI based chipsets when not using hardware SPI 31 | //#define CLOCK_PIN 8 32 | 33 | CRGB leds[NUM_LEDS]; 34 | 35 | void setup() { 36 | // sanity check delay - allows reprogramming if accidently blowing power w/leds 37 | delay(2000); 38 | 39 | // Uncomment one of the following lines for your leds arrangement. 40 | // FastLED.addLeds(leds, NUM_LEDS); 41 | // FastLED.addLeds(leds, NUM_LEDS); 42 | // FastLED.addLeds(leds, NUM_LEDS); 43 | // FastLED.addLeds(leds, NUM_LEDS); 44 | // FastLED.addLeds(leds, NUM_LEDS); 45 | // FastLED.addLeds(leds, NUM_LEDS); 46 | // FastLED.setBrightness(CRGB(255,255,255)); 47 | // FastLED.addLeds(leds, NUM_LEDS); 48 | // FastLED.addLeds(leds, NUM_LEDS); 49 | // FastLED.addLeds(leds, NUM_LEDS); 50 | // FastLED.addLeds(leds, NUM_LEDS); 51 | 52 | // FastLED.addLeds(leds, NUM_LEDS); 53 | // FastLED.addLeds(leds, NUM_LEDS); 54 | FastLED.addLeds(leds, NUM_LEDS); 55 | 56 | // FastLED.addLeds(leds, NUM_LEDS); 57 | // FastLED.addLeds(leds, NUM_LEDS); 58 | // FastLED.addLeds(leds, NUM_LEDS); 59 | } 60 | 61 | void loop() { 62 | leds[0] = CRGB(255,0,0); 63 | leds[1] = CRGB(0,255,0); 64 | leds[2] = CRGB(0,255,0); 65 | leds[3] = CRGB(0,0,255); 66 | leds[4] = CRGB(0,0,255); 67 | leds[5] = CRGB(0,0,255); 68 | FastLED.show(); 69 | delay(1000); 70 | } 71 | -------------------------------------------------------------------------------- /libraries/FastLED/examples/RGBSetDemo/RGBSetDemo.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #define NUM_LEDS 40 3 | 4 | CRGBArray leds; 5 | 6 | void setup() { FastLED.addLeds(leds, NUM_LEDS); } 7 | 8 | void loop(){ 9 | static uint8_t hue; 10 | for(int i = 0; i < NUM_LEDS/2; i++) { 11 | // fade everything out 12 | leds.fadeToBlackBy(40); 13 | 14 | // let's set an led value 15 | leds[i] = CHSV(hue++,255,255); 16 | 17 | // now, let's first 20 leds to the top 20 leds, 18 | leds(NUM_LEDS/2,NUM_LEDS-1) = leds(NUM_LEDS/2 - 1 ,0); 19 | FastLED.delay(33); 20 | } 21 | } 22 | 23 | -------------------------------------------------------------------------------- /libraries/FastLED/examples/SmartMatrix/SmartMatrix.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #define kMatrixWidth 32 5 | #define kMatrixHeight 32 6 | const bool kMatrixSerpentineLayout = false; 7 | 8 | #define NUM_LEDS (kMatrixWidth * kMatrixHeight) 9 | 10 | CRGB leds[kMatrixWidth * kMatrixHeight]; 11 | 12 | 13 | uint16_t XY( uint8_t x, uint8_t y) 14 | { 15 | uint16_t i; 16 | 17 | if( kMatrixSerpentineLayout == false) { 18 | i = (y * kMatrixWidth) + x; 19 | } 20 | 21 | if( kMatrixSerpentineLayout == true) { 22 | if( y & 0x01) { 23 | // Odd rows run backwards 24 | uint8_t reverseX = (kMatrixWidth - 1) - x; 25 | i = (y * kMatrixWidth) + reverseX; 26 | } else { 27 | // Even rows run forwards 28 | i = (y * kMatrixWidth) + x; 29 | } 30 | } 31 | 32 | return i; 33 | } 34 | 35 | // The 32bit version of our coordinates 36 | static uint16_t x; 37 | static uint16_t y; 38 | static uint16_t z; 39 | 40 | // We're using the x/y dimensions to map to the x/y pixels on the matrix. We'll 41 | // use the z-axis for "time". speed determines how fast time moves forward. Try 42 | // 1 for a very slow moving effect, or 60 for something that ends up looking like 43 | // water. 44 | // uint16_t speed = 1; // almost looks like a painting, moves very slowly 45 | uint16_t speed = 20; // a nice starting speed, mixes well with a scale of 100 46 | // uint16_t speed = 33; 47 | // uint16_t speed = 100; // wicked fast! 48 | 49 | // Scale determines how far apart the pixels in our noise matrix are. Try 50 | // changing these values around to see how it affects the motion of the display. The 51 | // higher the value of scale, the more "zoomed out" the noise iwll be. A value 52 | // of 1 will be so zoomed in, you'll mostly see solid colors. 53 | 54 | // uint16_t scale = 1; // mostly just solid colors 55 | // uint16_t scale = 4011; // very zoomed out and shimmery 56 | uint16_t scale = 31; 57 | 58 | // This is the array that we keep our computed noise values in 59 | uint8_t noise[kMatrixWidth][kMatrixHeight]; 60 | 61 | void setup() { 62 | // uncomment the following lines if you want to see FPS count information 63 | // Serial.begin(38400); 64 | // Serial.println("resetting!"); 65 | delay(3000); 66 | LEDS.addLeds(leds,NUM_LEDS); 67 | LEDS.setBrightness(96); 68 | 69 | // Initialize our coordinates to some random values 70 | x = random16(); 71 | y = random16(); 72 | z = random16(); 73 | 74 | // Show off smart matrix scrolling text 75 | pSmartMatrix->setScrollMode(wrapForward); 76 | pSmartMatrix->setScrollColor({0xff, 0xff, 0xff}); 77 | pSmartMatrix->setScrollSpeed(15); 78 | pSmartMatrix->setScrollFont(font6x10); 79 | pSmartMatrix->scrollText("Smart Matrix & FastLED", -1); 80 | pSmartMatrix->setScrollOffsetFromEdge(10); 81 | } 82 | 83 | // Fill the x/y array of 8-bit noise values using the inoise8 function. 84 | void fillnoise8() { 85 | for(int i = 0; i < kMatrixWidth; i++) { 86 | int ioffset = scale * i; 87 | for(int j = 0; j < kMatrixHeight; j++) { 88 | int joffset = scale * j; 89 | noise[i][j] = inoise8(x + ioffset,y + joffset,z); 90 | } 91 | } 92 | z += speed; 93 | } 94 | 95 | 96 | void loop() { 97 | static uint8_t circlex = 0; 98 | static uint8_t circley = 0; 99 | 100 | static uint8_t ihue=0; 101 | fillnoise8(); 102 | for(int i = 0; i < kMatrixWidth; i++) { 103 | for(int j = 0; j < kMatrixHeight; j++) { 104 | // We use the value at the (i,j) coordinate in the noise 105 | // array for our brightness, and the flipped value from (j,i) 106 | // for our pixel's hue. 107 | leds[XY(i,j)] = CHSV(noise[j][i],255,noise[i][j]); 108 | 109 | // You can also explore other ways to constrain the hue used, like below 110 | // leds[XY(i,j)] = CHSV(ihue + (noise[j][i]>>2),255,noise[i][j]); 111 | } 112 | } 113 | ihue+=1; 114 | 115 | // N.B. this requires SmartMatrix modified w/triple buffering support 116 | pSmartMatrix->fillCircle(circlex % 32,circley % 32,6,CRGB(CHSV(ihue+128,255,255))); 117 | circlex += random16(2); 118 | circley += random16(2); 119 | LEDS.show(); 120 | // delay(10); 121 | } 122 | -------------------------------------------------------------------------------- /libraries/FastLED/extras/AppleII.s65: -------------------------------------------------------------------------------- 1 | KBD = $C000 ;Read keydown 2 | KBDSTRB = $C010 ;Reset keybd 3 | 4 | SPKR = $C030 ;Toggle speaker 5 | 6 | ; TTL digital output pins on 7 | ; 16-pin DIP game connector 8 | SETAN0 = $C058 9 | CLRAN0 = $C059 10 | SETAN1 = $C05A 11 | CLRAN1 = $C05B 12 | SETAN2 = $C05C 13 | CLRAN2 = $C05D 14 | SETAN3 = $C05E 15 | CLRAN3 = $C05F 16 | 17 | PIN12ON = CLRAN3 18 | PIN12OFF= SETAN3 19 | PIN13ON = CLRAN2 20 | PIN13OFF= SETAN2 21 | PIN14ON = CLRAN1 22 | PIN14OFF= SETAN1 23 | PIN15ON = CLRAN0 24 | PIN15OFF= SETAN0 25 | 26 | ;Special for pin 5, except on //gs 27 | C040STROBE = $C040 28 | PIN5STROBE = C040STROBE 29 | 30 | SolidApple = $C062 ; read SW1 or SA 31 | OpenApple = $C061 ; read SW0 or OA 32 | 33 | VBL = $C019 ; vertical blanking 34 | 35 | WAIT = $FCA8 ; wait a little while 36 | 37 | CROUT = $FD8E ; print a CR 38 | PRBYTE = $FDDA ; print a hex byte 39 | 40 | 41 | -------------------------------------------------------------------------------- /libraries/FastLED/extras/RainbowDemo.bin.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joymonkey/logicengine/b7f17ec6ea922488af02227f457b47cb958590fd/libraries/FastLED/extras/RainbowDemo.bin.zip -------------------------------------------------------------------------------- /libraries/FastLED/extras/RainbowDemo.s65: -------------------------------------------------------------------------------- 1 | ; "Rainbow with glitter" demo 2 | ; for "FastLED6502" 3 | ; 4 | ; Runs on an Apple ][, ][+, //e, or //gs 5 | ; 6 | ; Supports APA102, Adafruit DotStar, 7 | ; LPD8806, and WS2801 LED strips. 8 | ; 9 | ; LED strip connects to game port pins, 10 | ; see FastLED6502.s65 for details. 11 | ; 12 | ; Mark Kriegsman, February 2015 13 | 14 | #define NUM_LEDS 100 15 | #define BRIGHTNESS 64 16 | #define CHIPSET APA102 17 | #define DATA_PIN 14 18 | #define CLOCK_PIN 5 19 | 20 | * = $6000 21 | 22 | #include "FastLED6502.s65" 23 | #include "AppleII.s65" 24 | 25 | gHue .byt 0 26 | gHueDelta .byt 17 27 | gHueSpeed .byt 7 28 | 29 | 30 | Setup 31 | lda #0 32 | sta gHue 33 | 34 | Loop 35 | lda gHue 36 | clc 37 | adc gHueSpeed 38 | sta gHue 39 | ldx gHue 40 | ldy gHueDelta 41 | ; Fill RGB array with HSV rainbow 42 | jsr FastLED_FillRainbow_XY 43 | ; Use master brightness control 44 | lda #BRIGHTNESS 45 | sta FastLED_Brightness 46 | CheckOpenApple 47 | bit OpenApple 48 | bpl CheckSolidApple 49 | ; Add glitter if requested 50 | jsr AddGlitter 51 | CheckSolidApple 52 | bit SolidApple 53 | bpl DoDisplay 54 | ; Pulse brightness if requested 55 | jsr PulseBrightness 56 | DoDisplay 57 | ; This is where the magic happens 58 | jsr FastLED_Show 59 | jmp Loop 60 | 61 | 62 | AddGlitter 63 | ldy #3 64 | MaybeAdd1Glitter 65 | jsr FastLED_Random8 66 | cmp FastLED_NumPixels 67 | bcs SkipThis1Glitter 68 | tax 69 | lda #$FF 70 | sta ledsR,x 71 | sta ledsG,x 72 | sta ledsB,x 73 | SkipThis1Glitter 74 | dey 75 | bne MaybeAdd1Glitter 76 | rts 77 | 78 | 79 | PulseBrightness 80 | lda #13 81 | jsr FastLED_Beat8 82 | clc 83 | adc #12 84 | bcc PulseBright1 85 | lda #$FF 86 | PulseBright1 87 | sta FastLED_Brightness 88 | rts 89 | -------------------------------------------------------------------------------- /libraries/FastLED/fastled_config.h: -------------------------------------------------------------------------------- 1 | #ifndef __INC_FASTLED_CONFIG_H 2 | #define __INC_FASTLED_CONFIG_H 3 | 4 | #include "FastLED.h" 5 | 6 | ///@file fastled_config.h 7 | /// contains definitions that can be used to configure FastLED at compile time 8 | 9 | // Use this option only for debugging pin access and forcing software pin access. Note that 10 | // software pin access only works in Arduino based environments. Forces use of digitalWrite 11 | // methods for pin access vs. direct hardware port access 12 | // #define FASTLED_FORCE_SOFTWARE_PINS 13 | 14 | // Use this option only for debugging bitbang'd spi access or to work around bugs in hardware 15 | // spi access. Forces use of bit-banged spi, even on pins that has hardware SPI available. 16 | // #define FASTLED_FORCE_SOFTWARE_SPI 17 | 18 | // Use this to force FastLED to allow interrupts in the clockless chipsets (or to force it to 19 | // disallow), overriding the default on platforms that support this. Set the value to 1 to 20 | // allow interrupts or 0 to disallow them. 21 | // #define FASTLED_ALLOW_INTERRUPTS 1 22 | // #define FASTLED_ALLOW_INTERRUPTS 0 23 | 24 | // Use this to allow some integer overflows/underflows in the inoise functions. 25 | // The original implementions allowed this, and had some discontinuties in the noise 26 | // output. It's technically an implementation bug, and was fixed, but you may wish 27 | // to preserve the old look and feel of the inoise functions in your existing animations. 28 | // The default is 0: NO overflow, and 'continuous' noise output, aka the fixed way. 29 | // #define FASTLED_NOISE_ALLOW_AVERAGE_TO_OVERFLOW 0 30 | // #define FASTLED_NOISE_ALLOW_AVERAGE_TO_OVERFLOW 1 31 | 32 | // Use this toggle whether or not to use the 'fixed' FastLED scale8. The initial scale8 33 | // had a problem where scale8(255,255) would give you 254. This is now fixed, and that 34 | // fix is enabled by default. However, if for some reason you have code that is not 35 | // working right as a result of this (e.g. code that was expecting the old scale8 behavior) 36 | // you can disable it here 37 | 38 | #define FASTLED_SCALE8_FIXED 1 39 | // define FASTLED_SCALE8_FIXED 0 40 | 41 | // Use this to determine how many times FastLED will attempt to re-transmit a frame if interrupted 42 | // for too long by interrupts. 43 | #ifndef FASTLED_INTERRUPT_RETRY_COUNT 44 | #define FASTLED_INTERRUPT_RETRY_COUNT 2 45 | #endif 46 | 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /libraries/FastLED/fastled_delay.h: -------------------------------------------------------------------------------- 1 | #ifndef __INC_FL_DELAY_H 2 | #define __INC_FL_DELAY_H 3 | 4 | #include "FastLED.h" 5 | 6 | ///@file fastled_delay.h 7 | ///Utility functions and classes for managing delaycycles 8 | 9 | FASTLED_NAMESPACE_BEGIN 10 | 11 | /// Class to ensure that a minimum amount of time has kicked since the last time run - and delay if not enough time has passed yet 12 | /// this should make sure that chipsets that have 13 | template class CMinWait { 14 | uint16_t mLastMicros; 15 | public: 16 | CMinWait() { mLastMicros = 0; } 17 | 18 | void wait() { 19 | uint16_t diff; 20 | do { 21 | diff = (micros() & 0xFFFF) - mLastMicros; 22 | } while(diff < WAIT); 23 | } 24 | 25 | void mark() { mLastMicros = micros() & 0xFFFF; } 26 | }; 27 | 28 | 29 | //////////////////////////////////////////////////////////////////////////////////////////// 30 | // 31 | // Clock cycle counted delay loop 32 | // 33 | //////////////////////////////////////////////////////////////////////////////////////////// 34 | 35 | // Default is now just 'nop', with special case for AVR 36 | #if defined(__AVR__) 37 | # define NOP __asm__ __volatile__ ("cp r0,r0\n"); 38 | # define NOP2 __asm__ __volatile__ ("rjmp .+0"); 39 | #else 40 | # define NOP __asm__ __volatile__ ("nop\n"); 41 | # define NOP2 __asm__ __volatile__ ("nop\n\t nop\n"); 42 | #endif 43 | 44 | // predeclaration to not upset the compiler 45 | template inline void delaycycles(); 46 | template inline void delaycycles_min1() { 47 | delaycycles<1>(); 48 | delaycycles(); 49 | } 50 | 51 | 52 | // TODO: ARM version of _delaycycles_ 53 | 54 | // usable definition 55 | #if defined(FASTLED_AVR) 56 | // worker template - this will nop for LOOP * 3 + PAD cycles total 57 | template inline void _delaycycles_AVR() { 58 | delaycycles(); 59 | // the loop below is 3 cycles * LOOP. the LDI is one cycle, 60 | // the DEC is 1 cycle, the BRNE is 2 cycles if looping back and 61 | // 1 if not (the LDI balances out the BRNE being 1 cycle on exit) 62 | __asm__ __volatile__ ( 63 | " LDI R16, %0\n" 64 | "L_%=: DEC R16\n" 65 | " BRNE L_%=\n" 66 | : /* no outputs */ 67 | : "M" (LOOP) 68 | : "r16" 69 | ); 70 | } 71 | 72 | template __attribute__((always_inline)) inline void delaycycles() { 73 | _delaycycles_AVR(); 74 | } 75 | #else 76 | // template inline void _delaycycles_ARM() { 77 | // delaycycles(); 78 | // // the loop below is 3 cycles * LOOP. the LDI is one cycle, 79 | // // the DEC is 1 cycle, the BRNE is 2 cycles if looping back and 80 | // // 1 if not (the LDI balances out the BRNE being 1 cycle on exit) 81 | // __asm__ __volatile__ ( 82 | // " mov.w r9, %0\n" 83 | // "L_%=: subs.w r9, r9, #1\n" 84 | // " bne.n L_%=\n" 85 | // : /* no outputs */ 86 | // : "M" (LOOP) 87 | // : "r9" 88 | // ); 89 | // } 90 | 91 | 92 | template __attribute__((always_inline)) inline void delaycycles() { 93 | // _delaycycles_ARM(); 94 | NOP; delaycycles(); 95 | } 96 | #endif 97 | 98 | // pre-instantiations for values small enough to not need the loop, as well as sanity holders 99 | // for some negative values. 100 | template<> __attribute__((always_inline)) inline void delaycycles<-10>() {} 101 | template<> __attribute__((always_inline)) inline void delaycycles<-9>() {} 102 | template<> __attribute__((always_inline)) inline void delaycycles<-8>() {} 103 | template<> __attribute__((always_inline)) inline void delaycycles<-7>() {} 104 | template<> __attribute__((always_inline)) inline void delaycycles<-6>() {} 105 | template<> __attribute__((always_inline)) inline void delaycycles<-5>() {} 106 | template<> __attribute__((always_inline)) inline void delaycycles<-4>() {} 107 | template<> __attribute__((always_inline)) inline void delaycycles<-3>() {} 108 | template<> __attribute__((always_inline)) inline void delaycycles<-2>() {} 109 | template<> __attribute__((always_inline)) inline void delaycycles<-1>() {} 110 | template<> __attribute__((always_inline)) inline void delaycycles<0>() {} 111 | template<> __attribute__((always_inline)) inline void delaycycles<1>() {NOP;} 112 | template<> __attribute__((always_inline)) inline void delaycycles<2>() {NOP2;} 113 | template<> __attribute__((always_inline)) inline void delaycycles<3>() {NOP;NOP2;} 114 | template<> __attribute__((always_inline)) inline void delaycycles<4>() {NOP2;NOP2;} 115 | template<> __attribute__((always_inline)) inline void delaycycles<5>() {NOP2;NOP2;NOP;} 116 | 117 | // Some timing related macros/definitions 118 | 119 | // Macro to convert from nano-seconds to clocks and clocks to nano-seconds 120 | // #define NS(_NS) (_NS / (1000 / (F_CPU / 1000000L))) 121 | #define F_CPU_MHZ (F_CPU / 1000000L) 122 | 123 | // #define NS(_NS) ( (_NS * (F_CPU / 1000000L))) / 1000 124 | #define NS(_NS) (((_NS * F_CPU_MHZ) + 999) / 1000) 125 | #define CLKS_TO_MICROS(_CLKS) ((long)(_CLKS)) / (F_CPU / 1000000L) 126 | 127 | // Macro for making sure there's enough time available 128 | #define NO_TIME(A, B, C) (NS(A) < 3 || NS(B) < 3 || NS(C) < 6) 129 | 130 | FASTLED_NAMESPACE_END 131 | 132 | #endif 133 | -------------------------------------------------------------------------------- /libraries/FastLED/fastled_progmem.h: -------------------------------------------------------------------------------- 1 | #ifndef __INC_FL_PROGMEM_H 2 | #define __INC_FL_PROGMEM_H 3 | 4 | #include "FastLED.h" 5 | 6 | ///@file fastled_progmem.h 7 | /// wrapper definitions to allow seamless use of PROGMEM in environmens that have it 8 | 9 | FASTLED_NAMESPACE_BEGIN 10 | 11 | // Compatibility layer for devices that do or don't 12 | // have "PROGMEM" and the associated pgm_ accessors. 13 | // 14 | // If a platform supports PROGMEM, it should define 15 | // "FASTLED_USE_PROGMEM" as 1, otherwise FastLED will 16 | // fall back to NOT using PROGMEM. 17 | // 18 | // Whether or not pgmspace.h is #included is separately 19 | // controllable by FASTLED_INCLUDE_PGMSPACE, if needed. 20 | 21 | 22 | // If FASTLED_USE_PROGMEM is 1, we'll map FL_PROGMEM 23 | // and the FL_PGM_* accessors to the Arduino equivalents. 24 | #if FASTLED_USE_PROGMEM == 1 25 | #ifndef FASTLED_INCLUDE_PGMSPACE 26 | #define FASTLED_INCLUDE_PGMSPACE 1 27 | #endif 28 | 29 | #if FASTLED_INCLUDE_PGMSPACE == 1 30 | #include 31 | #endif 32 | 33 | #define FL_PROGMEM PROGMEM 34 | 35 | // Note: only the 'near' memory wrappers are provided. 36 | // If you're using 'far' memory, you already have 37 | // portability issues to work through, but you could 38 | // add more support here if needed. 39 | #define FL_PGM_READ_BYTE_NEAR(x) (pgm_read_byte_near(x)) 40 | #define FL_PGM_READ_WORD_NEAR(x) (pgm_read_word_near(x)) 41 | #define FL_PGM_READ_DWORD_NEAR(x) (pgm_read_dword_near(x)) 42 | 43 | // Workaround for http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34734 44 | #if __GNUC__ < 4 || (__GNUC__ == 4 && (__GNUC_MINOR__ < 6)) 45 | #ifdef FASTLED_AVR 46 | #ifdef PROGMEM 47 | #undef PROGMEM 48 | #define PROGMEM __attribute__((section(".progmem.data"))) 49 | #endif 50 | #endif 51 | #endif 52 | 53 | #else 54 | // If FASTLED_USE_PROGMEM is 0 or undefined, 55 | // we'll use regular memory (RAM) access. 56 | 57 | //empty PROGMEM simulation 58 | #define FL_PROGMEM 59 | #define FL_PGM_READ_BYTE_NEAR(x) (*((const uint8_t*)(x))) 60 | #define FL_PGM_READ_WORD_NEAR(x) (*((const uint16_t*)(x))) 61 | #define FL_PGM_READ_DWORD_NEAR(x) (*((const uint32_t*)(x))) 62 | 63 | #endif 64 | 65 | 66 | FASTLED_NAMESPACE_END 67 | 68 | #endif 69 | -------------------------------------------------------------------------------- /libraries/FastLED/fastspi.h: -------------------------------------------------------------------------------- 1 | #ifndef __INC_FASTSPI_H 2 | #define __INC_FASTSPI_H 3 | 4 | #include "FastLED.h" 5 | 6 | #include "controller.h" 7 | #include "lib8tion.h" 8 | 9 | #include "fastspi_bitbang.h" 10 | 11 | FASTLED_NAMESPACE_BEGIN 12 | 13 | #if defined(FASTLED_TEENSY3) && (F_CPU > 48000000) 14 | #define DATA_RATE_MHZ(X) (((48000000L / 1000000L) / X)) 15 | #define DATA_RATE_KHZ(X) (((48000000L / 1000L) / X)) 16 | #else 17 | #define DATA_RATE_MHZ(X) ((F_CPU / 1000000L) / X) 18 | #define DATA_RATE_KHZ(X) ((F_CPU / 1000L) / X) 19 | #endif 20 | 21 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 22 | // 23 | // External SPI template definition with partial instantiation(s) to map to hardware SPI ports on platforms/builds where the pin 24 | // mappings are known at compile time. 25 | // 26 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 27 | 28 | #if !defined(FASTLED_ALL_PINS_HARDWARE_SPI) 29 | template 30 | class SPIOutput : public AVRSoftwareSPIOutput<_DATA_PIN, _CLOCK_PIN, _SPI_CLOCK_DIVIDER> {}; 31 | #endif 32 | 33 | template 34 | class SoftwareSPIOutput : public AVRSoftwareSPIOutput<_DATA_PIN, _CLOCK_PIN, _SPI_CLOCK_DIVIDER> {}; 35 | 36 | #ifndef FASTLED_FORCE_SOFTWARE_SPI 37 | 38 | #if defined(NRF51) && defined(FASTLED_ALL_PINS_HARDWARE_SPI) 39 | template 40 | class SPIOutput : public NRF51SPIOutput<_DATA_PIN, _CLOCK_PIN, _SPI_CLOCK_DIVIDER> {}; 41 | #endif 42 | 43 | #if defined(SPI_DATA) && defined(SPI_CLOCK) 44 | 45 | #if defined(FASTLED_TEENSY3) && defined(ARM_HARDWARE_SPI) 46 | 47 | template 48 | class SPIOutput : public ARMHardwareSPIOutput {}; 49 | 50 | #if defined(SPI2_DATA) 51 | 52 | template 53 | class SPIOutput : public ARMHardwareSPIOutput {}; 54 | 55 | template 56 | class SPIOutput : public ARMHardwareSPIOutput {}; 57 | 58 | template 59 | class SPIOutput : public ARMHardwareSPIOutput {}; 60 | #endif 61 | 62 | #elif defined(FASTLED_TEENSYLC) && defined(ARM_HARDWARE_SPI) 63 | 64 | #define DECLARE_SPI0(__DATA,__CLOCK) template\ 65 | class SPIOutput<__DATA, __CLOCK, SPI_SPEED> : public ARMHardwareSPIOutput<__DATA, __CLOCK, SPI_SPEED, 0x40076000> {}; 66 | #define DECLARE_SPI1(__DATA,__CLOCK) template\ 67 | class SPIOutput<__DATA, __CLOCK, SPI_SPEED> : public ARMHardwareSPIOutput<__DATA, __CLOCK, SPI_SPEED, 0x40077000> {}; 68 | 69 | DECLARE_SPI0(7,13); 70 | DECLARE_SPI0(8,13); 71 | DECLARE_SPI0(11,13); 72 | DECLARE_SPI0(12,13); 73 | DECLARE_SPI0(7,14); 74 | DECLARE_SPI0(8,14); 75 | DECLARE_SPI0(11,14); 76 | DECLARE_SPI0(12,14); 77 | DECLARE_SPI1(0,20); 78 | DECLARE_SPI1(1,20); 79 | DECLARE_SPI1(21,20); 80 | 81 | #elif defined(__SAM3X8E__) 82 | 83 | template 84 | class SPIOutput : public SAMHardwareSPIOutput {}; 85 | 86 | #elif defined(AVR_HARDWARE_SPI) 87 | 88 | template 89 | class SPIOutput : public AVRHardwareSPIOutput {}; 90 | 91 | #if defined(SPI_UART0_DATA) 92 | 93 | template 94 | class SPIOutput : public AVRUSART0SPIOutput {}; 95 | 96 | #endif 97 | 98 | #if defined(SPI_UART1_DATA) 99 | 100 | template 101 | class SPIOutput : public AVRUSART1SPIOutput {}; 102 | 103 | #endif 104 | 105 | #endif 106 | 107 | #else 108 | # if !defined(FASTLED_INTERNAL) && !defined(FASTLED_ALL_PINS_HARDWARE_SPI) 109 | # ifdef FASTLED_HAS_PRAGMA_MESSAGE 110 | # pragma message "No hardware SPI pins defined. All SPI access will default to bitbanged output" 111 | # else 112 | # warning "No hardware SPI pins defined. All SPI access will default to bitbanged output" 113 | # endif 114 | # endif 115 | #endif 116 | 117 | // #if defined(USART_DATA) && defined(USART_CLOCK) 118 | // template 119 | // class AVRSPIOutput : public AVRUSARTSPIOutput {}; 120 | // #endif 121 | 122 | #else 123 | # if !defined(FASTLED_INTERNAL) && !defined(FASTLED_ALL_PINS_HARDWARE_SPI) 124 | # ifdef FASTLED_HAS_PRAGMA_MESSAGE 125 | # pragma message "Forcing software SPI - no hardware SPI for you!" 126 | # else 127 | # warning "Forcing software SPI - no hardware SPI for you!" 128 | # endif 129 | # endif 130 | #endif 131 | 132 | FASTLED_NAMESPACE_END 133 | 134 | #endif 135 | -------------------------------------------------------------------------------- /libraries/FastLED/fastspi_dma.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joymonkey/logicengine/b7f17ec6ea922488af02227f457b47cb958590fd/libraries/FastLED/fastspi_dma.h -------------------------------------------------------------------------------- /libraries/FastLED/fastspi_nop.h: -------------------------------------------------------------------------------- 1 | #ifndef __INC_FASTSPI_NOP_H 2 | #define __INC_FASTSPI_NOP_H 3 | 4 | #if 0 // Guard against the arduino ide idiotically including every header file 5 | 6 | #include "FastLED.h" 7 | 8 | FASTLED_NAMESPACE_BEGIN 9 | 10 | /// A nop/stub class, mostly to show the SPI methods that are needed/used by the various SPI chipset implementations. Should 11 | /// be used as a definition for the set of methods that the spi implementation classes should use (since C++ doesn't support the 12 | /// idea of interfaces - it's possible this could be done with virtual classes, need to decide if i want that overhead) 13 | template 14 | class NOPSPIOutput { 15 | Selectable *m_pSelect; 16 | 17 | public: 18 | NOPSPIOutput() { m_pSelect = NULL; } 19 | NOPSPIOutput(Selectable *pSelect) { m_pSelect = pSelect; } 20 | 21 | /// set the object representing the selectable 22 | void setSelect(Selectable *pSelect) { m_pSelect = pSelect; } 23 | 24 | /// initialize the SPI subssytem 25 | void init() { /* TODO */ } 26 | 27 | /// latch the CS select 28 | void select() { /* TODO */ } 29 | 30 | /// release the CS select 31 | void release() { /* TODO */ } 32 | 33 | /// wait until all queued up data has been written 34 | void waitFully(); 35 | 36 | /// not the most efficient mechanism in the world - but should be enough for sm16716 and friends 37 | template inline static void writeBit(uint8_t b) { /* TODO */ } 38 | 39 | /// write a byte out via SPI (returns immediately on writing register) 40 | void writeByte(uint8_t b) { /* TODO */ } 41 | /// write a word out via SPI (returns immediately on writing register) 42 | void writeWord(uint16_t w) { /* TODO */ } 43 | 44 | /// A raw set of writing byte values, assumes setup/init/waiting done elsewhere (static for use by adjustment classes) 45 | static void writeBytesValueRaw(uint8_t value, int len) { /* TODO */ } 46 | 47 | /// A full cycle of writing a value for len bytes, including select, release, and waiting 48 | void writeBytesValue(uint8_t value, int len) { /* TODO */ } 49 | 50 | /// A full cycle of writing a raw block of data out, including select, release, and waiting 51 | void writeBytes(uint8_t *data, int len) { /* TODO */ } 52 | 53 | /// write a single bit out, which bit from the passed in byte is determined by template parameter 54 | template inline static void writeBit(uint8_t b) { /* TODO */ } 55 | 56 | /// write out pixel data from the given PixelController object 57 | template void writePixels(PixelController pixels) { /* TODO */ } 58 | 59 | }; 60 | 61 | FASTLED_NAMESPACE_END 62 | 63 | #endif 64 | #endif 65 | -------------------------------------------------------------------------------- /libraries/FastLED/fastspi_ref.h: -------------------------------------------------------------------------------- 1 | #ifndef __INC_FASTSPI_ARM_SAM_H 2 | #define __INC_FASTSPI_ARM_SAM_H 3 | 4 | #if 0 // guard against the arduino ide idiotically including every header file 5 | #include "FastLED.h" 6 | 7 | FASTLED_NAMESPACE_BEGIN 8 | 9 | // A skeletal implementation of hardware SPI support. Fill in the necessary code for init, waiting, and writing. The rest of 10 | // the method implementations should provide a starting point, even if not hte most efficient to start with 11 | template 12 | class REFHardwareSPIOutput { 13 | Selectable *m_pSelect; 14 | public: 15 | SAMHardwareSPIOutput() { m_pSelect = NULL; } 16 | SAMHArdwareSPIOutput(Selectable *pSelect) { m_pSelect = pSelect; } 17 | 18 | // set the object representing the selectable 19 | void setSelect(Selectable *pSelect) { /* TODO */ } 20 | 21 | // initialize the SPI subssytem 22 | void init() { /* TODO */ } 23 | 24 | // latch the CS select 25 | void inline select() __attribute__((always_inline)) { if(m_pSelect != NULL) { m_pSelect->select(); } } 26 | 27 | // release the CS select 28 | void inline release() __attribute__((always_inline)) { if(m_pSelect != NULL) { m_pSelect->release(); } } 29 | 30 | // wait until all queued up data has been written 31 | static void waitFully() { /* TODO */ } 32 | 33 | // write a byte out via SPI (returns immediately on writing register) 34 | static void writeByte(uint8_t b) { /* TODO */ } 35 | 36 | // write a word out via SPI (returns immediately on writing register) 37 | static void writeWord(uint16_t w) { /* TODO */ } 38 | 39 | // A raw set of writing byte values, assumes setup/init/waiting done elsewhere 40 | static void writeBytesValueRaw(uint8_t value, int len) { 41 | while(len--) { writeByte(value); } 42 | } 43 | 44 | // A full cycle of writing a value for len bytes, including select, release, and waiting 45 | void writeBytesValue(uint8_t value, int len) { 46 | select(); writeBytesValueRaw(value, len); release(); 47 | } 48 | 49 | // A full cycle of writing a value for len bytes, including select, release, and waiting 50 | template void writeBytes(register uint8_t *data, int len) { 51 | uint8_t *end = data + len; 52 | select(); 53 | // could be optimized to write 16bit words out instead of 8bit bytes 54 | while(data != end) { 55 | writeByte(D::adjust(*data++)); 56 | } 57 | D::postBlock(len); 58 | waitFully(); 59 | release(); 60 | } 61 | 62 | // A full cycle of writing a value for len bytes, including select, release, and waiting 63 | void writeBytes(register uint8_t *data, int len) { writeBytes(data, len); } 64 | 65 | // write a single bit out, which bit from the passed in byte is determined by template parameter 66 | template inline static void writeBit(uint8_t b) { /* TODO */ } 67 | 68 | // write a block of uint8_ts out in groups of three. len is the total number of uint8_ts to write out. The template 69 | // parameters indicate how many uint8_ts to skip at the beginning and/or end of each grouping 70 | template void writePixels(PixelController pixels) { 71 | select(); 72 | while(data != end) { 73 | if(FLAGS & FLAG_START_BIT) { 74 | writeBit<0>(1); 75 | } 76 | writeByte(D::adjust(pixels.loadAndScale0())); 77 | writeByte(D::adjust(pixels.loadAndScale1())); 78 | writeByte(D::adjust(pixels.loadAndScale2())); 79 | 80 | pixels.advanceData(); 81 | pixels.stepDithering(); 82 | data += (3+skip); 83 | } 84 | D::postBlock(len); 85 | release(); 86 | } 87 | 88 | }; 89 | 90 | FASTLED_NAMESPACE_END 91 | 92 | #endif 93 | 94 | #endif 95 | 96 | -------------------------------------------------------------------------------- /libraries/FastLED/fastspi_types.h: -------------------------------------------------------------------------------- 1 | #ifndef __INC_FASTSPI_TYPES_H 2 | #define __INC_FASTSPI_TYPES_H 3 | 4 | #include "FastLED.h" 5 | 6 | FASTLED_NAMESPACE_BEGIN 7 | 8 | // Some helper macros for getting at mis-ordered byte values 9 | #define SPI_B0 (RGB_BYTE0(RGB_ORDER) + (MASK_SKIP_BITS & SKIP)) 10 | #define SPI_B1 (RGB_BYTE1(RGB_ORDER) + (MASK_SKIP_BITS & SKIP)) 11 | #define SPI_B2 (RGB_BYTE2(RGB_ORDER) + (MASK_SKIP_BITS & SKIP)) 12 | #define SPI_ADVANCE (3 + (MASK_SKIP_BITS & SKIP)) 13 | 14 | /// Some of the SPI controllers will need to perform a transform on each byte before doing 15 | /// anyting with it. Creating a class of this form and passing it in as a template parameter to 16 | /// writeBytes/writeBytes3 below will ensure that the body of this method will get called on every 17 | /// byte worked on. Recommendation, make the adjust method aggressively inlined. 18 | /// 19 | /// TODO: Convinience macro for building these 20 | class DATA_NOP { 21 | public: 22 | static __attribute__((always_inline)) inline uint8_t adjust(register uint8_t data) { return data; } 23 | static __attribute__((always_inline)) inline uint8_t adjust(register uint8_t data, register uint8_t scale) { return scale8(data, scale); } 24 | static __attribute__((always_inline)) inline void postBlock(int /* len */) { } 25 | }; 26 | 27 | #define FLAG_START_BIT 0x80 28 | #define MASK_SKIP_BITS 0x3F 29 | 30 | // Clock speed dividers 31 | #define SPEED_DIV_2 2 32 | #define SPEED_DIV_4 4 33 | #define SPEED_DIV_8 8 34 | #define SPEED_DIV_16 16 35 | #define SPEED_DIV_32 32 36 | #define SPEED_DIV_64 64 37 | #define SPEED_DIV_128 128 38 | 39 | #define MAX_DATA_RATE 0 40 | 41 | FASTLED_NAMESPACE_END 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /libraries/FastLED/hsv2rgb.h: -------------------------------------------------------------------------------- 1 | #ifndef __INC_HSV2RGB_H 2 | #define __INC_HSV2RGB_H 3 | 4 | #include "FastLED.h" 5 | 6 | #include "pixeltypes.h" 7 | 8 | FASTLED_NAMESPACE_BEGIN 9 | 10 | // hsv2rgb_rainbow - convert a hue, saturation, and value to RGB 11 | // using a visually balanced rainbow (vs a straight 12 | // mathematical spectrum). 13 | // This 'rainbow' yields better yellow and orange 14 | // than a straight 'spectrum'. 15 | // 16 | // NOTE: here hue is 0-255, not just 0-191 17 | 18 | void hsv2rgb_rainbow( const struct CHSV& hsv, struct CRGB& rgb); 19 | void hsv2rgb_rainbow( const struct CHSV* phsv, struct CRGB * prgb, int numLeds); 20 | #define HUE_MAX_RAINBOW 255 21 | 22 | 23 | // hsv2rgb_spectrum - convert a hue, saturation, and value to RGB 24 | // using a mathematically straight spectrum (vs 25 | // a visually balanced rainbow). 26 | // This 'spectrum' will have more green & blue 27 | // than a 'rainbow', and less yellow and orange. 28 | // 29 | // NOTE: here hue is 0-255, not just 0-191 30 | 31 | void hsv2rgb_spectrum( const struct CHSV& hsv, struct CRGB& rgb); 32 | void hsv2rgb_spectrum( const struct CHSV* phsv, struct CRGB * prgb, int numLeds); 33 | #define HUE_MAX_SPECTRUM 255 34 | 35 | 36 | // hsv2rgb_raw - convert hue, saturation, and value to RGB. 37 | // This 'spectrum' conversion will be more green & blue 38 | // than a real 'rainbow', and the hue is specified just 39 | // in the range 0-191. Together, these result in a 40 | // slightly faster conversion speed, at the expense of 41 | // color balance. 42 | // 43 | // NOTE: Hue is 0-191 only! 44 | // Saturation & value are 0-255 each. 45 | // 46 | 47 | void hsv2rgb_raw(const struct CHSV& hsv, struct CRGB & rgb); 48 | void hsv2rgb_raw(const struct CHSV* phsv, struct CRGB * prgb, int numLeds); 49 | #define HUE_MAX 191 50 | 51 | 52 | // rgb2hsv_approximate - recover _approximate_ HSV values from RGB. 53 | // 54 | // NOTE 1: This function is a long-term work in process; expect 55 | // results to change slightly over time as this function is 56 | // refined and improved. 57 | // 58 | // NOTE 2: This function is most accurate when the input is an 59 | // RGB color that came from a fully-saturated HSV color to start 60 | // with. E.g. CHSV( hue, 255, 255) -> CRGB -> CHSV will give 61 | // best results. 62 | // 63 | // NOTE 3: This function is not nearly as fast as HSV-to-RGB. 64 | // It is provided for those situations when the need for this 65 | // function cannot be avoided, or when extremely high performance 66 | // is not needed. 67 | // 68 | // NOTE 4: Why is this 'only' an "approximation"? 69 | // Not all RGB colors have HSV equivalents! For example, there 70 | // is no HSV value that will ever convert to RGB(255,255,0) using 71 | // the code provided in this library. So if you try to 72 | // convert RGB(255,255,0) 'back' to HSV, you'll necessarily get 73 | // only an approximation. Emphasis has been placed on getting 74 | // the 'hue' as close as usefully possible, but even that's a bit 75 | // of a challenge. The 8-bit HSV and 8-bit RGB color spaces 76 | // are not a "bijection". 77 | // 78 | // Nevertheless, this function does a pretty good job, particularly 79 | // at recovering the 'hue' from fully saturated RGB colors that 80 | // originally came from HSV rainbow colors. So if you start 81 | // with CHSV(hue_in,255,255), and convert that to RGB, and then 82 | // convert it back to HSV using this function, the resulting output 83 | // hue will either exactly the same, or very close (+/-1). 84 | // The more desaturated the original RGB color is, the rougher the 85 | // approximation, and the less accurate the results. 86 | // 87 | CHSV rgb2hsv_approximate( const CRGB& rgb); 88 | 89 | FASTLED_NAMESPACE_END 90 | 91 | #endif 92 | -------------------------------------------------------------------------------- /libraries/FastLED/led_sysdefs.h: -------------------------------------------------------------------------------- 1 | #ifndef __INC_LED_SYSDEFS_H 2 | #define __INC_LED_SYSDEFS_H 3 | 4 | #include "FastLED.h" 5 | 6 | #include "fastled_config.h" 7 | 8 | #if defined(NRF51) || defined(__RFduino__) || defined (__Simblee__) 9 | #include "platforms/arm/nrf51/led_sysdefs_arm_nrf51.h" 10 | #elif defined(__MK20DX128__) || defined(__MK20DX256__) 11 | // Include k20/T3 headers 12 | #include "platforms/arm/k20/led_sysdefs_arm_k20.h" 13 | #elif defined(__MKL26Z64__) 14 | // Include kl26/T-LC headers 15 | #include "platforms/arm/kl26/led_sysdefs_arm_kl26.h" 16 | #elif defined(__SAM3X8E__) 17 | // Include sam/due headers 18 | #include "platforms/arm/sam/led_sysdefs_arm_sam.h" 19 | #elif defined(STM32F10X_MD) 20 | #include "platforms/arm/stm32/led_sysdefs_arm_stm32.h" 21 | #elif defined(__SAMD21G18A__) || defined(__SAMD21E17A__) 22 | #include "platforms/arm/d21/led_sysdefs_arm_d21.h" 23 | #elif defined(ESP8266) 24 | #include "platforms/esp/8266/led_sysdefs_esp8266.h" 25 | #else 26 | // AVR platforms 27 | #include "platforms/avr/led_sysdefs_avr.h" 28 | #endif 29 | 30 | #ifndef FASTLED_NAMESPACE_BEGIN 31 | #define FASTLED_NAMESPACE_BEGIN 32 | #define FASTLED_NAMESPACE_END 33 | #define FASTLED_USING_NAMESPACE 34 | #endif 35 | 36 | // Arduino.h needed for convenience functions digitalPinToPort/BitMask/portOutputRegister and the pinMode methods. 37 | #ifdef ARDUINO 38 | #include 39 | #endif 40 | 41 | #define CLKS_PER_US (F_CPU/1000000) 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /libraries/FastLED/lib8tion/random8.h: -------------------------------------------------------------------------------- 1 | #ifndef __INC_LIB8TION_RANDOM_H 2 | #define __INC_LIB8TION_RANDOM_H 3 | ///@ingroup lib8tion 4 | 5 | ///@defgroup Random Fast random number generators 6 | /// Fast 8- and 16- bit unsigned random numbers. 7 | /// Significantly faster than Arduino random(), but 8 | /// also somewhat less random. You can add entropy. 9 | ///@{ 10 | 11 | // X(n+1) = (2053 * X(n)) + 13849) 12 | #define FASTLED_RAND16_2053 ((uint16_t)(2053)) 13 | #define FASTLED_RAND16_13849 ((uint16_t)(13849)) 14 | 15 | /// random number seed 16 | extern uint16_t rand16seed;// = RAND16_SEED; 17 | 18 | /// Generate an 8-bit random number 19 | LIB8STATIC uint8_t random8() 20 | { 21 | rand16seed = (rand16seed * FASTLED_RAND16_2053) + FASTLED_RAND16_13849; 22 | // return the sum of the high and low bytes, for better 23 | // mixing and non-sequential correlation 24 | return (uint8_t)(((uint8_t)(rand16seed & 0xFF)) + 25 | ((uint8_t)(rand16seed >> 8))); 26 | } 27 | 28 | /// Generate a 16 bit random number 29 | LIB8STATIC uint16_t random16() 30 | { 31 | rand16seed = (rand16seed * FASTLED_RAND16_2053) + FASTLED_RAND16_13849; 32 | return rand16seed; 33 | } 34 | 35 | /// Generate an 8-bit random number between 0 and lim 36 | /// @param lim the upper bound for the result 37 | LIB8STATIC uint8_t random8(uint8_t lim) 38 | { 39 | uint8_t r = random8(); 40 | r = (r*lim) >> 8; 41 | return r; 42 | } 43 | 44 | /// Generate an 8-bit random number in the given range 45 | /// @param min the lower bound for the random number 46 | /// @param lim the upper bound for the random number 47 | LIB8STATIC uint8_t random8(uint8_t min, uint8_t lim) 48 | { 49 | uint8_t delta = lim - min; 50 | uint8_t r = random8(delta) + min; 51 | return r; 52 | } 53 | 54 | /// Generate an 16-bit random number between 0 and lim 55 | /// @param lim the upper bound for the result 56 | LIB8STATIC uint16_t random16( uint16_t lim) 57 | { 58 | uint16_t r = random16(); 59 | uint32_t p = (uint32_t)lim * (uint32_t)r; 60 | r = p >> 16; 61 | return r; 62 | } 63 | 64 | /// Generate an 16-bit random number in the given range 65 | /// @param min the lower bound for the random number 66 | /// @param lim the upper bound for the random number 67 | LIB8STATIC uint16_t random16( uint16_t min, uint16_t lim) 68 | { 69 | uint16_t delta = lim - min; 70 | uint16_t r = random16( delta) + min; 71 | return r; 72 | } 73 | 74 | /// Set the 16-bit seed used for the random number generator 75 | LIB8STATIC void random16_set_seed( uint16_t seed) 76 | { 77 | rand16seed = seed; 78 | } 79 | 80 | /// Get the current seed value for the random number generator 81 | LIB8STATIC uint16_t random16_get_seed() 82 | { 83 | return rand16seed; 84 | } 85 | 86 | /// Add entropy into the random number generator 87 | LIB8STATIC void random16_add_entropy( uint16_t entropy) 88 | { 89 | rand16seed += entropy; 90 | } 91 | 92 | ///@} 93 | 94 | #endif 95 | -------------------------------------------------------------------------------- /libraries/FastLED/library.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "FastLED", 3 | "keywords": "led,noise,rgb,math,fast", 4 | "description": "FastLED is a library for programming addressable rgb led strips (APA102/Dotstar, WS2812/Neopixel, LPD8806, and a dozen others) acting both as a driver and as a library for color management and fast math.", 5 | "repository": 6 | { 7 | "type": "git", 8 | "url": "https://github.com/FastLED/FastLED.git" 9 | }, 10 | "authors": 11 | [ 12 | { 13 | "name": "Daniel Garcia", 14 | "url": "https://github.com/focalintent", 15 | "maintainer": true 16 | }, 17 | { 18 | "name": "Mark Kriegsman", 19 | "url": "https://github.com/kriegsman", 20 | "maintainer": true 21 | } 22 | ], 23 | "frameworks": "arduino", 24 | "platforms": "atmelavr,atmelsam,freescalekinetis,nordicnrf51,nxplpc,ststm32,teensy" 25 | } 26 | -------------------------------------------------------------------------------- /libraries/FastLED/library.properties: -------------------------------------------------------------------------------- 1 | name=FastLED 2 | version=3.1.3 3 | author=Daniel Garcia 4 | maintainer=Daniel Garcia 5 | sentence=Multi-platform library for controlling dozens of different types of LEDs along with optimized math, effect, and noise functions. 6 | paragraph=Multi-platform library for controlling dozens of different types of LEDs along with optimized math, effect, and noise functions. 7 | category=Display 8 | url=https://github.com/FastLED/FastLED 9 | architectures=* 10 | -------------------------------------------------------------------------------- /libraries/FastLED/noise.h: -------------------------------------------------------------------------------- 1 | #ifndef __INC_NOISE_H 2 | #define __INC_NOISE_H 3 | 4 | #include "FastLED.h" 5 | 6 | FASTLED_NAMESPACE_BEGIN 7 | 8 | ///@file noise.h 9 | /// Noise functions provided by the library. 10 | 11 | ///@defgroup Noise Noise functions 12 | ///Simplex noise function definitions 13 | ///@{ 14 | /// @name scaled 16 bit noise functions 15 | ///@{ 16 | /// 16 bit, fixed point implementation of perlin's Simplex Noise. Coordinates are 17 | /// 16.16 fixed point values, 32 bit integers with integral coordinates in the high 16 18 | /// bits and fractional in the low 16 bits, and the function takes 1d, 2d, and 3d coordinate 19 | /// values. These functions are scaled to return 0-65535 20 | 21 | extern uint16_t inoise16(uint32_t x, uint32_t y, uint32_t z); 22 | extern uint16_t inoise16(uint32_t x, uint32_t y); 23 | extern uint16_t inoise16(uint32_t x); 24 | ///@} 25 | 26 | /// @name raw 16 bit noise functions 27 | //@{ 28 | /// 16 bit raw versions of the noise functions. These values are not scaled/altered and have 29 | /// output values roughly in the range (-18k,18k) 30 | extern int16_t inoise16_raw(uint32_t x, uint32_t y, uint32_t z); 31 | extern int16_t inoise16_raw(uint32_t x, uint32_t y); 32 | extern int16_t inoise16_raw(uint32_t x); 33 | ///@} 34 | 35 | /// @name 8 bit scaled noise functions 36 | ///@{ 37 | /// 8 bit, fixed point implementation of perlin's Simplex Noise. Coordinates are 38 | /// 8.8 fixed point values, 16 bit integers with integral coordinates in the high 8 39 | /// bits and fractional in the low 8 bits, and the function takes 1d, 2d, and 3d coordinate 40 | /// values. These functions are scaled to return 0-255 41 | extern uint8_t inoise8(uint16_t x, uint16_t y, uint16_t z); 42 | extern uint8_t inoise8(uint16_t x, uint16_t y); 43 | extern uint8_t inoise8(uint16_t x); 44 | ///@} 45 | 46 | /// @name 8 bit raw noise functions 47 | ///@{ 48 | /// 8 bit raw versions of the noise functions. These values are not scaled/altered and have 49 | /// output values roughly in the range (-70,70) 50 | extern int8_t inoise8_raw(uint16_t x, uint16_t y, uint16_t z); 51 | extern int8_t inoise8_raw(uint16_t x, uint16_t y); 52 | extern int8_t inoise8_raw(uint16_t x); 53 | ///@} 54 | 55 | ///@name raw fill functions 56 | ///@{ 57 | /// Raw noise fill functions - fill into a 1d or 2d array of 8-bit values using either 8-bit noise or 16-bit noise 58 | /// functions. 59 | ///@param pData the array of data to write into 60 | ///@param num_points the number of points of noise to compute 61 | ///@param octaves the number of octaves to use for noise 62 | ///@param x the x position in the noise field 63 | ///@param y the y position in the noise field for 2d functions 64 | ///@param scalex the scale (distance) between x points when filling in noise 65 | ///@param scaley the scale (distance) between y points when filling in noise 66 | ///@param time the time position for the noise field 67 | void fill_raw_noise8(uint8_t *pData, uint8_t num_points, uint8_t octaves, uint16_t x, int scalex, uint16_t time); 68 | void fill_raw_noise16into8(uint8_t *pData, uint8_t num_points, uint8_t octaves, uint32_t x, int scalex, uint32_t time); 69 | void fill_raw_2dnoise8(uint8_t *pData, int width, int height, uint8_t octaves, uint16_t x, int scalex, uint16_t y, int scaley, uint16_t time); 70 | void fill_raw_2dnoise16into8(uint8_t *pData, int width, int height, uint8_t octaves, uint32_t x, int scalex, uint32_t y, int scaley, uint32_t time); 71 | 72 | void fill_raw_2dnoise16(uint16_t *pData, int width, int height, uint8_t octaves, q88 freq88, fract16 amplitude, int skip, uint32_t x, int scalex, uint32_t y, int scaley, uint32_t time); 73 | void fill_raw_2dnoise16into8(uint8_t *pData, int width, int height, uint8_t octaves, q44 freq44, fract8 amplitude, int skip, uint32_t x, int scalex, uint32_t y, int scaley, uint32_t time); 74 | ///@} 75 | 76 | ///@name fill functions 77 | ///@{ 78 | /// fill functions to fill leds with values based on noise functions. These functions use the fill_raw_* functions as appropriate. 79 | void fill_noise8(CRGB *leds, int num_leds, 80 | uint8_t octaves, uint16_t x, int scale, 81 | uint8_t hue_octaves, uint16_t hue_x, int hue_scale, 82 | uint16_t time); 83 | void fill_noise16(CRGB *leds, int num_leds, 84 | uint8_t octaves, uint16_t x, int scale, 85 | uint8_t hue_octaves, uint16_t hue_x, int hue_scale, 86 | uint16_t time, uint8_t hue_shift=0); 87 | void fill_2dnoise8(CRGB *leds, int width, int height, bool serpentine, 88 | uint8_t octaves, uint16_t x, int xscale, uint16_t y, int yscale, uint16_t time, 89 | uint8_t hue_octaves, uint16_t hue_x, int hue_xscale, uint16_t hue_y, uint16_t hue_yscale,uint16_t hue_time,bool blend); 90 | void fill_2dnoise16(CRGB *leds, int width, int height, bool serpentine, 91 | uint8_t octaves, uint32_t x, int xscale, uint32_t y, int yscale, uint32_t time, 92 | uint8_t hue_octaves, uint16_t hue_x, int hue_xscale, uint16_t hue_y, uint16_t hue_yscale,uint16_t hue_time, bool blend, uint16_t hue_shift=0); 93 | 94 | FASTLED_NAMESPACE_END 95 | ///@} 96 | 97 | #endif 98 | -------------------------------------------------------------------------------- /libraries/FastLED/platforms.h: -------------------------------------------------------------------------------- 1 | #ifndef __INC_PLATFORMS_H 2 | #define __INC_PLATFORMS_H 3 | 4 | #include "FastLED.h" 5 | 6 | #include "fastled_config.h" 7 | 8 | #if defined(NRF51) 9 | #include "platforms/arm/nrf51/fastled_arm_nrf51.h" 10 | #elif defined(__MK20DX128__) || defined(__MK20DX256__) 11 | // Include k20/T3 headers 12 | #include "platforms/arm/k20/fastled_arm_k20.h" 13 | #elif defined(__MKL26Z64__) 14 | // Include kl26/T-LC headers 15 | #include "platforms/arm/kl26/fastled_arm_kl26.h" 16 | #elif defined(__SAM3X8E__) 17 | // Include sam/due headers 18 | #include "platforms/arm/sam/fastled_arm_sam.h" 19 | #elif defined(STM32F10X_MD) 20 | #include "platforms/arm/stm32/fastled_arm_stm32.h" 21 | #elif defined(__SAMD21G18A__) || defined(__SAMD21E17A__) 22 | #include "platforms/arm/d21/fastled_arm_d21.h" 23 | #elif defined(ESP8266) 24 | #include "platforms/esp/8266/fastled_esp8266.h" 25 | #else 26 | // AVR platforms 27 | #include "platforms/avr/fastled_avr.h" 28 | #endif 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /libraries/FastLED/platforms/arm/d21/clockless_arm_d21.h: -------------------------------------------------------------------------------- 1 | #ifndef __INC_CLOCKLESS_ARM_D21 2 | #define __INC_CLOCKLESS_ARM_D21 3 | 4 | #include "platforms/arm/common/m0clockless.h" 5 | FASTLED_NAMESPACE_BEGIN 6 | #define FASTLED_HAS_CLOCKLESS 1 7 | 8 | template 9 | class ClocklessController : public CPixelLEDController { 10 | typedef typename FastPinBB::port_ptr_t data_ptr_t; 11 | typedef typename FastPinBB::port_t data_t; 12 | 13 | data_t mPinMask; 14 | data_ptr_t mPort; 15 | CMinWait mWait; 16 | public: 17 | virtual void init() { 18 | FastPinBB::setOutput(); 19 | mPinMask = FastPinBB::mask(); 20 | mPort = FastPinBB::port(); 21 | } 22 | 23 | virtual uint16_t getMaxRefreshRate() const { return 400; } 24 | 25 | virtual void showPixels(PixelController & pixels) { 26 | mWait.wait(); 27 | cli(); 28 | if(!showRGBInternal(pixels)) { 29 | sei(); delayMicroseconds(WAIT_TIME); cli(); 30 | showRGBInternal(pixels); 31 | } 32 | sei(); 33 | mWait.mark(); 34 | } 35 | 36 | // This method is made static to force making register Y available to use for data on AVR - if the method is non-static, then 37 | // gcc will use register Y for the this pointer. 38 | static uint32_t showRGBInternal(PixelController pixels) { 39 | struct M0ClocklessData data; 40 | data.d[0] = pixels.d[0]; 41 | data.d[1] = pixels.d[1]; 42 | data.d[2] = pixels.d[2]; 43 | data.s[0] = pixels.mScale[0]; 44 | data.s[1] = pixels.mScale[1]; 45 | data.s[2] = pixels.mScale[2]; 46 | data.e[0] = pixels.e[0]; 47 | data.e[1] = pixels.e[1]; 48 | data.e[2] = pixels.e[2]; 49 | data.adj = pixels.mAdvance; 50 | 51 | typename FastPin::port_ptr_t portBase = FastPin::port(); 52 | return showLedData<8,4,T1,T2,T3,RGB_ORDER, WAIT_TIME>(portBase, FastPin::mask(), pixels.mData, pixels.mLen, &data); 53 | } 54 | 55 | 56 | }; 57 | 58 | FASTLED_NAMESPACE_END 59 | 60 | 61 | #endif // __INC_CLOCKLESS_ARM_D21 62 | -------------------------------------------------------------------------------- /libraries/FastLED/platforms/arm/d21/fastled_arm_d21.h: -------------------------------------------------------------------------------- 1 | #ifndef __INC_FASTLED_ARM_D21_H 2 | #define __INC_FASTLED_ARM_D21_H 3 | 4 | #include "fastled_delay.h" 5 | #include "fastpin_arm_d21.h" 6 | #include "clockless_arm_d21.h" 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /libraries/FastLED/platforms/arm/d21/led_sysdefs_arm_d21.h: -------------------------------------------------------------------------------- 1 | #ifndef __INC_LED_SYSDEFS_ARM_D21_H 2 | #define __INC_LED_SYSDEFS_ARM_D21_H 3 | 4 | 5 | #define FASTLED_ARM 6 | #define FASTLED_ARM_M0_PLUS 7 | 8 | #ifndef INTERRUPT_THRESHOLD 9 | #define INTERRUPT_THRESHOLD 1 10 | #endif 11 | 12 | // Default to allowing interrupts 13 | #ifndef FASTLED_ALLOW_INTERRUPTS 14 | #define FASTLED_ALLOW_INTERRUPTS 0 15 | #endif 16 | 17 | #if FASTLED_ALLOW_INTERRUPTS == 1 18 | #define FASTLED_ACCURATE_CLOCK 19 | #endif 20 | 21 | // reusing/abusing cli/sei defs for due 22 | #define cli() __disable_irq(); 23 | #define sei() __enable_irq(); 24 | 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /libraries/FastLED/platforms/arm/k20/clockless_arm_k20.h: -------------------------------------------------------------------------------- 1 | #ifndef __INC_CLOCKLESS_ARM_K20_H 2 | #define __INC_CLOCKLESS_ARM_K20_H 3 | 4 | FASTLED_NAMESPACE_BEGIN 5 | 6 | // Definition for a single channel clockless controller for the k20 family of chips, like that used in the teensy 3.0/3.1 7 | // See clockless.h for detailed info on how the template parameters are used. 8 | #if defined(FASTLED_TEENSY3) 9 | 10 | #define FASTLED_HAS_CLOCKLESS 1 11 | 12 | template 13 | class ClocklessController : public CPixelLEDController { 14 | typedef typename FastPin::port_ptr_t data_ptr_t; 15 | typedef typename FastPin::port_t data_t; 16 | 17 | data_t mPinMask; 18 | data_ptr_t mPort; 19 | CMinWait mWait; 20 | public: 21 | virtual void init() { 22 | FastPin::setOutput(); 23 | mPinMask = FastPin::mask(); 24 | mPort = FastPin::port(); 25 | } 26 | 27 | virtual uint16_t getMaxRefreshRate() const { return 400; } 28 | 29 | protected: 30 | 31 | virtual void showPixels(PixelController & pixels) { 32 | mWait.wait(); 33 | if(!showRGBInternal(pixels)) { 34 | sei(); delayMicroseconds(WAIT_TIME); cli(); 35 | showRGBInternal(pixels); 36 | } 37 | mWait.mark(); 38 | } 39 | 40 | template __attribute__ ((always_inline)) inline static void writeBits(register uint32_t & next_mark, register data_ptr_t port, register data_t hi, register data_t lo, register uint8_t & b) { 41 | for(register uint32_t i = BITS-1; i > 0; i--) { 42 | while(ARM_DWT_CYCCNT < next_mark); 43 | next_mark = ARM_DWT_CYCCNT + (T1+T2+T3); 44 | FastPin::fastset(port, hi); 45 | if(b&0x80) { 46 | while((next_mark - ARM_DWT_CYCCNT) > (T3+(2*(F_CPU/24000000)))); 47 | FastPin::fastset(port, lo); 48 | } else { 49 | while((next_mark - ARM_DWT_CYCCNT) > (T2+T3+(2*(F_CPU/24000000)))); 50 | FastPin::fastset(port, lo); 51 | } 52 | b <<= 1; 53 | } 54 | 55 | while(ARM_DWT_CYCCNT < next_mark); 56 | next_mark = ARM_DWT_CYCCNT + (T1+T2+T3); 57 | FastPin::fastset(port, hi); 58 | 59 | if(b&0x80) { 60 | while((next_mark - ARM_DWT_CYCCNT) > (T3+(2*(F_CPU/24000000)))); 61 | FastPin::fastset(port, lo); 62 | } else { 63 | while((next_mark - ARM_DWT_CYCCNT) > (T2+T3+(2*(F_CPU/24000000)))); 64 | FastPin::fastset(port, lo); 65 | } 66 | } 67 | 68 | // This method is made static to force making register Y available to use for data on AVR - if the method is non-static, then 69 | // gcc will use register Y for the this pointer. 70 | static uint32_t showRGBInternal(PixelController pixels) { 71 | // Get access to the clock 72 | ARM_DEMCR |= ARM_DEMCR_TRCENA; 73 | ARM_DWT_CTRL |= ARM_DWT_CTRL_CYCCNTENA; 74 | ARM_DWT_CYCCNT = 0; 75 | 76 | register data_ptr_t port = FastPin::port(); 77 | register data_t hi = *port | FastPin::mask();; 78 | register data_t lo = *port & ~FastPin::mask();; 79 | *port = lo; 80 | 81 | // Setup the pixel controller and load/scale the first byte 82 | pixels.preStepFirstByteDithering(); 83 | register uint8_t b = pixels.loadAndScale0(); 84 | 85 | cli(); 86 | uint32_t next_mark = ARM_DWT_CYCCNT + (T1+T2+T3); 87 | 88 | while(pixels.has(1)) { 89 | pixels.stepDithering(); 90 | #if (FASTLED_ALLOW_INTERRUPTS == 1) 91 | cli(); 92 | // if interrupts took longer than 45µs, punt on the current frame 93 | if(ARM_DWT_CYCCNT > next_mark) { 94 | if((ARM_DWT_CYCCNT-next_mark) > ((WAIT_TIME-INTERRUPT_THRESHOLD)*CLKS_PER_US)) { sei(); return 0; } 95 | } 96 | 97 | hi = *port | FastPin::mask(); 98 | lo = *port & ~FastPin::mask(); 99 | #endif 100 | // Write first byte, read next byte 101 | writeBits<8+XTRA0>(next_mark, port, hi, lo, b); 102 | b = pixels.loadAndScale1(); 103 | 104 | // Write second byte, read 3rd byte 105 | writeBits<8+XTRA0>(next_mark, port, hi, lo, b); 106 | b = pixels.loadAndScale2(); 107 | 108 | // Write third byte, read 1st byte of next pixel 109 | writeBits<8+XTRA0>(next_mark, port, hi, lo, b); 110 | b = pixels.advanceAndLoadAndScale0(); 111 | #if (FASTLED_ALLOW_INTERRUPTS == 1) 112 | sei(); 113 | #endif 114 | }; 115 | 116 | sei(); 117 | return ARM_DWT_CYCCNT; 118 | } 119 | }; 120 | #endif 121 | 122 | FASTLED_NAMESPACE_END 123 | 124 | #endif 125 | -------------------------------------------------------------------------------- /libraries/FastLED/platforms/arm/k20/fastled_arm_k20.h: -------------------------------------------------------------------------------- 1 | #ifndef __INC_FASTLED_ARM_K20_H 2 | #define __INC_FASTLED_ARM_K20_H 3 | 4 | // Include the k20 headers 5 | #include "bitswap.h" 6 | #include "fastled_delay.h" 7 | #include "fastpin_arm_k20.h" 8 | #include "fastspi_arm_k20.h" 9 | #include "octows2811_controller.h" 10 | #include "smartmatrix_t3.h" 11 | #include "clockless_arm_k20.h" 12 | #include "clockless_block_arm_k20.h" 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /libraries/FastLED/platforms/arm/k20/led_sysdefs_arm_k20.h: -------------------------------------------------------------------------------- 1 | #ifndef __INC_LED_SYSDEFS_ARM_K20_H 2 | #define __INC_LED_SYSDEFS_ARM_K20_H 3 | 4 | #define FASTLED_TEENSY3 5 | #define FASTLED_ARM 6 | 7 | #ifndef INTERRUPT_THRESHOLD 8 | #define INTERRUPT_THRESHOLD 1 9 | #endif 10 | 11 | // Default to allowing interrupts 12 | #ifndef FASTLED_ALLOW_INTERRUPTS 13 | #define FASTLED_ALLOW_INTERRUPTS 1 14 | #endif 15 | 16 | #if FASTLED_ALLOW_INTERRUPTS == 1 17 | #define FASTLED_ACCURATE_CLOCK 18 | #endif 19 | 20 | #if (F_CPU == 96000000) 21 | #define CLK_DBL 1 22 | #endif 23 | 24 | // Get some system include files 25 | #include 26 | #include // for cli/se definitions 27 | 28 | // Define the register types 29 | #if defined(ARDUINO) // && ARDUINO < 150 30 | typedef volatile uint8_t RoReg; /**< Read only 8-bit register (volatile const unsigned int) */ 31 | typedef volatile uint8_t RwReg; /**< Read-Write 8-bit register (volatile unsigned int) */ 32 | #endif 33 | 34 | extern volatile uint32_t systick_millis_count; 35 | # define MS_COUNTER systick_millis_count 36 | 37 | 38 | // Default to using PROGMEM, since TEENSY3 provides it 39 | // even though all it does is ignore it. Just being 40 | // conservative here in case TEENSY3 changes. 41 | #ifndef FASTLED_USE_PROGMEM 42 | #define FASTLED_USE_PROGMEM 1 43 | #endif 44 | 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /libraries/FastLED/platforms/arm/k20/octows2811_controller.h: -------------------------------------------------------------------------------- 1 | #ifndef __INC_OCTOWS2811_CONTROLLER_H 2 | #define __INC_OCTOWS2811_CONTROLLER_H 3 | 4 | #ifdef USE_OCTOWS2811 5 | 6 | // #include "OctoWS2811.h" 7 | 8 | FASTLED_NAMESPACE_BEGIN 9 | 10 | template 11 | class COctoWS2811Controller : public CPixelLEDController { 12 | OctoWS2811 *pocto; 13 | uint8_t *drawbuffer,*framebuffer; 14 | 15 | void _init(int nLeds) { 16 | if(pocto == NULL) { 17 | drawbuffer = (uint8_t*)malloc(nLeds * 8 * 3); 18 | framebuffer = (uint8_t*)malloc(nLeds * 8 * 3); 19 | 20 | // byte ordering is handled in show by the pixel controller 21 | int config = WS2811_RGB; 22 | config |= CHIP; 23 | 24 | pocto = new OctoWS2811(nLeds, framebuffer, drawbuffer, config); 25 | 26 | pocto->begin(); 27 | } 28 | } 29 | public: 30 | COctoWS2811Controller() { pocto = NULL; } 31 | 32 | 33 | virtual void init() { /* do nothing yet */ } 34 | 35 | typedef union { 36 | uint8_t bytes[8]; 37 | uint32_t raw[2]; 38 | } Lines; 39 | 40 | virtual void showPixels(PixelController & pixels) { 41 | _init(pixels.size()); 42 | 43 | uint8_t *pData = drawbuffer; 44 | while(pixels.has(1)) { 45 | Lines b; 46 | 47 | for(int i = 0; i < 8; i++) { b.bytes[i] = pixels.loadAndScale0(i); } 48 | transpose8x1_MSB(b.bytes,pData); pData += 8; 49 | for(int i = 0; i < 8; i++) { b.bytes[i] = pixels.loadAndScale1(i); } 50 | transpose8x1_MSB(b.bytes,pData); pData += 8; 51 | for(int i = 0; i < 8; i++) { b.bytes[i] = pixels.loadAndScale2(i); } 52 | transpose8x1_MSB(b.bytes,pData); pData += 8; 53 | pixels.stepDithering(); 54 | pixels.advanceData(); 55 | } 56 | 57 | pocto->show(); 58 | } 59 | 60 | }; 61 | 62 | FASTLED_NAMESPACE_END 63 | 64 | #endif 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /libraries/FastLED/platforms/arm/k20/smartmatrix_t3.h: -------------------------------------------------------------------------------- 1 | #ifndef __INC_SMARTMATRIX_T3_H 2 | #define __INC_SMARTMATRIX_T3_H 3 | 4 | #ifdef SmartMatrix_h 5 | #include 6 | 7 | FASTLED_NAMESPACE_BEGIN 8 | 9 | extern SmartMatrix *pSmartMatrix; 10 | 11 | // note - dmx simple must be included before FastSPI for this code to be enabled 12 | class CSmartMatrixController : public CPixelLEDController { 13 | SmartMatrix matrix; 14 | 15 | public: 16 | // initialize the LED controller 17 | virtual void init() { 18 | // Initialize 32x32 LED Matrix 19 | matrix.begin(); 20 | matrix.setBrightness(255); 21 | matrix.setColorCorrection(ccNone); 22 | 23 | // Clear screen 24 | clearLeds(0); 25 | matrix.swapBuffers(); 26 | pSmartMatrix = &matrix; 27 | } 28 | 29 | virtual void showPixels(PixelController & pixels) { 30 | if(SMART_MATRIX_CAN_TRIPLE_BUFFER) { 31 | rgb24 *md = matrix.getRealBackBuffer(); 32 | } else { 33 | rgb24 *md = matrix.backBuffer(); 34 | } 35 | while(pixels.has(1)) { 36 | md->red = pixels.loadAndScale0(); 37 | md->green = pixels.loadAndScale1(); 38 | md->blue = pixels.loadAndScale2(); 39 | md++; 40 | pixels.advanceData(); 41 | pixels.stepDithering(); 42 | } 43 | matrix.swapBuffers(); 44 | if(SMART_MATRIX_CAN_TRIPLE_BUFFER && pixels.advanceBy() > 0) { 45 | matrix.setBackBuffer(pixels.mData); 46 | } 47 | } 48 | 49 | }; 50 | 51 | FASTLED_NAMESPACE_END 52 | 53 | #endif 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /libraries/FastLED/platforms/arm/kl26/clockless_arm_kl26.h: -------------------------------------------------------------------------------- 1 | #ifndef __INC_CLOCKLESS_ARM_KL26 2 | #define __INC_CLOCKLESS_ARM_KL26 3 | 4 | #include "platforms/arm/common/m0clockless.h" 5 | FASTLED_NAMESPACE_BEGIN 6 | #define FASTLED_HAS_CLOCKLESS 1 7 | 8 | template 9 | class ClocklessController : public CPixelLEDController { 10 | typedef typename FastPinBB::port_ptr_t data_ptr_t; 11 | typedef typename FastPinBB::port_t data_t; 12 | 13 | data_t mPinMask; 14 | data_ptr_t mPort; 15 | CMinWait mWait; 16 | public: 17 | virtual void init() { 18 | FastPinBB::setOutput(); 19 | mPinMask = FastPinBB::mask(); 20 | mPort = FastPinBB::port(); 21 | } 22 | 23 | virtual uint16_t getMaxRefreshRate() const { return 400; } 24 | 25 | virtual void showPixels(PixelController & pixels) { 26 | mWait.wait(); 27 | cli(); 28 | if(!showRGBInternal(pixels)) { 29 | sei(); delayMicroseconds(WAIT_TIME); cli(); 30 | showRGBInternal(pixels); 31 | } 32 | sei(); 33 | mWait.mark(); 34 | } 35 | 36 | // This method is made static to force making register Y available to use for data on AVR - if the method is non-static, then 37 | // gcc will use register Y for the this pointer. 38 | static uint32_t showRGBInternal(PixelController pixels) { 39 | struct M0ClocklessData data; 40 | data.d[0] = pixels.d[0]; 41 | data.d[1] = pixels.d[1]; 42 | data.d[2] = pixels.d[2]; 43 | data.s[0] = pixels.mScale[0]; 44 | data.s[1] = pixels.mScale[1]; 45 | data.s[2] = pixels.mScale[2]; 46 | data.e[0] = pixels.e[0]; 47 | data.e[1] = pixels.e[1]; 48 | data.e[2] = pixels.e[2]; 49 | data.adj = pixels.mAdvance; 50 | 51 | typename FastPin::port_ptr_t portBase = FastPin::port(); 52 | return showLedData<4,8,T1,T2,T3,RGB_ORDER, WAIT_TIME>(portBase, FastPin::mask(), pixels.mData, pixels.mLen, &data); 53 | // return 0; // 0x00FFFFFF - _VAL; 54 | } 55 | 56 | 57 | }; 58 | 59 | FASTLED_NAMESPACE_END 60 | 61 | 62 | #endif // __INC_CLOCKLESS_ARM_D21 63 | -------------------------------------------------------------------------------- /libraries/FastLED/platforms/arm/kl26/fastled_arm_kl26.h: -------------------------------------------------------------------------------- 1 | #ifndef __INC_FASTLED_ARM_KL26_H 2 | #define __INC_FASTLED_ARM_KL26_H 3 | 4 | // Include the k20 headers 5 | #include "fastled_delay.h" 6 | #include "fastpin_arm_kl26.h" 7 | #include "fastspi_arm_kl26.h" 8 | #include "clockless_arm_kl26.h" 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /libraries/FastLED/platforms/arm/kl26/fastpin_arm_kl26.h: -------------------------------------------------------------------------------- 1 | #ifndef __FASTPIN_ARM_KL26_H 2 | #define __FASTPIN_ARM_KL26_H 3 | 4 | FASTLED_NAMESPACE_BEGIN 5 | 6 | #if defined(FASTLED_FORCE_SOFTWARE_PINS) 7 | #warning "Software pin support forced, pin access will be sloightly slower." 8 | #define NO_HARDWARE_PIN_SUPPORT 9 | #undef HAS_HARDWARE_PIN_SUPPORT 10 | 11 | #else 12 | 13 | 14 | /// Template definition for teensy LC style ARM pins, providing direct access to the various GPIO registers. Note that this 15 | /// uses the full port GPIO registers. In theory, in some way, bit-band register access -should- be faster, however I have found 16 | /// that something about the way gcc does register allocation results in the bit-band code being slower. It will need more fine tuning. 17 | /// The registers are data output, set output, clear output, toggle output, input, and direction 18 | template class _ARMPIN { 19 | public: 20 | typedef volatile uint32_t * port_ptr_t; 21 | typedef uint32_t port_t; 22 | 23 | inline static void setOutput() { pinMode(PIN, OUTPUT); } // TODO: perform MUX config { _PDDR::r() |= _MASK; } 24 | inline static void setInput() { pinMode(PIN, INPUT); } // TODO: preform MUX config { _PDDR::r() &= ~_MASK; } 25 | 26 | inline static void hi() __attribute__ ((always_inline)) { _PSOR::r() = _MASK; } 27 | inline static void lo() __attribute__ ((always_inline)) { _PCOR::r() = _MASK; } 28 | inline static void set(register port_t val) __attribute__ ((always_inline)) { _PDOR::r() = val; } 29 | 30 | inline static void strobe() __attribute__ ((always_inline)) { toggle(); toggle(); } 31 | 32 | inline static void toggle() __attribute__ ((always_inline)) { _PTOR::r() = _MASK; } 33 | 34 | inline static void hi(register port_ptr_t port) __attribute__ ((always_inline)) { hi(); } 35 | inline static void lo(register port_ptr_t port) __attribute__ ((always_inline)) { lo(); } 36 | inline static void fastset(register port_ptr_t port, register port_t val) __attribute__ ((always_inline)) { *port = val; } 37 | 38 | inline static port_t hival() __attribute__ ((always_inline)) { return _PDOR::r() | _MASK; } 39 | inline static port_t loval() __attribute__ ((always_inline)) { return _PDOR::r() & ~_MASK; } 40 | inline static port_ptr_t port() __attribute__ ((always_inline)) { return &_PDOR::r(); } 41 | inline static port_ptr_t sport() __attribute__ ((always_inline)) { return &_PSOR::r(); } 42 | inline static port_ptr_t cport() __attribute__ ((always_inline)) { return &_PCOR::r(); } 43 | inline static port_t mask() __attribute__ ((always_inline)) { return _MASK; } 44 | }; 45 | 46 | // Macros for kl26 pin access/definition 47 | #define GPIO_BITBAND_ADDR(reg, bit) (((uint32_t)&(reg) - 0x40000000) * 32 + (bit) * 4 + 0x42000000) 48 | #define GPIO_BITBAND_PTR(reg, bit) ((uint32_t *)GPIO_BITBAND_ADDR((reg), (bit))) 49 | 50 | #define _R(T) struct __gen_struct_ ## T 51 | #define _RD32(T) struct __gen_struct_ ## T { static __attribute__((always_inline)) inline reg32_t r() { return T; } \ 52 | template static __attribute__((always_inline)) inline ptr_reg32_t rx() { return GPIO_BITBAND_PTR(T, BIT); } }; 53 | #define _IO32(L) _RD32(FGPIO ## L ## _PDOR); _RD32(FGPIO ## L ## _PSOR); _RD32(FGPIO ## L ## _PCOR); _RD32(GPIO ## L ## _PTOR); _RD32(FGPIO ## L ## _PDIR); _RD32(FGPIO ## L ## _PDDR); 54 | 55 | #define _DEFPIN_ARM(PIN, BIT, L) template<> class FastPin : public _ARMPIN {}; \ 57 | /* template<> class FastPinBB : public _ARMPIN_BITBAND {}; */ 59 | 60 | // Actual pin definitions 61 | #if defined(FASTLED_TEENSYLC) && defined(CORE_TEENSY) 62 | 63 | _IO32(A); _IO32(B); _IO32(C); _IO32(D); _IO32(E); 64 | 65 | #define MAX_PIN 26 66 | _DEFPIN_ARM(0, 16, B); _DEFPIN_ARM(1, 17, B); _DEFPIN_ARM(2, 0, D); _DEFPIN_ARM(3, 1, A); 67 | _DEFPIN_ARM(4, 2, A); _DEFPIN_ARM(5, 7, D); _DEFPIN_ARM(6, 4, D); _DEFPIN_ARM(7, 2, D); 68 | _DEFPIN_ARM(8, 3, D); _DEFPIN_ARM(9, 3, C); _DEFPIN_ARM(10, 4, C); _DEFPIN_ARM(11, 6, C); 69 | _DEFPIN_ARM(12, 7, C); _DEFPIN_ARM(13, 5, C); _DEFPIN_ARM(14, 1, D); _DEFPIN_ARM(15, 0, C); 70 | _DEFPIN_ARM(16, 0, B); _DEFPIN_ARM(17, 1, B); _DEFPIN_ARM(18, 3, B); _DEFPIN_ARM(19, 2, B); 71 | _DEFPIN_ARM(20, 5, D); _DEFPIN_ARM(21, 6, D); _DEFPIN_ARM(22, 1, C); _DEFPIN_ARM(23, 2, C); 72 | _DEFPIN_ARM(24, 20, E); _DEFPIN_ARM(25, 21, E); _DEFPIN_ARM(26, 30, E); 73 | 74 | #define SPI_DATA 11 75 | #define SPI_CLOCK 13 76 | // #define SPI1 (*(SPI_t *)0x4002D000) 77 | 78 | #define SPI2_DATA 0 79 | #define SPI2_CLOCK 20 80 | 81 | #define HAS_HARDWARE_PIN_SUPPORT 82 | #endif 83 | 84 | #endif // FASTLED_FORCE_SOFTWARE_PINS 85 | 86 | FASTLED_NAMESPACE_END 87 | 88 | #endif // __INC_FASTPIN_ARM_K20 89 | -------------------------------------------------------------------------------- /libraries/FastLED/platforms/arm/kl26/led_sysdefs_arm_kl26.h: -------------------------------------------------------------------------------- 1 | #ifndef __INC_LED_SYSDEFS_ARM_KL26_H 2 | #define __INC_LED_SYSDEFS_ARM_KL26_H 3 | 4 | #define FASTLED_TEENSYLC 5 | #define FASTLED_ARM 6 | #define FASTLED_ARM_M0_PLUS 7 | 8 | #ifndef INTERRUPT_THRESHOLD 9 | #define INTERRUPT_THRESHOLD 1 10 | #endif 11 | 12 | #define FASTLED_SPI_BYTE_ONLY 13 | 14 | // Default to allowing interrupts 15 | #ifndef FASTLED_ALLOW_INTERRUPTS 16 | #define FASTLED_ALLOW_INTERRUPTS 1 17 | #endif 18 | 19 | #if FASTLED_ALLOW_INTERRUPTS == 1 20 | #define FASTLED_ACCURATE_CLOCK 21 | #endif 22 | 23 | #if (F_CPU == 96000000) 24 | #define CLK_DBL 1 25 | #endif 26 | 27 | // Get some system include files 28 | #include 29 | #include // for cli/se definitions 30 | 31 | // Define the register types 32 | #if defined(ARDUINO) // && ARDUINO < 150 33 | typedef volatile uint8_t RoReg; /**< Read only 8-bit register (volatile const unsigned int) */ 34 | typedef volatile uint8_t RwReg; /**< Read-Write 8-bit register (volatile unsigned int) */ 35 | #endif 36 | 37 | extern volatile uint32_t systick_millis_count; 38 | # define MS_COUNTER systick_millis_count 39 | 40 | // Default to using PROGMEM since TEENSYLC provides it 41 | // even though all it does is ignore it. Just being 42 | // conservative here in case TEENSYLC changes. 43 | #ifndef FASTLED_USE_PROGMEM 44 | #define FASTLED_USE_PROGMEM 1 45 | #endif 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /libraries/FastLED/platforms/arm/nrf51/clockless_arm_nrf51.h: -------------------------------------------------------------------------------- 1 | #ifndef __INC_CLOCKLESS_ARM_NRF51 2 | #define __INC_CLOCKLESS_ARM_NRF51 3 | 4 | #if defined(NRF51) 5 | 6 | #include "nrf51_bitfields.h" 7 | #define FASTLED_HAS_CLOCKLESS 1 8 | 9 | #if (FASTLED_ALLOW_INTERRUPTS==1) 10 | #define SEI_CHK LED_TIMER->CC[0] = (WAIT_TIME * (F_CPU/1000000)); LED_TIMER->TASKS_CLEAR; LED_TIMER->EVENTS_COMPARE[0] = 0; 11 | #define CLI_CHK cli(); if(LED_TIMER->EVENTS_COMPARE[0]) { LED_TIMER->TASKS_STOP = 1; return 0; } 12 | #define INNER_SEI sei(); 13 | #else 14 | #define SEI_CHK 15 | #define CLI_CHK 16 | #define INNER_SEI delaycycles<1>(); 17 | #endif 18 | 19 | 20 | #include "platforms/arm/common/m0clockless.h" 21 | template 22 | class ClocklessController : public CPixelLEDController { 23 | typedef typename FastPinBB::port_ptr_t data_ptr_t; 24 | typedef typename FastPinBB::port_t data_t; 25 | 26 | data_t mPinMask; 27 | data_ptr_t mPort; 28 | CMinWait mWait; 29 | public: 30 | virtual void init() { 31 | FastPinBB::setOutput(); 32 | mPinMask = FastPinBB::mask(); 33 | mPort = FastPinBB::port(); 34 | } 35 | 36 | virtual uint16_t getMaxRefreshRate() const { return 400; } 37 | 38 | virtual void showPixels(PixelController & pixels) { 39 | mWait.wait(); 40 | cli(); 41 | if(!showRGBInternal(pixels)) { 42 | sei(); delayMicroseconds(WAIT_TIME); cli(); 43 | showRGBInternal(pixels); 44 | } 45 | sei(); 46 | mWait.mark(); 47 | } 48 | 49 | // This method is made static to force making register Y available to use for data on AVR - if the method is non-static, then 50 | // gcc will use register Y for the this pointer. 51 | static uint32_t showRGBInternal(PixelController pixels) { 52 | struct M0ClocklessData data; 53 | data.d[0] = pixels.d[0]; 54 | data.d[1] = pixels.d[1]; 55 | data.d[2] = pixels.d[2]; 56 | data.s[0] = pixels.mScale[0]; 57 | data.s[1] = pixels.mScale[1]; 58 | data.s[2] = pixels.mScale[2]; 59 | data.e[0] = pixels.e[0]; 60 | data.e[1] = pixels.e[1]; 61 | data.e[2] = pixels.e[2]; 62 | data.adj = pixels.mAdvance; 63 | 64 | typename FastPin::port_ptr_t portBase = FastPin::port(); 65 | 66 | // timer mode w/prescaler of 0 67 | LED_TIMER->MODE = TIMER_MODE_MODE_Timer; 68 | LED_TIMER->PRESCALER = 0; 69 | LED_TIMER->EVENTS_COMPARE[0] = 0; 70 | LED_TIMER->BITMODE = TIMER_BITMODE_BITMODE_16Bit; 71 | LED_TIMER->SHORTS = TIMER_SHORTS_COMPARE0_CLEAR_Msk; 72 | LED_TIMER->TASKS_START = 1; 73 | 74 | int ret = showLedData<4,8,T1,T2,T3,RGB_ORDER,WAIT_TIME>(portBase, FastPin::mask(), pixels.mData, pixels.mLen, &data); 75 | 76 | LED_TIMER->TASKS_STOP = 1; 77 | return ret; // 0x00FFFFFF - _VAL; 78 | } 79 | }; 80 | 81 | 82 | #endif // NRF51 83 | #endif // __INC_CLOCKLESS_ARM_NRF51 84 | -------------------------------------------------------------------------------- /libraries/FastLED/platforms/arm/nrf51/fastled_arm_nrf51.h: -------------------------------------------------------------------------------- 1 | #ifndef __INC_FASTLED_ARM_NRF51_H 2 | #define __INC_FASTLED_ARM_NRF51_H 3 | 4 | // Include the k20 headers 5 | #include "bitswap.h" 6 | #include "fastled_delay.h" 7 | #include "fastpin_arm_nrf51.h" 8 | #include "fastspi_arm_nrf51.h" 9 | #include "clockless_arm_nrf51.h" 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /libraries/FastLED/platforms/arm/nrf51/led_sysdefs_arm_nrf51.h: -------------------------------------------------------------------------------- 1 | #ifndef __LED_SYSDEFS_ARM_NRF51 2 | #define __LED_SYSDEFS_ARM_NRF51 3 | 4 | #ifndef NRF51 5 | #define NRF51 6 | #endif 7 | 8 | #define LED_TIMER NRF_TIMER1 9 | #define FASTLED_NO_PINMAP 10 | #define FASTLED_HAS_CLOCKLESS 11 | 12 | #define FASTLED_SPI_BYTE_ONLY 13 | 14 | #define FASTLED_ARM 15 | #define FASTLED_ARM_M0 16 | 17 | #ifndef F_CPU 18 | #define F_CPU 16000000 19 | #endif 20 | 21 | #include 22 | #include "nrf51.h" 23 | #include "core_cm0.h" 24 | 25 | typedef volatile uint32_t RoReg; 26 | typedef volatile uint32_t RwReg; 27 | typedef uint32_t prog_uint32_t; 28 | typedef uint8_t boolean; 29 | 30 | #define PROGMEM 31 | #define NO_PROGMEM 32 | #define NEED_CXX_BITS 33 | 34 | // Default to NOT using PROGMEM here 35 | #ifndef FASTLED_USE_PROGMEM 36 | #define FASTLED_USE_PROGMEM 0 37 | #endif 38 | 39 | #ifndef FASTLED_ALLOW_INTERRUPTS 40 | #define FASTLED_ALLOW_INTERRUPTS 1 41 | #endif 42 | 43 | #define cli() __disable_irq(); 44 | #define sei() __enable_irq(); 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /libraries/FastLED/platforms/arm/sam/clockless_arm_sam.h: -------------------------------------------------------------------------------- 1 | #ifndef __INC_CLOCKLESS_ARM_SAM_H 2 | #define __INC_CLOCKLESS_ARM_SAM_H 3 | 4 | FASTLED_NAMESPACE_BEGIN 5 | 6 | // Definition for a single channel clockless controller for the sam family of arm chips, like that used in the due and rfduino 7 | // See clockless.h for detailed info on how the template parameters are used. 8 | 9 | #if defined(__SAM3X8E__) 10 | 11 | 12 | #define TADJUST 0 13 | #define TOTAL ( (T1+TADJUST) + (T2+TADJUST) + (T3+TADJUST) ) 14 | 15 | #define FASTLED_HAS_CLOCKLESS 1 16 | 17 | template 18 | class ClocklessController : public CPixelLEDController { 19 | typedef typename FastPinBB::port_ptr_t data_ptr_t; 20 | typedef typename FastPinBB::port_t data_t; 21 | 22 | data_t mPinMask; 23 | data_ptr_t mPort; 24 | CMinWait mWait; 25 | public: 26 | virtual void init() { 27 | FastPinBB::setOutput(); 28 | mPinMask = FastPinBB::mask(); 29 | mPort = FastPinBB::port(); 30 | } 31 | 32 | virtual uint16_t getMaxRefreshRate() const { return 400; } 33 | 34 | protected: 35 | 36 | virtual void showPixels(PixelController & pixels) { 37 | mWait.wait(); 38 | if(!showRGBInternal(pixels)) { 39 | sei(); delayMicroseconds(WAIT_TIME); cli(); 40 | showRGBInternal(pixels); 41 | } 42 | mWait.mark(); 43 | } 44 | 45 | template __attribute__ ((always_inline)) inline static void writeBits(register uint32_t & next_mark, register data_ptr_t port, register uint8_t & b) { 46 | // Make sure we don't slot into a wrapping spot, this will delay up to 12.5µs for WS2812 47 | // bool bShift=0; 48 | // while(VAL < (TOTAL*10)) { bShift=true; } 49 | // if(bShift) { next_mark = (VAL-TOTAL); }; 50 | 51 | for(register uint32_t i = BITS; i > 0; i--) { 52 | // wait to start the bit, then set the pin high 53 | while(DUE_TIMER_VAL < next_mark); 54 | next_mark = (DUE_TIMER_VAL+TOTAL); 55 | *port = 1; 56 | 57 | // how long we want to wait next depends on whether or not our bit is set to 1 or 0 58 | if(b&0x80) { 59 | // we're a 1, wait until there's less than T3 clocks left 60 | while((next_mark - DUE_TIMER_VAL) > (T3)); 61 | } else { 62 | // we're a 0, wait until there's less than (T2+T3+slop) clocks left in this bit 63 | while((next_mark - DUE_TIMER_VAL) > (T2+T3+6+TADJUST+TADJUST)); 64 | } 65 | *port=0; 66 | b <<= 1; 67 | } 68 | } 69 | 70 | #define FORCE_REFERENCE(var) asm volatile( "" : : "r" (var) ) 71 | // This method is made static to force making register Y available to use for data on AVR - if the method is non-static, then 72 | // gcc will use register Y for the this pointer. 73 | static uint32_t showRGBInternal(PixelController pixels) { 74 | // Setup and start the clock 75 | TC_Configure(DUE_TIMER,DUE_TIMER_CHANNEL,TC_CMR_TCCLKS_TIMER_CLOCK1); 76 | pmc_enable_periph_clk(DUE_TIMER_ID); 77 | TC_Start(DUE_TIMER,DUE_TIMER_CHANNEL); 78 | 79 | register data_ptr_t port asm("r7") = FastPinBB::port(); FORCE_REFERENCE(port); 80 | *port = 0; 81 | 82 | // Setup the pixel controller and load/scale the first byte 83 | pixels.preStepFirstByteDithering(); 84 | uint8_t b = pixels.loadAndScale0(); 85 | 86 | uint32_t next_mark = (DUE_TIMER_VAL + (TOTAL)); 87 | while(pixels.has(1)) { 88 | pixels.stepDithering(); 89 | 90 | #if (FASTLED_ALLOW_INTERRUPTS == 1) 91 | cli(); 92 | if(DUE_TIMER_VAL > next_mark) { 93 | if((DUE_TIMER_VAL - next_mark) > ((WAIT_TIME-INTERRUPT_THRESHOLD)*CLKS_PER_US)) { sei(); TC_Stop(DUE_TIMER,DUE_TIMER_CHANNEL); return 0; } 94 | } 95 | #endif 96 | 97 | writeBits<8+XTRA0>(next_mark, port, b); 98 | 99 | b = pixels.loadAndScale1(); 100 | writeBits<8+XTRA0>(next_mark, port,b); 101 | 102 | b = pixels.loadAndScale2(); 103 | writeBits<8+XTRA0>(next_mark, port,b); 104 | 105 | b = pixels.advanceAndLoadAndScale0(); 106 | #if (FASTLED_ALLOW_INTERRUPTS == 1) 107 | sei(); 108 | #endif 109 | }; 110 | 111 | TC_Stop(DUE_TIMER,DUE_TIMER_CHANNEL); 112 | return DUE_TIMER_VAL; 113 | } 114 | }; 115 | 116 | #endif 117 | 118 | FASTLED_NAMESPACE_END 119 | 120 | #endif 121 | -------------------------------------------------------------------------------- /libraries/FastLED/platforms/arm/sam/fastled_arm_sam.h: -------------------------------------------------------------------------------- 1 | #ifndef __INC_FASTLED_ARM_SAM_H 2 | #define __INC_FASTLED_ARM_SAM_H 3 | 4 | // Include the sam headers 5 | #include "fastled_delay.h" 6 | #include "fastpin_arm_sam.h" 7 | #include "fastspi_arm_sam.h" 8 | #include "clockless_arm_sam.h" 9 | #include "clockless_block_arm_sam.h" 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /libraries/FastLED/platforms/arm/sam/led_sysdefs_arm_sam.h: -------------------------------------------------------------------------------- 1 | #ifndef __INC_LED_SYSDEFS_ARM_SAM_H 2 | #define __INC_LED_SYSDEFS_ARM_SAM_H 3 | 4 | 5 | #define FASTLED_ARM 6 | 7 | // Setup DUE timer defines/channels/etc... 8 | #ifndef DUE_TIMER_CHANNEL 9 | #define DUE_TIMER_GROUP 0 10 | #endif 11 | 12 | #ifndef DUE_TIMER_CHANNEL 13 | #define DUE_TIMER_CHANNEL 0 14 | #endif 15 | 16 | #define DUE_TIMER ((DUE_TIMER_GROUP==0) ? TC0 : ((DUE_TIMER_GROUP==1) ? TC1 : TC2)) 17 | #define DUE_TIMER_ID (ID_TC0 + (DUE_TIMER_GROUP*3) + DUE_TIMER_CHANNEL) 18 | #define DUE_TIMER_VAL (DUE_TIMER->TC_CHANNEL[DUE_TIMER_CHANNEL].TC_CV << 1) 19 | #define DUE_TIMER_RUNNING ((DUE_TIMER->TC_CHANNEL[DUE_TIMER_CHANNEL].TC_SR & TC_SR_CLKSTA) != 0) 20 | 21 | #ifndef INTERRUPT_THRESHOLD 22 | #define INTERRUPT_THRESHOLD 1 23 | #endif 24 | 25 | // Default to allowing interrupts 26 | #ifndef FASTLED_ALLOW_INTERRUPTS 27 | #define FASTLED_ALLOW_INTERRUPTS 1 28 | #endif 29 | 30 | #if FASTLED_ALLOW_INTERRUPTS == 1 31 | #define FASTLED_ACCURATE_CLOCK 32 | #endif 33 | 34 | // reusing/abusing cli/sei defs for due 35 | #define cli() __disable_irq(); __disable_fault_irq(); 36 | #define sei() __enable_irq(); __enable_fault_irq(); 37 | 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /libraries/FastLED/platforms/arm/stm32/clockless_arm_stm32.h: -------------------------------------------------------------------------------- 1 | #ifndef __INC_CLOCKLESS_ARM_STM32_H 2 | #define __INC_CLOCKLESS_ARM_STM32_H 3 | 4 | FASTLED_NAMESPACE_BEGIN 5 | // Definition for a single channel clockless controller for the stm32 family of chips, like that used in the spark core 6 | // See clockless.h for detailed info on how the template parameters are used. 7 | 8 | #define FASTLED_HAS_CLOCKLESS 1 9 | 10 | template 11 | class ClocklessController : public CPixelLEDController { 12 | typedef typename FastPin::port_ptr_t data_ptr_t; 13 | typedef typename FastPin::port_t data_t; 14 | 15 | data_t mPinMask; 16 | data_ptr_t mPort; 17 | CMinWait mWait; 18 | public: 19 | virtual void init() { 20 | FastPin::setOutput(); 21 | mPinMask = FastPin::mask(); 22 | mPort = FastPin::port(); 23 | } 24 | 25 | virtual uint16_t getMaxRefreshRate() const { return 400; } 26 | 27 | protected: 28 | 29 | virtual void showPixels(PixelController & pixels) { 30 | mWait.wait(); 31 | if(!showRGBInternal(pixels)) { 32 | sei(); delayMicroseconds(WAIT_TIME); cli(); 33 | showRGBInternal(pixels); 34 | } 35 | mWait.mark(); 36 | } 37 | 38 | #define _CYCCNT (*(volatile uint32_t*)(0xE0001004UL)) 39 | 40 | template __attribute__ ((always_inline)) inline static void writeBits(register uint32_t & next_mark, register data_ptr_t port, register data_t hi, register data_t lo, register uint8_t & b) { 41 | for(register uint32_t i = BITS-1; i > 0; i--) { 42 | while(_CYCCNT < (T1+T2+T3-20)); 43 | FastPin::fastset(port, hi); 44 | _CYCCNT = 4; 45 | if(b&0x80) { 46 | while(_CYCCNT < (T1+T2-20)); 47 | FastPin::fastset(port, lo); 48 | } else { 49 | while(_CYCCNT < (T1-10)); 50 | FastPin::fastset(port, lo); 51 | } 52 | b <<= 1; 53 | } 54 | 55 | while(_CYCCNT < (T1+T2+T3-20)); 56 | FastPin::fastset(port, hi); 57 | _CYCCNT = 4; 58 | 59 | if(b&0x80) { 60 | while(_CYCCNT < (T1+T2-20)); 61 | FastPin::fastset(port, lo); 62 | } else { 63 | while(_CYCCNT < (T1-10)); 64 | FastPin::fastset(port, lo); 65 | } 66 | } 67 | 68 | // This method is made static to force making register Y available to use for data on AVR - if the method is non-static, then 69 | // gcc will use register Y for the this pointer. 70 | static uint32_t showRGBInternal(PixelController pixels) { 71 | // Get access to the clock 72 | CoreDebug->DEMCR |= CoreDebug_DEMCR_TRCENA_Msk; 73 | DWT->CTRL |= DWT_CTRL_CYCCNTENA_Msk; 74 | DWT->CYCCNT = 0; 75 | 76 | register data_ptr_t port = FastPin::port(); 77 | register data_t hi = *port | FastPin::mask();; 78 | register data_t lo = *port & ~FastPin::mask();; 79 | *port = lo; 80 | 81 | // Setup the pixel controller and load/scale the first byte 82 | pixels.preStepFirstByteDithering(); 83 | register uint8_t b = pixels.loadAndScale0(); 84 | 85 | cli(); 86 | 87 | uint32_t next_mark = (T1+T2+T3); 88 | 89 | DWT->CYCCNT = 0; 90 | while(pixels.has(1)) { 91 | pixels.stepDithering(); 92 | #if (FASTLED_ALLOW_INTERRUPTS == 1) 93 | cli(); 94 | // if interrupts took longer than 45µs, punt on the current frame 95 | if(DWT->CYCCNT > next_mark) { 96 | if((DWT->CYCCNT-next_mark) > ((WAIT_TIME-INTERRUPT_THRESHOLD)*CLKS_PER_US)) { sei(); return 0; } 97 | } 98 | 99 | hi = *port | FastPin::mask(); 100 | lo = *port & ~FastPin::mask(); 101 | #endif 102 | 103 | // Write first byte, read next byte 104 | writeBits<8+XTRA0>(next_mark, port, hi, lo, b); 105 | b = pixels.loadAndScale1(); 106 | 107 | // Write second byte, read 3rd byte 108 | writeBits<8+XTRA0>(next_mark, port, hi, lo, b); 109 | b = pixels.loadAndScale2(); 110 | 111 | // Write third byte, read 1st byte of next pixel 112 | writeBits<8+XTRA0>(next_mark, port, hi, lo, b); 113 | b = pixels.advanceAndLoadAndScale0(); 114 | #if (FASTLED_ALLOW_INTERRUPTS == 1) 115 | sei(); 116 | #endif 117 | }; 118 | 119 | sei(); 120 | return DWT->CYCCNT; 121 | } 122 | }; 123 | 124 | FASTLED_NAMESPACE_END 125 | 126 | #endif 127 | -------------------------------------------------------------------------------- /libraries/FastLED/platforms/arm/stm32/fastled_arm_stm32.h: -------------------------------------------------------------------------------- 1 | #ifndef __INC_FASTLED_ARM_SAM_H 2 | #define __INC_FASTLED_ARM_SAM_H 3 | 4 | // Include the sam headers 5 | #include "fastled_delay.h" 6 | #include "fastpin_arm_stm32.h" 7 | // #include "fastspi_arm_stm32.h" 8 | #include "clockless_arm_stm32.h" 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /libraries/FastLED/platforms/arm/stm32/fastpin_arm_stm32.h: -------------------------------------------------------------------------------- 1 | #ifndef __FASTPIN_ARM_STM32_H 2 | #define __FASTPIN_ARM_STM32_H 3 | 4 | FASTLED_NAMESPACE_BEGIN 5 | 6 | #if defined(FASTLED_FORCE_SOFTWARE_PINS) 7 | #warning "Software pin support forced, pin access will be sloightly slower." 8 | #define NO_HARDWARE_PIN_SUPPORT 9 | #undef HAS_HARDWARE_PIN_SUPPORT 10 | 11 | #else 12 | 13 | /// Template definition for STM32 style ARM pins, providing direct access to the various GPIO registers. Note that this 14 | /// uses the full port GPIO registers. In theory, in some way, bit-band register access -should- be faster, however I have found 15 | /// that something about the way gcc does register allocation results in the bit-band code being slower. It will need more fine tuning. 16 | /// The registers are data output, set output, clear output, toggle output, input, and direction 17 | 18 | template class _ARMPIN { 19 | public: 20 | typedef volatile uint32_t * port_ptr_t; 21 | typedef uint32_t port_t; 22 | 23 | #if 0 24 | inline static void setOutput() { 25 | if(_BIT<8) { 26 | _CRL::r() = (_CRL::r() & (0xF << (_BIT*4)) | (0x1 << (_BIT*4)); 27 | } else { 28 | _CRH::r() = (_CRH::r() & (0xF << ((_BIT-8)*4))) | (0x1 << ((_BIT-8)*4)); 29 | } 30 | } 31 | inline static void setInput() { /* TODO */ } // TODO: preform MUX config { _PDDR::r() &= ~_MASK; } 32 | #endif 33 | 34 | inline static void setOutput() { pinMode(PIN, OUTPUT); } // TODO: perform MUX config { _PDDR::r() |= _MASK; } 35 | inline static void setInput() { pinMode(PIN, INPUT); } // TODO: preform MUX config { _PDDR::r() &= ~_MASK; } 36 | 37 | inline static void hi() __attribute__ ((always_inline)) { _GPIO::r()->BSRR = _MASK; } 38 | inline static void lo() __attribute__ ((always_inline)) { _GPIO::r()->BRR = _MASK; } 39 | // inline static void lo() __attribute__ ((always_inline)) { _GPIO::r()->BSRR = (_MASK<<16); } 40 | inline static void set(register port_t val) __attribute__ ((always_inline)) { _GPIO::r()->ODR = val; } 41 | 42 | inline static void strobe() __attribute__ ((always_inline)) { toggle(); toggle(); } 43 | 44 | inline static void toggle() __attribute__ ((always_inline)) { if(_GPIO::r()->ODR & _MASK) { lo(); } else { hi(); } } 45 | 46 | inline static void hi(register port_ptr_t port) __attribute__ ((always_inline)) { hi(); } 47 | inline static void lo(register port_ptr_t port) __attribute__ ((always_inline)) { lo(); } 48 | inline static void fastset(register port_ptr_t port, register port_t val) __attribute__ ((always_inline)) { *port = val; } 49 | 50 | inline static port_t hival() __attribute__ ((always_inline)) { return _GPIO::r()->ODR | _MASK; } 51 | inline static port_t loval() __attribute__ ((always_inline)) { return _GPIO::r()->ODR & ~_MASK; } 52 | inline static port_ptr_t port() __attribute__ ((always_inline)) { return &_GPIO::r()->ODR; } 53 | inline static port_ptr_t sport() __attribute__ ((always_inline)) { return &_GPIO::r()->BSRR; } 54 | inline static port_ptr_t cport() __attribute__ ((always_inline)) { return &_GPIO::r()->BRR; } 55 | inline static port_t mask() __attribute__ ((always_inline)) { return _MASK; } 56 | }; 57 | 58 | #define _R(T) struct __gen_struct_ ## T 59 | #define _RD32(T) struct __gen_struct_ ## T { static __attribute__((always_inline)) inline volatile GPIO_TypeDef * r() { return T; } }; 60 | 61 | #define _IO32(L) _RD32(GPIO ## L) 62 | 63 | #define _DEFPIN_ARM(PIN, BIT, L) template<> class FastPin : public _ARMPIN {}; 64 | 65 | // Actual pin definitions 66 | #if defined(SPARK) 67 | 68 | _IO32(A); _IO32(B); _IO32(C); _IO32(D); _IO32(E); _IO32(F); _IO32(G); 69 | 70 | 71 | #define MAX_PIN 19 72 | _DEFPIN_ARM(0, 7, B); 73 | _DEFPIN_ARM(1, 6, B); 74 | _DEFPIN_ARM(2, 5, B); 75 | _DEFPIN_ARM(3, 4, B); 76 | _DEFPIN_ARM(4, 3, B); 77 | _DEFPIN_ARM(5, 15, A); 78 | _DEFPIN_ARM(6, 14, A); 79 | _DEFPIN_ARM(7, 13, A); 80 | _DEFPIN_ARM(8, 8, A); 81 | _DEFPIN_ARM(9, 9, A); 82 | _DEFPIN_ARM(10, 0, A); 83 | _DEFPIN_ARM(11, 1, A); 84 | _DEFPIN_ARM(12, 4, A); 85 | _DEFPIN_ARM(13, 5, A); 86 | _DEFPIN_ARM(14, 6, A); 87 | _DEFPIN_ARM(15, 7, A); 88 | _DEFPIN_ARM(16, 0, B); 89 | _DEFPIN_ARM(17, 1, B); 90 | _DEFPIN_ARM(18, 3, A); 91 | _DEFPIN_ARM(19, 2, A); 92 | 93 | 94 | #define SPI_DATA 15 95 | #define SPI_CLOCK 13 96 | 97 | #define HAS_HARDWARE_PIN_SUPPORT 98 | 99 | #endif 100 | 101 | #endif // FASTLED_FORCE_SOFTWARE_PINS 102 | 103 | FASTLED_NAMESPACE_END 104 | 105 | #endif // __INC_FASTPIN_ARM_STM32 106 | -------------------------------------------------------------------------------- /libraries/FastLED/platforms/arm/stm32/led_sysdefs_arm_stm32.h: -------------------------------------------------------------------------------- 1 | #ifndef __INC_LED_SYSDEFS_ARM_SAM_H 2 | #define __INC_LED_SYSDEFS_ARM_SAM_H 3 | 4 | #include "application.h" 5 | 6 | #define FASTLED_NAMESPACE_BEGIN namespace NSFastLED { 7 | #define FASTLED_NAMESPACE_END } 8 | #define FASTLED_USING_NAMESPACE using namespace NSFastLED; 9 | 10 | #define FASTLED_ARM 11 | 12 | #ifndef INTERRUPT_THRESHOLD 13 | #define INTERRUPT_THRESHOLD 1 14 | #endif 15 | 16 | // Default to allowing interrupts 17 | #ifndef FASTLED_ALLOW_INTERRUPTS 18 | #define FASTLED_ALLOW_INTERRUPTS 0 19 | #endif 20 | 21 | #if FASTLED_ALLOW_INTERRUPTS == 1 22 | #define FASTLED_ACCURATE_CLOCK 23 | #endif 24 | 25 | // reusing/abusing cli/sei defs for due 26 | #define cli() __disable_irq(); __disable_fault_irq(); 27 | #define sei() __enable_irq(); __enable_fault_irq(); 28 | 29 | // pgmspace definitions 30 | #define PROGMEM 31 | #define pgm_read_dword(addr) (*(const unsigned long *)(addr)) 32 | #define pgm_read_dword_near(addr) pgm_read_dword(addr) 33 | 34 | // Default to NOT using PROGMEM here 35 | #ifndef FASTLED_USE_PROGMEM 36 | #define FASTLED_USE_PROGMEM 0 37 | #endif 38 | 39 | // data type defs 40 | typedef volatile uint8_t RoReg; /**< Read only 8-bit register (volatile const unsigned int) */ 41 | typedef volatile uint8_t RwReg; /**< Read-Write 8-bit register (volatile unsigned int) */ 42 | 43 | #define FASTLED_NO_PINMAP 44 | 45 | #define F_CPU 72000000 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /libraries/FastLED/platforms/avr/fastled_avr.h: -------------------------------------------------------------------------------- 1 | #ifndef __INC_FASTLED_AVR_H 2 | #define __INC_FASTLED_AVR_H 3 | 4 | #include "fastled_delay.h" 5 | #include "fastpin_avr.h" 6 | #include "fastspi_avr.h" 7 | #include "clockless_trinket.h" 8 | 9 | // Default to using PROGMEM 10 | #ifndef FASTLED_USE_PROGMEM 11 | #define FASTLED_USE_PROGMEM 1 12 | #endif 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /libraries/FastLED/platforms/avr/led_sysdefs_avr.h: -------------------------------------------------------------------------------- 1 | #ifndef __INC_LED_SYSDEFS_AVR_H 2 | #define __INC_LED_SYSDEFS_AVR_H 3 | 4 | #define FASTLED_AVR 5 | 6 | #ifndef INTERRUPT_THRESHOLD 7 | #define INTERRUPT_THRESHOLD 2 8 | #endif 9 | 10 | #define FASTLED_SPI_BYTE_ONLY 11 | 12 | #include 13 | #include // for cli/se definitions 14 | 15 | // Define the register types 16 | #if defined(ARDUINO) // && ARDUINO < 150 17 | typedef volatile uint8_t RoReg; /**< Read only 8-bit register (volatile const unsigned int) */ 18 | typedef volatile uint8_t RwReg; /**< Read-Write 8-bit register (volatile unsigned int) */ 19 | #endif 20 | 21 | 22 | // Default to disallowing interrupts (may want to gate this on teensy2 vs. other arm platforms, since the 23 | // teensy2 has a good, fast millis interrupt implementation) 24 | #ifndef FASTLED_ALLOW_INTERRUPTS 25 | #define FASTLED_ALLOW_INTERRUPTS 0 26 | #endif 27 | 28 | #if FASTLED_ALLOW_INTERRUPTS == 1 29 | #define FASTLED_ACCURATE_CLOCK 30 | #endif 31 | 32 | 33 | // Default to using PROGMEM here 34 | #ifndef FASTLED_USE_PROGMEM 35 | #define FASTLED_USE_PROGMEM 1 36 | #endif 37 | 38 | #if defined(ARDUINO_AVR_DIGISPARK) || defined(ARDUINO_AVR_DIGISPARKPRO) 39 | #ifndef NO_CORRECTION 40 | #define NO_CORRECTION 1 41 | #endif 42 | #endif 43 | 44 | extern "C" { 45 | # if defined(CORE_TEENSY) || defined(TEENSYDUINO) 46 | extern volatile unsigned long timer0_millis_count; 47 | # define MS_COUNTER timer0_millis_count 48 | # else 49 | extern volatile unsigned long timer0_millis; 50 | # define MS_COUNTER timer0_millis 51 | # endif 52 | }; 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /libraries/FastLED/platforms/esp/8266/clockless_esp8266.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | FASTLED_NAMESPACE_BEGIN 4 | 5 | #ifdef FASTLED_DEBUG_COUNT_FRAME_RETRIES 6 | extern uint32_t _frame_cnt; 7 | extern uint32_t _retry_cnt; 8 | #endif 9 | 10 | // Info on reading cycle counter from https://github.com/kbeckmann/nodemcu-firmware/blob/ws2812-dual/app/modules/ws2812.c 11 | __attribute__ ((always_inline)) inline static uint32_t __clock_cycles() { 12 | uint32_t cyc; 13 | __asm__ __volatile__ ("rsr %0,ccount":"=a" (cyc)); 14 | return cyc; 15 | } 16 | 17 | #define FASTLED_HAS_CLOCKLESS 1 18 | 19 | template 20 | class ClocklessController : public CPixelLEDController { 21 | typedef typename FastPin::port_ptr_t data_ptr_t; 22 | typedef typename FastPin::port_t data_t; 23 | 24 | data_t mPinMask; 25 | data_ptr_t mPort; 26 | CMinWait mWait; 27 | public: 28 | virtual void init() { 29 | FastPin::setOutput(); 30 | mPinMask = FastPin::mask(); 31 | mPort = FastPin::port(); 32 | } 33 | 34 | virtual uint16_t getMaxRefreshRate() const { return 400; } 35 | 36 | protected: 37 | 38 | virtual void showPixels(PixelController & pixels) { 39 | // mWait.wait(); 40 | int cnt = FASTLED_INTERRUPT_RETRY_COUNT; 41 | while((showRGBInternal(pixels)==0) && cnt--) { 42 | #ifdef FASTLED_DEBUG_COUNT_FRAME_RETRIES 43 | _retry_cnt++; 44 | #endif 45 | os_intr_unlock(); 46 | delayMicroseconds(WAIT_TIME); 47 | os_intr_lock(); 48 | } 49 | // mWait.mark(); 50 | } 51 | 52 | #define _ESP_ADJ (0) 53 | #define _ESP_ADJ2 (0) 54 | 55 | template __attribute__ ((always_inline)) inline static void writeBits(register uint32_t & last_mark, register uint32_t b) { 56 | b = ~b; b <<= 24; 57 | for(register uint32_t i = BITS; i > 0; i--) { 58 | while((__clock_cycles() - last_mark) < (T1+T2+T3)); 59 | last_mark = __clock_cycles(); 60 | FastPin::hi(); 61 | 62 | while((__clock_cycles() - last_mark) < T1); 63 | if(b & 0x80000000L) { FastPin::lo(); } 64 | b <<= 1; 65 | 66 | while((__clock_cycles() - last_mark) < (T1+T2)); 67 | FastPin::lo(); 68 | } 69 | } 70 | 71 | // This method is made static to force making register Y available to use for data on AVR - if the method is non-static, then 72 | // gcc will use register Y for the this pointer. 73 | static uint32_t ICACHE_RAM_ATTR showRGBInternal(PixelController pixels) { 74 | // Setup the pixel controller and load/scale the first byte 75 | pixels.preStepFirstByteDithering(); 76 | register uint32_t b = pixels.loadAndScale0(); 77 | pixels.preStepFirstByteDithering(); 78 | os_intr_lock(); 79 | uint32_t start = __clock_cycles(); 80 | uint32_t last_mark = start; 81 | while(pixels.has(1)) { 82 | // Write first byte, read next byte 83 | writeBits<8+XTRA0>(last_mark, b); 84 | b = pixels.loadAndScale1(); 85 | 86 | // Write second byte, read 3rd byte 87 | writeBits<8+XTRA0>(last_mark, b); 88 | b = pixels.loadAndScale2(); 89 | 90 | // Write third byte, read 1st byte of next pixel 91 | writeBits<8+XTRA0>(last_mark, b); 92 | b = pixels.advanceAndLoadAndScale0(); 93 | 94 | #if (FASTLED_ALLOW_INTERRUPTS == 1) 95 | os_intr_unlock(); 96 | #endif 97 | 98 | pixels.stepDithering(); 99 | 100 | #if (FASTLED_ALLOW_INTERRUPTS == 1) 101 | os_intr_lock(); 102 | // if interrupts took longer than 45µs, punt on the current frame 103 | if((int32_t)(__clock_cycles()-last_mark) > 0) { 104 | if((int32_t)(__clock_cycles()-last_mark) > (T1+T2+T3+((WAIT_TIME-INTERRUPT_THRESHOLD)*CLKS_PER_US))) { sei(); return 0; } 105 | } 106 | #endif 107 | }; 108 | 109 | os_intr_unlock(); 110 | #ifdef FASTLED_DEBUG_COUNT_FRAME_RETRIES 111 | _frame_cnt++; 112 | #endif 113 | return __clock_cycles() - start; 114 | } 115 | }; 116 | 117 | FASTLED_NAMESPACE_END 118 | -------------------------------------------------------------------------------- /libraries/FastLED/platforms/esp/8266/fastled_esp8266.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "bitswap.h" 4 | #include "fastled_delay.h" 5 | #include "fastpin_esp8266.h" 6 | #include "clockless_esp8266.h" 7 | #include "clockless_block_esp8266.h" 8 | -------------------------------------------------------------------------------- /libraries/FastLED/platforms/esp/8266/fastpin_esp8266.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | FASTLED_NAMESPACE_BEGIN 4 | 5 | struct FASTLED_ESP_IO { 6 | volatile uint32_t _GPO; 7 | volatile uint32_t _GPOS; 8 | volatile uint32_t _GPOC; 9 | }; 10 | 11 | #define _GPB (*(FASTLED_ESP_IO*)(0x60000000+(0x300))) 12 | 13 | 14 | template class _ESPPIN { 15 | 16 | public: 17 | typedef volatile uint32_t * port_ptr_t; 18 | typedef uint32_t port_t; 19 | 20 | inline static void setOutput() { pinMode(PIN, OUTPUT); } 21 | inline static void setInput() { pinMode(PIN, INPUT); } 22 | 23 | inline static void hi() __attribute__ ((always_inline)) { if(PIN < 16) { _GPB._GPOS = MASK; } else { GP16O |= MASK; } } 24 | inline static void lo() __attribute__ ((always_inline)) { if(PIN < 16) { _GPB._GPOC = MASK; } else { GP16O &= ~MASK; } } 25 | inline static void set(register port_t val) __attribute__ ((always_inline)) { if(PIN < 16) { _GPB._GPO = val; } else { GP16O = val; }} 26 | 27 | inline static void strobe() __attribute__ ((always_inline)) { toggle(); toggle(); } 28 | 29 | inline static void toggle() __attribute__ ((always_inline)) { if(PIN < 16) { _GPB._GPO ^= MASK; } else { GP16O ^= MASK; } } 30 | 31 | inline static void hi(register port_ptr_t port) __attribute__ ((always_inline)) { hi(); } 32 | inline static void lo(register port_ptr_t port) __attribute__ ((always_inline)) { lo(); } 33 | inline static void fastset(register port_ptr_t port, register port_t val) __attribute__ ((always_inline)) { *port = val; } 34 | 35 | inline static port_t hival() __attribute__ ((always_inline)) { if (PIN<16) { return GPO | MASK; } else { return GP16O | MASK; } } 36 | inline static port_t loval() __attribute__ ((always_inline)) { if (PIN<16) { return GPO & ~MASK; } else { return GP16O & ~MASK; } } 37 | inline static port_ptr_t port() __attribute__ ((always_inline)) { if(PIN<16) { return &_GPB._GPO; } else { return &GP16O; } } 38 | inline static port_ptr_t sport() __attribute__ ((always_inline)) { return &_GPB._GPOS; } // there is no GP160 support for this 39 | inline static port_ptr_t cport() __attribute__ ((always_inline)) { return &_GPB._GPOC; } 40 | inline static port_t mask() __attribute__ ((always_inline)) { return MASK; } 41 | 42 | inline static bool isset() __attribute__ ((always_inline)) { return (PIN < 16) ? (GPO & MASK) : (GP16O & MASK); } 43 | }; 44 | 45 | #define _DEFPIN_ESP8266(PIN, REAL_PIN) template<> class FastPin : public _ESPPIN {}; 46 | 47 | 48 | #ifdef FASTLED_ESP8266_RAW_PIN_ORDER 49 | #define MAX_PIN 16 50 | _DEFPIN_ESP8266(0,0); _DEFPIN_ESP8266(1,1); _DEFPIN_ESP8266(2,2); _DEFPIN_ESP8266(3,3); 51 | _DEFPIN_ESP8266(4,4); _DEFPIN_ESP8266(5,5); 52 | 53 | // These pins should be disabled, as they always cause WDT resets 54 | // _DEFPIN_ESP8266(6,6); _DEFPIN_ESP8266(7,7); 55 | // _DEFPIN_ESP8266(8,8); _DEFPIN_ESP8266(9,9); _DEFPIN_ESP8266(10,10); _DEFPIN_ESP8266(11,11); 56 | 57 | _DEFPIN_ESP8266(12,12); _DEFPIN_ESP8266(13,13); _DEFPIN_ESP8266(14,14); _DEFPIN_ESP8266(15,15); 58 | _DEFPIN_ESP8266(16,16); 59 | 60 | #define PORTA_FIRST_PIN 12 61 | #elif defined(FASTLED_ESP8266_D1_PIN_ORDER) 62 | #define MAX_PIN 15 63 | _DEFPIN_ESP8266(0,3); 64 | _DEFPIN_ESP8266(1,1); 65 | _DEFPIN_ESP8266(2,16); 66 | _DEFPIN_ESP8266(3,5); 67 | _DEFPIN_ESP8266(4,4); 68 | _DEFPIN_ESP8266(5,14); 69 | _DEFPIN_ESP8266(6,12); 70 | _DEFPIN_ESP8266(7,13); 71 | _DEFPIN_ESP8266(8,0); 72 | _DEFPIN_ESP8266(9,2); 73 | _DEFPIN_ESP8266(10,15); 74 | _DEFPIN_ESP8266(11,13); 75 | _DEFPIN_ESP8266(12,12); 76 | _DEFPIN_ESP8266(13,14); 77 | _DEFPIN_ESP8266(14,4); 78 | _DEFPIN_ESP8266(15,5); 79 | 80 | #define PORTA_FIRST_PIN 12 81 | 82 | #else // if defined(FASTLED_ESP8266_NODEMCU_PIN_ORDER) 83 | #define MAX_PIN 10 84 | 85 | // This seems to be the standard Dxx pin mapping on most of the esp boards that i've found 86 | _DEFPIN_ESP8266(0,16); _DEFPIN_ESP8266(1,5); _DEFPIN_ESP8266(2,4); _DEFPIN_ESP8266(3,0); 87 | _DEFPIN_ESP8266(4,2); _DEFPIN_ESP8266(5,14); _DEFPIN_ESP8266(6,12); _DEFPIN_ESP8266(7,13); 88 | _DEFPIN_ESP8266(8,15); _DEFPIN_ESP8266(9,3); _DEFPIN_ESP8266(10,1); 89 | 90 | #define PORTA_FIRST_PIN 6 91 | 92 | // The rest of the pins - these are generally not available 93 | // _DEFPIN_ESP8266(11,6); 94 | // _DEFPIN_ESP8266(12,7); _DEFPIN_ESP8266(13,8); _DEFPIN_ESP8266(14,9); _DEFPIN_ESP8266(15,10); 95 | // _DEFPIN_ESP8266(16,11); 96 | 97 | #endif 98 | 99 | #define HAS_HARDWARE_PIN_SUPPORT 100 | 101 | #define FASTLED_NAMESPACE_END 102 | -------------------------------------------------------------------------------- /libraries/FastLED/platforms/esp/8266/led_sysdefs_esp8266.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef ESP8266 4 | #define ESP8266 5 | #endif 6 | 7 | #define FASTLED_ESP8266 8 | 9 | // Use system millis timer 10 | #define FASTLED_HAS_MILLIS 11 | 12 | typedef volatile uint32_t RoReg; 13 | typedef volatile uint32_t RwReg; 14 | typedef uint32_t prog_uint32_t; 15 | typedef uint8_t boolean; 16 | 17 | // Default to NOT using PROGMEM here 18 | #ifndef FASTLED_USE_PROGMEM 19 | # define FASTLED_USE_PROGMEM 0 20 | #endif 21 | 22 | #ifndef FASTLED_ALLOW_INTERRUPTS 23 | # define FASTLED_ALLOW_INTERRUPTS 1 24 | # define INTERRUPT_THRESHOLD 0 25 | #endif 26 | 27 | #define NEED_CXX_BITS 28 | 29 | // These can be overridden 30 | #if !defined(FASTLED_ESP8266_RAW_PIN_ORDER) && !defined(FASTLED_ESP8266_NODEMCU_PIN_ORDER) && !defined(FASTLED_ESP8266_D1_PIN_ORDER) 31 | # ifdef ARDUINO_ESP8266_NODEMCU 32 | # define FASTLED_ESP8266_NODEMCU_PIN_ORDER 33 | # else 34 | # define FASTLED_ESP8266_RAW_PIN_ORDER 35 | # endif 36 | #endif 37 | 38 | // #define cli() os_intr_lock(); 39 | // #define sei() os_intr_lock(); 40 | -------------------------------------------------------------------------------- /libraries/FastLED/power_mgt.h: -------------------------------------------------------------------------------- 1 | #ifndef POWER_MGT_H 2 | #define POWER_MGT_H 3 | 4 | #include "FastLED.h" 5 | 6 | #include "pixeltypes.h" 7 | 8 | FASTLED_NAMESPACE_BEGIN 9 | 10 | ///@defgroup Power Power management functions 11 | /// functions used to limit the amount of power used by FastLED 12 | ///@{ 13 | 14 | // Power Control setup functions 15 | // 16 | // Example: 17 | // set_max_power_in_volts_and_milliamps( 5, 400); 18 | // 19 | 20 | /// Set the maximum power used in milliamps for a given voltage 21 | /// @deprecated - use FastLED.setMaxPowerInVoltsAndMilliamps() 22 | void set_max_power_in_volts_and_milliamps( uint8_t volts, uint32_t milliamps); 23 | /// Set the maximum power used in watts 24 | void set_max_power_in_milliwatts( uint32_t powerInmW); 25 | 26 | /// Select a ping with an led that will be flashed to indicate that power management 27 | /// is pulling down the brightness 28 | /// @deprecated - use FastLED.setMaxPowerInMilliWatts 29 | void set_max_power_indicator_LED( uint8_t pinNumber); // zero = no indicator LED 30 | 31 | 32 | // Power Control 'show' and 'delay' functions 33 | // 34 | // These are drop-in replacements for FastLED.show() and FastLED.delay() 35 | // In order to use these, you have to actually replace your calls to 36 | // FastLED.show() and FastLED.delay() with these two functions. 37 | // 38 | // Example: 39 | // // was: FastLED.show(); 40 | // // now is: 41 | // show_at_max_brightness_for_power(); 42 | // 43 | 44 | /// Similar to FastLED.show, but pre-adjusts brightness to keep below the power 45 | /// threshold. 46 | /// @deprecated this has now been moved to FastLED.show(); 47 | void show_at_max_brightness_for_power(); 48 | /// Similar to FastLED.delay, but pre-adjusts brightness to keep below the power 49 | /// threshold. 50 | /// @deprecated this has now been rolled into FastLED.delay(); 51 | void delay_at_max_brightness_for_power( uint16_t ms); 52 | 53 | 54 | // Power Control internal helper functions 55 | 56 | /// calculate_unscaled_power_mW tells you how many milliwatts the current 57 | /// LED data would draw at brightness = 255. 58 | /// 59 | uint32_t calculate_unscaled_power_mW( const CRGB* ledbuffer, uint16_t numLeds); 60 | 61 | /// calculate_max_brightness_for_power_mW tells you the highest brightness 62 | /// level you can use and still stay under the specified power budget for 63 | /// a given set of leds. It takes a pointer to an array of CRGB objects, a 64 | /// count, a 'target brightness' which is the brightness you'd ideally like 65 | /// to use, and the max power draw desired in milliwatts. The result from 66 | /// this function will be no higher than the target_brightess you supply, but may be lower. 67 | uint8_t calculate_max_brightness_for_power_mW(const CRGB* ledbuffer, uint16_t numLeds, uint8_t target_brightness, uint32_t max_power_mW); 68 | 69 | /// calculate_max_brightness_for_power_mW tells you the highest brightness 70 | /// level you can use and still stay under the specified power budget for 71 | /// a given set of leds. It takes a pointer to an array of CRGB objects, a 72 | /// count, a 'target brightness' which is the brightness you'd ideally like 73 | /// to use, and the max power in volts and milliamps. The result from this 74 | /// function will be no higher than the target_brightess you supply, but may be lower. 75 | uint8_t calculate_max_brightness_for_power_vmA(const CRGB* ledbuffer, uint16_t numLeds, uint8_t target_brightness, uint32_t max_power_V, uint32_t max_power_mA); 76 | 77 | /// calculate_max_brightness_for_power_mW tells you the highest brightness 78 | /// level you can use and still stay under the specified power budget. It 79 | /// takes a 'target brightness' which is the brightness you'd ideally like 80 | /// to use. The result from this function will be no higher than the 81 | /// target_brightess you supply, but may be lower. 82 | uint8_t calculate_max_brightness_for_power_mW( uint8_t target_brightness, uint32_t max_power_mW); 83 | 84 | FASTLED_NAMESPACE_END 85 | ///@} 86 | // POWER_MGT_H 87 | 88 | #endif 89 | -------------------------------------------------------------------------------- /libraries/FastLED/preview_changes.txt: -------------------------------------------------------------------------------- 1 | FastLED 3.1 preview changes: 2 | * UART in SPI mode support on AVR 3 | * Support for using both hardware SPI pinsets on the Teensy 3.x - 11/13 and 7/14. 4 | * Added UCS1904 support 5 | * Better AVR cycle counting 6 | * Split WS2812/WS2811 timings 7 | * Added DOTSTAR definition for adafruit dotstar pixels (aka APA102) 8 | * 8-way parallel output on teensy 3, 3.1 (portc,portd), due/digix (porta, portb, portd) 9 | * 12-way parallel output on teensy 3, 3.1 (portc) 10 | * 16-way parallel output on teensy 3, 3.1 (portc & portd paired) 11 | * refresh rate limiting 12 | * interrupt friendly code on teensy 3/3.1 13 | * -interrupt friendly code on AVR- <-- disabled for now 14 | * interrupt friendly code on the due 15 | * code re-org for future wider platform support 16 | * Spark Core support 17 | * arduino zero support (no hardware spi yet) 18 | * greatly improved clockless output for avr 19 | * greatly improved clockless output for arm m0 boards 20 | -------------------------------------------------------------------------------- /libraries/FastLED/smartmatrix_t3.h: -------------------------------------------------------------------------------- 1 | #ifndef __INC_SMARTMATRIX_T3_H 2 | #define __INC_SMARTMATRIX_T3_H 3 | 4 | #ifdef SmartMatrix_h 5 | #include 6 | 7 | extern SmartMatrix *pSmartMatrix; 8 | 9 | // note - dmx simple must be included before FastSPI for this code to be enabled 10 | class CSmartMatrixController : public CLEDController { 11 | SmartMatrix matrix; 12 | 13 | public: 14 | // initialize the LED controller 15 | virtual void init() { 16 | // Initialize 32x32 LED Matrix 17 | matrix.begin(); 18 | matrix.setBrightness(255); 19 | matrix.setColorCorrection(ccNone); 20 | 21 | // Clear screen 22 | clearLeds(0); 23 | matrix.swapBuffers(); 24 | pSmartMatrix = &matrix; 25 | } 26 | 27 | // clear out/zero out the given number of leds. 28 | virtual void clearLeds(int nLeds) { 29 | const rgb24 black = {0,0,0}; 30 | matrix.fillScreen(black); 31 | matrix.swapBuffers(); 32 | } 33 | 34 | // set all the leds on the controller to a given color 35 | virtual void showColor(const struct CRGB & data, int nLeds,CRGB scale) { 36 | PixelController pixels(data, nLeds, scale, getDither()); 37 | rgb24 *md = matrix.backBuffer(); 38 | while(nLeds--) { 39 | md->red = pixels.loadAndScale0(); 40 | md->green = pixels.loadAndScale1(); 41 | md->blue = pixels.loadAndScale2(); 42 | md++; 43 | pixels.stepDithering(); 44 | } 45 | matrix.swapBuffers(); 46 | } 47 | 48 | // note that the uint8_ts will be in the order that you want them sent out to the device. 49 | // nLeds is the number of RGB leds being written to 50 | virtual void show(const struct CRGB *data, int nLeds, CRGB scale) { 51 | PixelController pixels(data, nLeds, scale, getDither()); 52 | #ifdef SMART_MATRIX_CAN_TRIPLE_BUFFER 53 | rgb24 *md = matrix.getRealBackBuffer(); 54 | #else 55 | rgb24 *md = matrix.backBuffer(); 56 | #endif 57 | while(nLeds--) { 58 | md->red = pixels.loadAndScale0(); 59 | md->green = pixels.loadAndScale1(); 60 | md->blue = pixels.loadAndScale2(); 61 | md++; 62 | pixels.advanceData(); 63 | pixels.stepDithering(); 64 | } 65 | matrix.swapBuffers(); 66 | #ifdef SMART_MATRIX_CAN_TRIPLE_BUFFER 67 | matrix.setBackBuffer((rgb24*)data); 68 | #endif 69 | } 70 | 71 | #ifdef SUPPORT_ARGB 72 | // as above, but every 4th uint8_t is assumed to be alpha channel data, and will be skipped 73 | virtual void show(const struct CARGB *data, int nLeds, CRGB scale) = 0; 74 | #endif 75 | }; 76 | 77 | #endif 78 | 79 | #endif 80 | -------------------------------------------------------------------------------- /libraries/TeecesControl/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map For LedControl 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | LedControl KEYWORD1 10 | 11 | ####################################### 12 | # Methods and Functions (KEYWORD2) 13 | ####################################### 14 | 15 | shutdown KEYWORD2 16 | setScanLimit KEYWORD2 17 | setIntensity KEYWORD2 18 | clearDisplay KEYWORD2 19 | setLed KEYWORD2 20 | setRow KEYWORD2 21 | setColumn KEYWORD2 22 | setDigit KEYWORD2 23 | setChar KEYWORD2 24 | 25 | ####################################### 26 | # Constants (LITERAL1) 27 | ####################################### 28 | 29 | -------------------------------------------------------------------------------- /wreactor32_firmware/LEngine_20211009.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joymonkey/logicengine/b7f17ec6ea922488af02227f457b47cb958590fd/wreactor32_firmware/LEngine_20211009.bin -------------------------------------------------------------------------------- /wreactor32_firmware/LEngine_20211013.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joymonkey/logicengine/b7f17ec6ea922488af02227f457b47cb958590fd/wreactor32_firmware/LEngine_20211013.bin -------------------------------------------------------------------------------- /wreactor32_firmware/LEngine_20211016.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joymonkey/logicengine/b7f17ec6ea922488af02227f457b47cb958590fd/wreactor32_firmware/LEngine_20211016.bin -------------------------------------------------------------------------------- /wreactor32_firmware/LEngine_20220410.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joymonkey/logicengine/b7f17ec6ea922488af02227f457b47cb958590fd/wreactor32_firmware/LEngine_20220410.bin -------------------------------------------------------------------------------- /wreactor32_firmware/LEngine_20220426.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joymonkey/logicengine/b7f17ec6ea922488af02227f457b47cb958590fd/wreactor32_firmware/LEngine_20220426.bin -------------------------------------------------------------------------------- /wreactor32_firmware/LEngine_250302.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joymonkey/logicengine/b7f17ec6ea922488af02227f457b47cb958590fd/wreactor32_firmware/LEngine_250302.bin -------------------------------------------------------------------------------- /wreactor32_rework/rework1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joymonkey/logicengine/b7f17ec6ea922488af02227f457b47cb958590fd/wreactor32_rework/rework1.jpg -------------------------------------------------------------------------------- /wreactor32_rework/rework2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joymonkey/logicengine/b7f17ec6ea922488af02227f457b47cb958590fd/wreactor32_rework/rework2.jpg -------------------------------------------------------------------------------- /wreactor32_rework/rework3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joymonkey/logicengine/b7f17ec6ea922488af02227f457b47cb958590fd/wreactor32_rework/rework3.jpg -------------------------------------------------------------------------------- /wreactor32_rework/rework4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joymonkey/logicengine/b7f17ec6ea922488af02227f457b47cb958590fd/wreactor32_rework/rework4.jpg -------------------------------------------------------------------------------- /wreactor32_rework/rework5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joymonkey/logicengine/b7f17ec6ea922488af02227f457b47cb958590fd/wreactor32_rework/rework5.jpg --------------------------------------------------------------------------------