├── LICENSE ├── NOTES.md ├── README.md ├── blink ├── CMakeLists.txt ├── Makefile ├── README.md ├── example_test.py ├── main │ ├── CMakeLists.txt │ ├── Kconfig.projbuild │ ├── blink.c │ └── component.mk └── sdkconfig.defaults ├── fanc ├── CMakeLists.txt ├── Makefile ├── README.md ├── components │ └── WiFiMulti-idf │ │ ├── CMakeLists.txt │ │ ├── Kconfig │ │ ├── LICENSE │ │ ├── WiFiMulti-idf.c │ │ ├── component.mk │ │ └── include │ │ └── WiFiMulti-idf.h ├── main │ ├── CMakeLists.txt │ ├── cheese.jpg │ ├── component.mk │ ├── fanc.cpp │ ├── fanc.h │ ├── fanc_main.cpp │ ├── fanc_server.cpp │ ├── index.html │ └── jquery.min.js ├── partitions.csv └── sdkconfig ├── hello_world ├── CMakeLists.txt ├── Makefile ├── README.md └── main │ ├── CMakeLists.txt │ ├── component.mk │ └── hello_world_main.c ├── led_strip ├── CMakeLists.txt ├── README.md ├── components │ └── led_strip │ │ ├── CMakeLists.txt │ │ ├── component.mk │ │ ├── include │ │ └── led_strip.h │ │ └── src │ │ └── led_strip_rmt_ws2812.c ├── main │ ├── CMakeLists.txt │ ├── Kconfig.projbuild │ ├── component.mk │ └── led_strip_main.c └── sdkconfig ├── ledc ├── CMakeLists.txt ├── Makefile ├── README.md ├── components │ ├── FastLED-idf │ │ ├── CMakeLists.txt │ │ ├── ESP-IDF.md │ │ ├── FastLED.cpp │ │ ├── FastLED.h │ │ ├── Kconfig │ │ ├── LICENSE │ │ ├── PORTING.md │ │ ├── README.md │ │ ├── bitswap.cpp │ │ ├── bitswap.h │ │ ├── chipsets.h │ │ ├── color.h │ │ ├── colorpalettes.cpp │ │ ├── colorpalettes.h │ │ ├── colorutils.cpp │ │ ├── colorutils.h │ │ ├── component.mk │ │ ├── controller.h │ │ ├── cpp_compat.h │ │ ├── dmx.h │ │ ├── fastled_config.h │ │ ├── fastled_delay.h │ │ ├── fastled_progmem.h │ │ ├── fastpin.h │ │ ├── fastspi.h │ │ ├── fastspi_bitbang.h │ │ ├── fastspi_dma.h │ │ ├── fastspi_nop.h │ │ ├── fastspi_ref.h │ │ ├── fastspi_types.h │ │ ├── hal │ │ │ ├── LICENSE.md │ │ │ ├── README.md │ │ │ ├── esp32-hal-cpu.h │ │ │ ├── esp32-hal-gpio.c │ │ │ ├── esp32-hal-gpio.h │ │ │ ├── esp32-hal-i2c.h │ │ │ ├── esp32-hal-log.h │ │ │ ├── esp32-hal-misc.c │ │ │ ├── esp32-hal-timer.h │ │ │ └── esp32-hal.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.cpp │ │ ├── platforms.h │ │ ├── platforms │ │ │ └── esp │ │ │ │ └── 32 │ │ │ │ ├── clockless_block_esp32.h │ │ │ │ ├── clockless_i2s_esp32.h │ │ │ │ ├── clockless_rmt_esp32.cpp │ │ │ │ ├── clockless_rmt_esp32.h │ │ │ │ ├── fastled_esp32.h │ │ │ │ ├── fastpin_esp32.h │ │ │ │ ├── fastspi_esp32.h │ │ │ │ └── led_sysdefs_esp32.h │ │ ├── power_mgt.cpp │ │ ├── power_mgt.h │ │ ├── release_notes.md │ │ └── wiring.cpp │ ├── WS2812FX-idf │ │ ├── CMakeLists.txt │ │ ├── FX.cpp │ │ ├── FX.h │ │ ├── FX_fcn.cpp │ │ ├── LICENSE │ │ ├── README.md │ │ ├── component.mk │ │ └── palettes.h │ └── WiFiMulti-idf │ │ ├── CMakeLists.txt │ │ ├── Kconfig │ │ ├── LICENSE │ │ ├── WiFiMulti-idf.c │ │ ├── component.mk │ │ └── include │ │ └── WiFiMulti-idf.h ├── main │ ├── CMakeLists.txt │ ├── component.mk │ ├── index.html │ ├── jquery.min.js │ ├── ledc.cpp │ ├── ledc.h │ ├── ledc_main.cpp │ ├── ledc_server.cpp │ └── palettes.h ├── partitions.csv └── sdkconfig ├── ledc2 ├── CMakeLists.txt ├── Makefile ├── README.md ├── components │ ├── WiFiMulti-idf │ │ ├── CMakeLists.txt │ │ ├── Kconfig │ │ ├── LICENSE │ │ ├── WiFiMulti-idf.c │ │ ├── component.mk │ │ └── include │ │ │ └── WiFiMulti-idf.h │ └── led_strip │ │ ├── CMakeLists.txt │ │ ├── component.mk │ │ ├── include │ │ └── led_strip.h │ │ └── src │ │ └── led_strip_rmt_ws2812.c ├── main │ ├── CMakeLists.txt │ ├── component.mk │ ├── index.html │ ├── jquery.min.js │ ├── ledc.cpp │ ├── ledc.h │ ├── ledc_main.cpp │ ├── ledc_server.cpp │ └── palettes.h ├── partitions.csv └── sdkconfig ├── scan ├── CMakeLists.txt ├── Makefile ├── README.md └── main │ ├── CMakeLists.txt │ ├── Kconfig.projbuild │ ├── component.mk │ └── scan.c ├── sign ├── CMakeLists.txt ├── Makefile ├── README.md ├── components │ └── FastLED-idf │ │ ├── CMakeLists.txt │ │ ├── ESP-IDF.md │ │ ├── FastLED.cpp │ │ ├── FastLED.h │ │ ├── Kconfig │ │ ├── LICENSE │ │ ├── PORTING.md │ │ ├── README.md │ │ ├── bitswap.cpp │ │ ├── bitswap.h │ │ ├── chipsets.h │ │ ├── color.h │ │ ├── colorpalettes.cpp │ │ ├── colorpalettes.h │ │ ├── colorutils.cpp │ │ ├── colorutils.h │ │ ├── component.mk │ │ ├── controller.h │ │ ├── cpp_compat.h │ │ ├── dmx.h │ │ ├── fastled_config.h │ │ ├── fastled_delay.h │ │ ├── fastled_progmem.h │ │ ├── fastpin.h │ │ ├── fastspi.h │ │ ├── fastspi_bitbang.h │ │ ├── fastspi_dma.h │ │ ├── fastspi_nop.h │ │ ├── fastspi_ref.h │ │ ├── fastspi_types.h │ │ ├── hal │ │ ├── LICENSE.md │ │ ├── README.md │ │ ├── esp32-hal-cpu.h │ │ ├── esp32-hal-gpio.c │ │ ├── esp32-hal-gpio.h │ │ ├── esp32-hal-i2c.h │ │ ├── esp32-hal-log.h │ │ ├── esp32-hal-misc.c │ │ ├── esp32-hal-rmt.c │ │ ├── esp32-hal-rmt.h │ │ ├── esp32-hal-spi.c │ │ ├── esp32-hal-spi.h │ │ ├── esp32-hal-timer.h │ │ └── esp32-hal.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.cpp │ │ ├── platforms.h │ │ ├── platforms │ │ └── esp │ │ │ └── 32 │ │ │ ├── clockless_block_esp32.h │ │ │ ├── clockless_esp32.h.orig │ │ │ ├── clockless_i2s_esp32.h │ │ │ ├── clockless_rmt_esp32.h │ │ │ ├── fastled_esp32.h │ │ │ ├── fastpin_esp32.h │ │ │ └── led_sysdefs_esp32.h │ │ ├── power_mgt.cpp │ │ ├── power_mgt.h │ │ ├── release_notes.md │ │ └── wiring.cpp ├── main │ ├── CMakeLists.txt │ ├── component.mk │ ├── main.cpp │ └── palettes.h ├── sdkconfig └── sdkconfig.defaults └── wifi_station ├── CMakeLists.txt ├── Makefile ├── README.md ├── main ├── CMakeLists.txt ├── Kconfig.projbuild ├── component.mk └── wifi_station_main.c └── sdkconfig /LICENSE: -------------------------------------------------------------------------------- 1 | This code is written an owned by Brian Bulkowski, brian@bulkowski.org 2 | It is not yours, it is not open source, it is mine. 3 | You may not use any of it. 2019. 4 | -------------------------------------------------------------------------------- /NOTES.md: -------------------------------------------------------------------------------- 1 | # Notes 2 | 3 | These projects are written for verion 4.0 of ESP-IDF. 4 | 5 | In particular, they were initially developed with 4.0-beta2 which was available 6 | in Jan 2020. 7 | 8 | The menuconfig options focus primarily around the `DevKit1` boards, although they 9 | may have been run on other boards. Beware. 10 | -------------------------------------------------------------------------------- /blink/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # The following five lines of boilerplate have to be in your project's 2 | # CMakeLists in this exact order for cmake to work correctly 3 | cmake_minimum_required(VERSION 3.5) 4 | 5 | include($ENV{IDF_PATH}/tools/cmake/project.cmake) 6 | project(blink) 7 | -------------------------------------------------------------------------------- /blink/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # This is a project Makefile. It is assumed the directory this Makefile resides in is a 3 | # project subdirectory. 4 | # 5 | 6 | PROJECT_NAME := blink 7 | 8 | include $(IDF_PATH)/make/project.mk 9 | 10 | -------------------------------------------------------------------------------- /blink/README.md: -------------------------------------------------------------------------------- 1 | # Blink Example 2 | 3 | Starts a FreeRTOS task to blink an LED 4 | 5 | -------------------------------------------------------------------------------- /blink/example_test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | from __future__ import division 4 | from __future__ import print_function 5 | from __future__ import unicode_literals 6 | import re 7 | import os 8 | import hashlib 9 | 10 | from tiny_test_fw import Utility 11 | import ttfw_idf 12 | 13 | 14 | def verify_elf_sha256_embedding(dut): 15 | elf_file = os.path.join(dut.app.binary_path, "blink.elf") 16 | sha256 = hashlib.sha256() 17 | with open(elf_file, "rb") as f: 18 | sha256.update(f.read()) 19 | sha256_expected = sha256.hexdigest() 20 | 21 | dut.reset() 22 | sha256_reported = dut.expect(re.compile(r'ELF file SHA256:\s+([a-f0-9]+)'), timeout=5)[0] 23 | 24 | Utility.console_log('ELF file SHA256: %s' % sha256_expected) 25 | Utility.console_log('ELF file SHA256 (reported by the app): %s' % sha256_reported) 26 | # the app reports only the first several hex characters of the SHA256, check that they match 27 | if not sha256_expected.startswith(sha256_reported): 28 | raise ValueError('ELF file SHA256 mismatch') 29 | 30 | 31 | @ttfw_idf.idf_example_test(env_tag="Example_WIFI") 32 | def test_examples_blink(env, extra_data): 33 | dut = env.get_dut("blink", "examples/get-started/blink") 34 | binary_file = os.path.join(dut.app.binary_path, "blink.bin") 35 | bin_size = os.path.getsize(binary_file) 36 | ttfw_idf.log_performance("blink_bin_size", "{}KB".format(bin_size // 1024)) 37 | ttfw_idf.check_performance("blink_bin_size", bin_size // 1024) 38 | 39 | dut.start_app() 40 | 41 | verify_elf_sha256_embedding(dut) 42 | 43 | 44 | if __name__ == '__main__': 45 | test_examples_blink() 46 | -------------------------------------------------------------------------------- /blink/main/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | idf_component_register(SRCS "blink.c" 2 | INCLUDE_DIRS ".") -------------------------------------------------------------------------------- /blink/main/Kconfig.projbuild: -------------------------------------------------------------------------------- 1 | menu "Example Configuration" 2 | 3 | config BLINK_GPIO 4 | int "Blink GPIO number" 5 | range 0 34 6 | default 5 7 | help 8 | GPIO number (IOxx) to blink on and off. 9 | 10 | Some GPIOs are used for other purposes (flash connections, etc.) and cannot be used to blink. 11 | 12 | GPIOs 35-39 are input-only so cannot be used as outputs. 13 | 14 | endmenu 15 | -------------------------------------------------------------------------------- /blink/main/component.mk: -------------------------------------------------------------------------------- 1 | # 2 | # "main" pseudo-component makefile. 3 | # 4 | # (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.) 5 | -------------------------------------------------------------------------------- /blink/sdkconfig.defaults: -------------------------------------------------------------------------------- 1 | # 2 | 3 | -------------------------------------------------------------------------------- /fanc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # The following lines of boilerplate have to be in your project's CMakeLists 2 | # in this exact order for cmake to work correctly 3 | cmake_minimum_required(VERSION 3.5) 4 | 5 | include($ENV{IDF_PATH}/tools/cmake/project.cmake) 6 | project(fanc) 7 | -------------------------------------------------------------------------------- /fanc/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # This is a project Makefile. It is assumed the directory this Makefile resides in is a 3 | # project subdirectory. 4 | # 5 | 6 | PROJECT_NAME := fanc 7 | 8 | include $(IDF_PATH)/make/project.mk 9 | 10 | -------------------------------------------------------------------------------- /fanc/README.md: -------------------------------------------------------------------------------- 1 | # FANC! 2 | 3 | Oh, look, it's so FANC. 4 | 5 | This is a PWM fan controller for a simple semi-industrial use. We need to dry 6 | cheese, and we need to keep air flow, but we also need to keep flies away. 7 | So, we have built a small box, and wanted a WIFI based controller. 8 | 9 | This controller should allow setting the speed of the fan, but also 10 | measure the speed ( since PWM fans will do that ). 11 | 12 | PWM fans have four wires. Power and Ground which are 12v, and 13 | a PWM speed setting one, and another "tachometer" pin which can 14 | be read in order to see how fast the fan is spinning. 15 | 16 | This standard was used for Intel CPU fans, which crept its way into other case 17 | fans. These fans are pretty easy to come by. 18 | 19 | # esp-idf 20 | 21 | This project uses esp-idf. It does not use arduino. If you come across this project, 22 | please go to Espressif's site and configure correctly and use the `idf.py build` correctly. 23 | 24 | This is written for ESP-IDF 4.1 and better. That's because there were significant changes 25 | in how the network is configured in 4.1, and instead of doing the hassle of back porting, 26 | I thought I would just do both. This allows the newer S2 chips ( which require esp-idf v4.2 ) 27 | to work seamlessly, and those are a few bucks cheaper. 28 | 29 | # Pin assignment 30 | 31 | The pins on the fan are set in fanc.cpp. They are pin 18 for the control, and pin 19 for the 32 | tachometer ( pulse counter ). 33 | 34 | # hardware configuration 35 | 36 | I used a ESP32 PICO D4 dev board. I find these the best of the crop as of 2020, in that they 37 | have an excellent power system, reflash every time with perfect stability. 38 | 39 | The pins are wired as follows. The 12v and GND of the fan are wired to the power of the system. 40 | Ground is on the "outside" and power is on the "inside". 41 | 42 | On the other side of the fan connector, the outer is the driver data. That wll be connected to 18 43 | directly. 44 | 45 | The inner is the tachometer sense, 19. This is is an "open drain" that should drain to 12v, however, 46 | that requires three resistors. I found that draining to 3.3v ( which is on the ESP board ) through 47 | a 12k resistor shows a pretty ugly waveform on the scope, but one the ESP seems to be able to deal with. 48 | 49 | Thus, sense -> 19, but at the same time sense -> 12k -> 3.3v ( that's how open drains work ). 50 | 51 | # Wifi 52 | 53 | This uses the wifimulti module I wrote. It is configured to use three of the wifi 54 | networks I have around my house, and I have ( mostly ) not checked in the passwords. 55 | 56 | Please replace the information in fanc_main.cpp with wifi that you tend to use. 57 | 58 | A nice enhancement would be to use the wifi system with NVS, but I haven't gotten that far yet. 59 | 60 | 61 | # Configure the project 62 | 63 | There are a few settings you might need for your board, I've set up my favorites. 64 | 65 | ``` 66 | idf.py menuconfig 67 | ``` 68 | 69 | ### Build and Flash 70 | 71 | Build the project and flash it to the board, then run monitor tool to view serial output: 72 | 73 | ``` 74 | idf.py -p PORT flash monitor 75 | ``` 76 | 77 | (To exit the serial monitor, type ``Ctrl-]``.) 78 | 79 | 80 | -------------------------------------------------------------------------------- /fanc/components/WiFiMulti-idf/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | 3 | set(srcs 4 | "WiFiMulti.c" 5 | ) 6 | 7 | # everything needs the ESP32 flag, not sure why this won't work 8 | # going to hack by adding the ESP32 define in the h file 9 | #`target_compile_options(${COMPONENT_LIB} PRIVATE "-DESP32") 10 | 11 | idf_component_register(SRCS "WiFiMulti-idf.c" 12 | INCLUDE_DIRS "./include" ) 13 | -------------------------------------------------------------------------------- /fanc/components/WiFiMulti-idf/Kconfig: -------------------------------------------------------------------------------- 1 | menu "WiFiMulti" 2 | 3 | config WIFI_MULTI_TEST 4 | bool "Create a Wifi Multi LED option in case I need to later" 5 | default n 6 | help 7 | I don't know if I'm going to have to add menuconfig options in the future. 8 | Maybe I will. If I do, this is the template for doing it. 9 | 10 | endmenu 11 | -------------------------------------------------------------------------------- /fanc/components/WiFiMulti-idf/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2020 Brian Bulkowski 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 | -------------------------------------------------------------------------------- /fanc/components/WiFiMulti-idf/component.mk: -------------------------------------------------------------------------------- 1 | COMPONENT_SRCDIRS := . 2 | COMPONENT_ADD_INCLUDEDIRS := . 3 | COMPONENT_PRIV_INCLUDEDIRS := lib8tion platforms/esp/32 4 | -------------------------------------------------------------------------------- /fanc/components/WiFiMulti-idf/include/WiFiMulti-idf.h: -------------------------------------------------------------------------------- 1 | /* WiFiMulti-idf 2 | 3 | ** External Interfaces to be called by the application 4 | ** 5 | ** Copyright Brian Bulkowski, (c) 2020 6 | ** brian@bulkowski.org 7 | 8 | Unless required by applicable law or agreed to in writing, this 9 | software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 10 | CONDITIONS OF ANY KIND, either express or implied. 11 | */ 12 | 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | #include "freertos/FreeRTOS.h" 19 | #include "freertos/task.h" 20 | #include "freertos/event_groups.h" 21 | #include "freertos/semphr.h" 22 | 23 | #include "esp_system.h" 24 | #include "esp_wifi.h" 25 | #include "esp_log.h" 26 | #include "esp_err.h" 27 | 28 | extern "C" { 29 | 30 | /* 31 | ** NOT EXISTING! Please see the readme and do some coding if you want this supported! 32 | */ 33 | int wifi_multi_ap_remove(const char *ssid); 34 | 35 | /* 36 | ** Add an AP. If there is no password ( it's open ) you can pass nothing. 37 | ** Both values are put into an internal datastructure and are not consumed. 38 | */ 39 | 40 | int wifi_multi_ap_add(const char* ssid, const char *password); 41 | 42 | /* 43 | ** it's very useful to set the log levels programmatically so you can 44 | ** see the decisions getting made by the unit and report bugs. 45 | ** WARNING - quiet except for disasterous things 46 | ** INFO - shows when you attempt to connect, fail to connect, and get IP addresses 47 | ** DEBUG - shows info about the choices being made 48 | ** VERBOSE shows even more info about the choices being made 49 | */ 50 | 51 | void wifi_multi_loglevel_set(esp_log_level_t loglevel); 52 | 53 | /* 54 | ** call this function BEFORE you add aps to have the background tasks maintain 55 | ** the network connection 56 | */ 57 | 58 | void wifi_multi_start(); 59 | 60 | } /* extern C */ 61 | 62 | -------------------------------------------------------------------------------- /fanc/main/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | idf_component_register(SRCS "fanc_main.cpp" "fanc.cpp" "fanc_server.cpp" 2 | INCLUDE_DIRS "." 3 | EMBED_FILES "cheese.jpg" "jquery.min.js" "index.html") 4 | -------------------------------------------------------------------------------- /fanc/main/cheese.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bbulkow/esp32/46ebf3962d7aecb81c6ed24b86d680fd40567cbd/fanc/main/cheese.jpg -------------------------------------------------------------------------------- /fanc/main/component.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Main Makefile. This is basically the same as a component makefile. 3 | # 4 | -------------------------------------------------------------------------------- /fanc/main/fanc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FANC.h 3 | * Fan controler, but more importantly, my first ESP32 4 | * project that controls something with a web interface and 5 | * just a basic thing. 6 | * 7 | * AS-IS 8 | * Copywrite 2020, Brian Bulkowski 9 | * 10 | */ 11 | 12 | esp_err_t fanc_init(void); 13 | void fanc_destroy(void); 14 | 15 | int fanc_percentage_get(void); 16 | esp_err_t fanc_percentage_set(int p); 17 | 18 | // attempting to be revolutions per second. 19 | float fanc_speed_get(void); 20 | 21 | esp_err_t webserver_init(void); 22 | void webserver_destroy(); 23 | 24 | -------------------------------------------------------------------------------- /fanc/main/fanc_main.cpp: -------------------------------------------------------------------------------- 1 | /* LEDC (LED Controller) fade example 2 | 3 | This example code is in the Public Domain (or CC0 licensed, at your option.) 4 | 5 | Unless required by applicable law or agreed to in writing, this 6 | software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 7 | CONDITIONS OF ANY KIND, either express or implied. 8 | */ 9 | #include 10 | #include "freertos/FreeRTOS.h" 11 | #include "freertos/task.h" 12 | 13 | #include "driver/ledc.h" 14 | #include "nvs_flash.h" 15 | #include "mdns.h" 16 | #include "esp_sntp.h" 17 | 18 | #include "WiFiMulti-idf.h" 19 | 20 | #include "esp_err.h" 21 | 22 | #include "esp_log.h" 23 | static const char *TAG = "fanc"; 24 | 25 | #include "fanc.h" 26 | 27 | extern "C" { 28 | void app_main(); 29 | } 30 | 31 | 32 | void app_main(void) 33 | { 34 | // logging is good 35 | // Note the following: 36 | // At compile time: in menuconfig, set the verbosity level using the option CONFIG_LOG_DEFAULT_LEVEL. 37 | // All logging statements for verbosity levels higher than CONFIG_LOG_DEFAULT_LEVEL will be removed by the preprocessor. 38 | // At runtime: all logs for verbosity levels lower than CONFIG_LOG_DEFAULT_LEVEL are enabled by default. 39 | // The function esp_log_level_set() can be used to set a logging level on a per module basis. 40 | // Modules are identified by their tags, which are human-readable ASCII zero-terminated strings. 41 | 42 | // ESP_LOG_NONE, ESP_LOG_ERROR (error), ESP_LOG_WARN, ESP_LOG_INFO, ESP_LOG_DEBUG, ESP_LOG_VERBOSE 43 | esp_log_level_set(TAG, ESP_LOG_DEBUG); 44 | 45 | // this seems to help the Wifi unit. Not so sure about that... 46 | esp_err_t ret = nvs_flash_init(); 47 | if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND) { 48 | ESP_ERROR_CHECK(nvs_flash_erase()); 49 | ret = nvs_flash_init(); 50 | } 51 | ESP_ERROR_CHECK(ret); 52 | 53 | // start the wifi service 54 | ESP_LOGI(TAG, " starting wifi"); 55 | wifi_multi_start(); 56 | 57 | wifi_multi_ap_add("sisyphus", "xxx"); 58 | wifi_multi_ap_add("bb-ap-x", "xxx"); 59 | wifi_multi_ap_add("laertes", "xxx"); 60 | ESP_LOGI(TAG, "finished configuring wifi"); 61 | 62 | // why not get network time, if it's out there? 63 | sntp_set_sync_mode(SNTP_SYNC_MODE_SMOOTH); 64 | sntp_setoperatingmode(SNTP_OPMODE_POLL); 65 | sntp_setservername(0, "us.pool.ntp.org"); 66 | sntp_init(); 67 | 68 | // start the fanc task 69 | fanc_init(); 70 | 71 | // start the webserver 72 | webserver_init(); 73 | 74 | // start the mdns service, it's helpful 75 | // going to hard code the name fanc at the moment, seems the project or NVS should have it 76 | mdns_init(); 77 | mdns_hostname_set("fanc"); 78 | 79 | while(1) { 80 | 81 | vTaskDelay(1000 / portTICK_PERIOD_MS); 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /fanc/partitions.csv: -------------------------------------------------------------------------------- 1 | # ESP-IDF Partition Table 2 | # Name, Type, SubType, Offset, Size, Flags 3 | nvs, data, nvs, 0x9000, 0x6000, 4 | phy_init, data, phy, 0xf000, 0x1000, 5 | factory, app, factory, 0x10000, 1536K, 6 | -------------------------------------------------------------------------------- /hello_world/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # The following lines of boilerplate have to be in your project's 2 | # CMakeLists in this exact order for cmake to work correctly 3 | cmake_minimum_required(VERSION 3.5) 4 | 5 | include($ENV{IDF_PATH}/tools/cmake/project.cmake) 6 | project(hello-world) -------------------------------------------------------------------------------- /hello_world/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # This is a project Makefile. It is assumed the directory this Makefile resides in is a 3 | # project subdirectory. 4 | # 5 | 6 | PROJECT_NAME := hello-world 7 | 8 | include $(IDF_PATH)/make/project.mk 9 | 10 | -------------------------------------------------------------------------------- /hello_world/README.md: -------------------------------------------------------------------------------- 1 | # Hello World Example 2 | 3 | Starts a FreeRTOS task to print "Hello World" 4 | 5 | See the README.md file in the upper level 'examples' directory for more information about examples. 6 | -------------------------------------------------------------------------------- /hello_world/main/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | idf_component_register(SRCS "hello_world_main.c" 2 | INCLUDE_DIRS "") -------------------------------------------------------------------------------- /hello_world/main/component.mk: -------------------------------------------------------------------------------- 1 | # 2 | # "main" pseudo-component makefile. 3 | # 4 | # (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.) 5 | 6 | -------------------------------------------------------------------------------- /hello_world/main/hello_world_main.c: -------------------------------------------------------------------------------- 1 | /* Hello World Example 2 | 3 | This example code is in the Public Domain (or CC0 licensed, at your option.) 4 | 5 | Unless required by applicable law or agreed to in writing, this 6 | software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 7 | CONDITIONS OF ANY KIND, either express or implied. 8 | */ 9 | #include 10 | #include "freertos/FreeRTOS.h" 11 | #include "freertos/task.h" 12 | 13 | #include "esp_system.h" 14 | #include "esp_spi_flash.h" 15 | 16 | 17 | void app_main() 18 | { 19 | printf("Hello world! VERSION 2!\n"); 20 | 21 | /* Print chip information */ 22 | esp_chip_info_t chip_info; 23 | esp_chip_info(&chip_info); 24 | printf("This is ESP32 chip with %d CPU cores, WiFi%s%s, ", 25 | chip_info.cores, 26 | (chip_info.features & CHIP_FEATURE_BT) ? "/BT" : "", 27 | (chip_info.features & CHIP_FEATURE_BLE) ? "/BLE" : ""); 28 | 29 | printf("silicon revision %d, ", chip_info.revision); 30 | 31 | printf("%dMB %s flash\n", spi_flash_get_chip_size() / (1024 * 1024), 32 | (chip_info.features & CHIP_FEATURE_EMB_FLASH) ? "embedded" : "external"); 33 | 34 | for (int i = 20; i >= 0; i--) { 35 | printf("Restarting in %d seconds...\n", i); 36 | vTaskDelay(1000 / portTICK_PERIOD_MS); 37 | } 38 | printf("Restarting now.\n"); 39 | fflush(stdout); 40 | esp_restart(); 41 | } 42 | -------------------------------------------------------------------------------- /led_strip/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # The following lines of boilerplate have to be in your project's CMakeLists 2 | # in this exact order for cmake to work correctly 3 | cmake_minimum_required(VERSION 3.5) 4 | 5 | include($ENV{IDF_PATH}/tools/cmake/project.cmake) 6 | project(led_strip) 7 | -------------------------------------------------------------------------------- /led_strip/README.md: -------------------------------------------------------------------------------- 1 | # RMT Transmit Example -- LED Strip 2 | 3 | (See the README.md file in the upper level 'examples' directory for more information about examples.) 4 | 5 | Although RMT peripheral is mainly designed for infrared remote applications, it can also support other generic protocols thanks to its flexible data format. [WS2812](http://www.world-semi.com/Certifications/WS2812B.html) is a digital RGB LED which integrates a driver circuit and a single control wire. The protocol data format defined in WS2812 is compatible to that in RMT peripheral. This example will illustrate how to drive an WS2812 LED strip based on the RMT driver. 6 | 7 | ## How to Use Example 8 | 9 | ### Hardware Required 10 | 11 | * A development board with ESP32 SoC (e.g., ESP32-DevKitC, ESP-WROVER-KIT, etc.) 12 | * A USB cable for Power supply and programming 13 | * A WS2812 LED strip 14 | 15 | Connection : 16 | 17 | ``` 18 | --- 5V 19 | | 20 | + 21 | GPIO18 +-----------------+---|>| (WS2812) 22 | DI + 23 | | 24 | --- GND 25 | ``` 26 | 27 | ### Configure the Project 28 | 29 | Open the project configuration menu (`idf.py menuconfig`). 30 | 31 | In the `Example Connection Configuration` menu: 32 | 33 | * Set the GPIO number used for transmitting the IR signal under `RMT TX GPIO` optin. 34 | * Set the number of LEDs in a strip under `Number of LEDS in a strip` option. 35 | 36 | ### Build and Flash 37 | 38 | Run `idf.py -p PORT flash monitor` to build, flash and monitor the project. 39 | 40 | (To exit the serial monitor, type ``Ctrl-]``.) 41 | 42 | See the [Getting Started Guide](https://docs.espressif.com/projects/esp-idf/en/latest/get-started/index.html) for full steps to configure and use ESP-IDF to build projects. 43 | 44 | ## Example Output 45 | 46 | Connect the `DI` signal of WS2812 LED strip to the GPIO you set in menuconfig. 47 | 48 | Run the example, you will see a rainbow chasing demonstration effect. To change the chasing speed, you can update the `EXAMPLE_CHASE_SPEED_MS` value in `led_strip_main.c` file. 49 | 50 | ## Troubleshooting 51 | 52 | For any technical queries, please open an [issue] (https://github.com/espressif/esp-idf/issues) on GitHub. We will get back to you soon. 53 | -------------------------------------------------------------------------------- /led_strip/components/led_strip/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(component_srcs "src/led_strip_rmt_ws2812.c") 2 | 3 | idf_component_register(SRCS "${component_srcs}" 4 | INCLUDE_DIRS "include" 5 | PRIV_INCLUDE_DIRS "" 6 | PRIV_REQUIRES "driver" 7 | REQUIRES "") 8 | 9 | -------------------------------------------------------------------------------- /led_strip/components/led_strip/component.mk: -------------------------------------------------------------------------------- 1 | COMPONENT_ADD_INCLUDEDIRS := include 2 | 3 | COMPONENT_SRCDIRS := src 4 | -------------------------------------------------------------------------------- /led_strip/components/led_strip/include/led_strip.h: -------------------------------------------------------------------------------- 1 | // Copyright 2019 Espressif Systems (Shanghai) PTE LTD 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | #pragma once 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | #include "esp_err.h" 21 | 22 | /** 23 | * @brief LED Strip Type 24 | * 25 | */ 26 | typedef struct led_strip_s led_strip_t; 27 | 28 | /** 29 | * @brief LED Strip Device Type 30 | * 31 | */ 32 | typedef void *led_strip_dev_t; 33 | 34 | /** 35 | * @brief Declare of LED Strip Type 36 | * 37 | */ 38 | struct led_strip_s { 39 | /** 40 | * @brief Set RGB for a specific pixel 41 | * 42 | * @param strip: LED strip 43 | * @param index: index of pixel to set 44 | * @param red: red part of color 45 | * @param green: green part of color 46 | * @param blue: blue part of color 47 | * 48 | * @return 49 | * - ESP_OK: Set RGB for a specific pixel successfully 50 | * - ESP_ERR_INVALID_ARG: Set RGB for a specific pixel failed because of invalid parameters 51 | * - ESP_FAIL: Set RGB for a specific pixel failed because other error occurred 52 | */ 53 | esp_err_t (*set_pixel)(led_strip_t *strip, uint32_t index, uint32_t red, uint32_t green, uint32_t blue); 54 | 55 | /** 56 | * @brief Refresh memory colors to LEDs 57 | * 58 | * @param strip: LED strip 59 | * @param timeout_ms: timeout value for refreshing task 60 | * 61 | * @return 62 | * - ESP_OK: Refresh successfully 63 | * - ESP_ERR_TIMEOUT: Refresh failed because of timeout 64 | * - ESP_FAIL: Refresh failed because some other error occurred 65 | * 66 | * @note: 67 | * After updating the LED colors in the memory, a following invocation of this API is needed to flush colors to strip. 68 | */ 69 | esp_err_t (*refresh)(led_strip_t *strip, uint32_t timeout_ms); 70 | 71 | /** 72 | * @brief Clear LED strip (turn off all LEDs) 73 | * 74 | * @param strip: LED strip 75 | * @param timeout_ms: timeout value for clearing task 76 | * 77 | * @return 78 | * - ESP_OK: Clear LEDs successfully 79 | * - ESP_ERR_TIMEOUT: Clear LEDs failed because of timeout 80 | * - ESP_FAIL: Clear LEDs failed because some other error occurred 81 | */ 82 | esp_err_t (*clear)(led_strip_t *strip, uint32_t timeout_ms); 83 | 84 | /** 85 | * @brief Free LED strip resources 86 | * 87 | * @param strip: LED strip 88 | * 89 | * @return 90 | * - ESP_OK: Free resources successfully 91 | * - ESP_FAIL: Free resources failed because error occurred 92 | */ 93 | esp_err_t (*del)(led_strip_t *strip); 94 | }; 95 | 96 | /** 97 | * @brief LED Strip Configuration Type 98 | * 99 | */ 100 | typedef struct { 101 | uint32_t max_leds; /*!< Maximum LEDs in a single strip */ 102 | led_strip_dev_t dev; /*!< LED strip device (e.g. RMT channel, PWM channel, etc) */ 103 | } led_strip_config_t; 104 | 105 | /** 106 | * @brief Default configuration for LED strip 107 | * 108 | */ 109 | #define LED_STRIP_DEFAULT_CONFIG(number, dev_hdl) \ 110 | { \ 111 | .max_leds = number, \ 112 | .dev = dev_hdl, \ 113 | } 114 | 115 | /** 116 | * @brief Install a new ws2812 driver (based on RMT peripheral) 117 | * 118 | * @param config: LED strip configuration 119 | * @return 120 | * LED strip instance or NULL 121 | */ 122 | led_strip_t *led_strip_new_rmt_ws2812(const led_strip_config_t *config); 123 | 124 | #ifdef __cplusplus 125 | } 126 | #endif 127 | -------------------------------------------------------------------------------- /led_strip/main/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | idf_component_register(SRCS "led_strip_main.c" 2 | INCLUDE_DIRS ".") 3 | -------------------------------------------------------------------------------- /led_strip/main/Kconfig.projbuild: -------------------------------------------------------------------------------- 1 | menu "Example Configuration" 2 | config EXAMPLE_RMT_TX_GPIO 3 | int "RMT TX GPIO" 4 | default 18 5 | help 6 | Set the GPIO number used for transmitting the RMT signal. 7 | 8 | config EXAMPLE_STRIP_LED_NUMBER 9 | int "Number of LEDS in a strip" 10 | default 24 11 | help 12 | A single RGB strip contains several LEDs. 13 | endmenu 14 | -------------------------------------------------------------------------------- /led_strip/main/component.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Main Makefile. This is basically the same as a component makefile. 3 | # 4 | # (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.) 5 | -------------------------------------------------------------------------------- /ledc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # The following lines of boilerplate have to be in your project's CMakeLists 2 | # in this exact order for cmake to work correctly 3 | cmake_minimum_required(VERSION 3.5) 4 | 5 | include($ENV{IDF_PATH}/tools/cmake/project.cmake) 6 | project(ledc) 7 | -------------------------------------------------------------------------------- /ledc/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # This is a project Makefile. It is assumed the directory this Makefile resides in is a 3 | # project subdirectory. 4 | # 5 | 6 | PROJECT_NAME := ledc 7 | 8 | include $(IDF_PATH)/make/project.mk 9 | 10 | -------------------------------------------------------------------------------- /ledc/README.md: -------------------------------------------------------------------------------- 1 | # LEDC! 2 | 3 | This is a quick project using the tech / code I built up or FANC, but 4 | now including the LED controller. Which means I want a web page, 5 | I want it continually using Wifi, and I want to see if I can 6 | maintain smooth patterns in a modest LED array. 7 | 8 | 9 | # hardware configuration 10 | 11 | I used a ESP32 PICO D4 dev board. I find these the best of the crop as of 2020, in that they 12 | have an excellent power system, reflash every time with perfect stability. 13 | 14 | GPIO 13 is wired to the LED string, through a level shifter. 15 | 16 | # Wifi 17 | 18 | This uses the wifimulti module I wrote. It is configured to use three of the wifi 19 | networks I have around my house, and I have ( mostly ) not checked in the passwords. 20 | 21 | Please replace the information in fanc_main.cpp with wifi that you tend to use. 22 | 23 | A nice enhancement would be to use the wifi system with NVS, but I haven't gotten that far yet. 24 | 25 | # Configure the project 26 | 27 | There are a few settings you might need for your board, I've set up my favorites. 28 | 29 | ``` 30 | idf.py menuconfig 31 | ``` 32 | 33 | ### Build and Flash 34 | 35 | Build the project and flash it to the board, then run monitor tool to view serial output: 36 | 37 | ``` 38 | idf.py -p PORT flash monitor 39 | ``` 40 | 41 | (To exit the serial monitor, type ``Ctrl-]``.) 42 | 43 | 44 | -------------------------------------------------------------------------------- /ledc/components/FastLED-idf/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | 3 | set(srcs 4 | "FastLED.cpp" 5 | "bitswap.cpp" 6 | "colorpalettes.cpp" 7 | "colorutils.cpp" 8 | "hsv2rgb.cpp" 9 | "lib8tion.cpp" 10 | "noise.cpp" 11 | "platforms.cpp" 12 | "power_mgt.cpp" 13 | "wiring.cpp" 14 | "hal/esp32-hal-misc.c" 15 | "hal/esp32-hal-gpio.c" 16 | # remove the following if you want I2S instead of RMT hardware, just put a pound in front 17 | "platforms/esp/32/clockless_rmt_esp32.cpp" 18 | ) 19 | 20 | # everything needs the ESP32 flag, not sure why this won't work 21 | # going to hack by adding the ESP32 define in the h file 22 | #`target_compile_options(${COMPONENT_LIB} PRIVATE "-DESP32") 23 | 24 | idf_component_register(SRCS "${srcs}" 25 | INCLUDE_DIRS "." "./hal" ) 26 | -------------------------------------------------------------------------------- /ledc/components/FastLED-idf/Kconfig: -------------------------------------------------------------------------------- 1 | menu "Fast LED" 2 | 3 | config FAST_LED_TEST 4 | bool "Create a Fast LED option in case I need to later" 5 | default n 6 | help 7 | I don't know if I'm going to have to add menuconfig options in the future. 8 | Maybe I will. If I do, this is the template for doing it. 9 | 10 | endmenu 11 | -------------------------------------------------------------------------------- /ledc/components/FastLED-idf/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 | -------------------------------------------------------------------------------- /ledc/components/FastLED-idf/PORTING.md: -------------------------------------------------------------------------------- 1 | =New platform porting guide= 2 | 3 | == Fast porting for a new board on existing hardware == 4 | 5 | Sometimes "porting" FastLED simply consists of supplying new pin definitions for the given platform. For example, platforms/avr/fastpin_avr.h contains various pin definitions for all the AVR variant chipsets/boards that FastLED supports. Defining a set of pins involves setting up a set of definitions - for example here's one full set from the avr fastpin file: 6 | 7 | ``` 8 | #elif defined(__AVR_ATmega1284P__) || defined(__AVR_ATmega644P__) 9 | 10 | _FL_IO(A); _FL_IO(B); _FL_IO(C); _FL_IO(D); 11 | 12 | #define MAX_PIN 31 13 | _FL_DEFPIN(0, 0, B); _FL_DEFPIN(1, 1, B); _FL_DEFPIN(2, 2, B); _FL_DEFPIN(3, 3, B); 14 | _FL_DEFPIN(4, 4, B); _FL_DEFPIN(5, 5, B); _FL_DEFPIN(6, 6, B); _FL_DEFPIN(7, 7, B); 15 | _FL_DEFPIN(8, 0, D); _FL_DEFPIN(9, 1, D); _FL_DEFPIN(10, 2, D); _FL_DEFPIN(11, 3, D); 16 | _FL_DEFPIN(12, 4, D); _FL_DEFPIN(13, 5, D); _FL_DEFPIN(14, 6, D); _FL_DEFPIN(15, 7, D); 17 | _FL_DEFPIN(16, 0, C); _FL_DEFPIN(17, 1, C); _FL_DEFPIN(18, 2, C); _FL_DEFPIN(19, 3, C); 18 | _FL_DEFPIN(20, 4, C); _FL_DEFPIN(21, 5, C); _FL_DEFPIN(22, 6, C); _FL_DEFPIN(23, 7, C); 19 | _FL_DEFPIN(24, 0, A); _FL_DEFPIN(25, 1, A); _FL_DEFPIN(26, 2, A); _FL_DEFPIN(27, 3, A); 20 | _FL_DEFPIN(28, 4, A); _FL_DEFPIN(29, 5, A); _FL_DEFPIN(30, 6, A); _FL_DEFPIN(31, 7, A); 21 | 22 | #define HAS_HARDWARE_PIN_SUPPORT 1 23 | ``` 24 | 25 | The ```_FL_IO``` macro is used to define the port registers for the platform while the ```_FL_DEFPIN``` macro is used to define pins. The parameters to the macro are the pin number, the bit on the port that represents that pin, and the port identifier itself. On some platforms, like the AVR, ports are identified by letter. On other platforms, like arm, ports are identified by number. 26 | 27 | The ```HAS_HARDWARE_PIN_SUPPORT``` define tells the rest of the FastLED library that there is hardware pin support available. There may be other platform specific defines for things like hardware SPI ports and such. 28 | 29 | == Setting up the basic files/folders == 30 | 31 | * Create platform directory (e.g. platforms/arm/kl26) 32 | * Create configuration header led_sysdefs_arm_kl26.h: 33 | * Define platform flags (like FASTLED_ARM/FASTLED_TEENSY) 34 | * Define configuration parameters re: interrupts, or clock doubling 35 | * Include extar system header files if needed 36 | * Create main platform include, fastled_arm_kl26.h 37 | * Include the various other header files as needed 38 | * Modify led_sysdefs.h to conditionally include platform sysdefs header file 39 | * Modify platforms.h to conditionally include platform fastled header 40 | 41 | == Porting fastpin.h == 42 | 43 | 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. 44 | 45 | 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. 46 | 47 | Explaining how the macros work and should be used is currently beyond the scope of this document. 48 | 49 | == Porting fastspi.h == 50 | 51 | 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. 52 | 53 | == Porting clockless.h == 54 | 55 | 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. 56 | -------------------------------------------------------------------------------- /ledc/components/FastLED-idf/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 | -------------------------------------------------------------------------------- /ledc/components/FastLED-idf/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 | -------------------------------------------------------------------------------- /ledc/components/FastLED-idf/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 | -------------------------------------------------------------------------------- /ledc/components/FastLED-idf/component.mk: -------------------------------------------------------------------------------- 1 | COMPONENT_SRCDIRS := . 2 | COMPONENT_ADD_INCLUDEDIRS := . 3 | COMPONENT_PRIV_INCLUDEDIRS := lib8tion platforms/esp/32 4 | -------------------------------------------------------------------------------- /ledc/components/FastLED-idf/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 | -------------------------------------------------------------------------------- /ledc/components/FastLED-idf/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 | -------------------------------------------------------------------------------- /ledc/components/FastLED-idf/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 | #define FASTLED_SCALE8_FIXED 1 38 | // #define FASTLED_SCALE8_FIXED 0 39 | 40 | // Use this toggle whether to use 'fixed' FastLED pixel blending, including ColorFromPalette. 41 | // The prior pixel blend functions had integer-rounding math errors that led to 42 | // small errors being inadvertently added to the low bits of blended colors, including colors 43 | // retrieved from color palettes using LINEAR_BLEND. This is now fixed, and the 44 | // fix is enabled by default. However, if for some reason you wish to run with the old 45 | // blending, including the integer rounding and color errors, you can disable the bugfix here. 46 | #define FASTLED_BLEND_FIXED 1 47 | // #define FASTLED_BLEND_FIXED 0 48 | 49 | // Use this toggle whether to use 'fixed' FastLED 8- and 16-bit noise functions. 50 | // The prior noise functions had some math errors that led to 'discontinuities' in the 51 | // output, which by definition should be smooth and continuous. The bug led to 52 | // noise function output that had 'edges' and glitches in it. This is now fixed, and the 53 | // fix is enabled by default. However, if for some reason you wish to run with the old 54 | // noise code, including the glitches, you can disable the bugfix here. 55 | #define FASTLED_NOISE_FIXED 1 56 | //#define FASTLED_NOISE_FIXED 0 57 | 58 | // Use this to determine how many times FastLED will attempt to re-transmit a frame if interrupted 59 | // for too long by interrupts. 60 | #ifndef FASTLED_INTERRUPT_RETRY_COUNT 61 | #define FASTLED_INTERRUPT_RETRY_COUNT 2 62 | #endif 63 | 64 | // Use this toggle to enable global brightness in contollers that support is (ADA102 and SK9822). 65 | // It changes how color scaling works and uses global brightness before scaling down color values. 66 | // This enable much more accurate color control on low brightness settings. 67 | //#define FASTLED_USE_GLOBAL_BRIGHTNESS 1 68 | 69 | #endif 70 | -------------------------------------------------------------------------------- /ledc/components/FastLED-idf/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 | // On some platforms, most notably ARM M0, unaligned access 67 | // to 'PROGMEM' for multibyte values (eg read dword) is 68 | // not allowed and causes a crash. This macro can help 69 | // force 4-byte alignment as needed. The FastLED gradient 70 | // palette code uses 'read dword', and now uses this macro 71 | // to make sure that gradient palettes are 4-byte aligned. 72 | #if defined(FASTLED_ARM) || defined(ESP32) || defined(ESP8266) 73 | #define FL_ALIGN_PROGMEM __attribute__ ((aligned (4))) 74 | #else 75 | #define FL_ALIGN_PROGMEM 76 | #endif 77 | 78 | 79 | FASTLED_NAMESPACE_END 80 | 81 | #endif 82 | -------------------------------------------------------------------------------- /ledc/components/FastLED-idf/fastspi_dma.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bbulkow/esp32/46ebf3962d7aecb81c6ed24b86d680fd40567cbd/ledc/components/FastLED-idf/fastspi_dma.h -------------------------------------------------------------------------------- /ledc/components/FastLED-idf/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 | -------------------------------------------------------------------------------- /ledc/components/FastLED-idf/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 | -------------------------------------------------------------------------------- /ledc/components/FastLED-idf/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 | -------------------------------------------------------------------------------- /ledc/components/FastLED-idf/hal/README.md: -------------------------------------------------------------------------------- 1 | # Source 2 | 3 | These files were taken from https://github.com/espressif/arduino-esp32 . 4 | 5 | They are licensed under Gnu LGPL. 6 | -------------------------------------------------------------------------------- /ledc/components/FastLED-idf/hal/esp32-hal-cpu.h: -------------------------------------------------------------------------------- 1 | // Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef _ESP32_HAL_CPU_H_ 16 | #define _ESP32_HAL_CPU_H_ 17 | 18 | #ifdef __cplusplus 19 | extern "C" { 20 | #endif 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | typedef enum { APB_BEFORE_CHANGE, APB_AFTER_CHANGE } apb_change_ev_t; 27 | 28 | typedef void (* apb_change_cb_t)(void * arg, apb_change_ev_t ev_type, uint32_t old_apb, uint32_t new_apb); 29 | 30 | bool addApbChangeCallback(void * arg, apb_change_cb_t cb); 31 | bool removeApbChangeCallback(void * arg, apb_change_cb_t cb); 32 | 33 | //function takes the following frequencies as valid values: 34 | // 240, 160, 80 <<< For all XTAL types 35 | // 40, 20, 10 <<< For 40MHz XTAL 36 | // 26, 13 <<< For 26MHz XTAL 37 | // 24, 12 <<< For 24MHz XTAL 38 | bool setCpuFrequencyMhz(uint32_t cpu_freq_mhz); 39 | 40 | uint32_t getCpuFrequencyMhz(); // In MHz 41 | uint32_t getXtalFrequencyMhz(); // In MHz 42 | uint32_t getApbFrequency(); // In Hz 43 | 44 | #ifdef __cplusplus 45 | } 46 | #endif 47 | 48 | #endif /* _ESP32_HAL_CPU_H_ */ 49 | -------------------------------------------------------------------------------- /ledc/components/FastLED-idf/hal/esp32-hal-gpio.h: -------------------------------------------------------------------------------- 1 | /* 2 | Arduino.h - Main include file for the Arduino SDK 3 | Copyright (c) 2005-2013 Arduino Team. All right reserved. 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | #ifndef MAIN_ESP32_HAL_GPIO_H_ 21 | #define MAIN_ESP32_HAL_GPIO_H_ 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif 26 | 27 | #include "esp32-hal.h" 28 | 29 | #define LOW 0x0 30 | #define HIGH 0x1 31 | 32 | //GPIO FUNCTIONS 33 | #define INPUT 0x01 34 | #define OUTPUT 0x02 35 | #define PULLUP 0x04 36 | #define INPUT_PULLUP 0x05 37 | #define PULLDOWN 0x08 38 | #define INPUT_PULLDOWN 0x09 39 | #define OPEN_DRAIN 0x10 40 | #define OUTPUT_OPEN_DRAIN 0x12 41 | #define SPECIAL 0xF0 42 | #define FUNCTION_1 0x00 43 | #define FUNCTION_2 0x20 44 | #define FUNCTION_3 0x40 45 | #define FUNCTION_4 0x60 46 | #define FUNCTION_5 0x80 47 | #define FUNCTION_6 0xA0 48 | #define ANALOG 0xC0 49 | 50 | //Interrupt Modes 51 | #define DISABLED 0x00 52 | #define RISING 0x01 53 | #define FALLING 0x02 54 | #define CHANGE 0x03 55 | #define ONLOW 0x04 56 | #define ONHIGH 0x05 57 | #define ONLOW_WE 0x0C 58 | #define ONHIGH_WE 0x0D 59 | 60 | typedef struct { 61 | uint8_t reg; /*!< GPIO register offset from DR_REG_IO_MUX_BASE */ 62 | int8_t rtc; /*!< RTC GPIO number (-1 if not RTC GPIO pin) */ 63 | int8_t adc; /*!< ADC Channel number (-1 if not ADC pin) */ 64 | int8_t touch; /*!< Touch Channel number (-1 if not Touch pin) */ 65 | } esp32_gpioMux_t; 66 | 67 | extern const esp32_gpioMux_t esp32_gpioMux[40]; 68 | extern const int8_t esp32_adc2gpio[20]; 69 | 70 | #define digitalPinIsValid(pin) ((pin) < 40 && esp32_gpioMux[(pin)].reg) 71 | #define digitalPinCanOutput(pin) ((pin) < 34 && esp32_gpioMux[(pin)].reg) 72 | #define digitalPinToRtcPin(pin) (((pin) < 40)?esp32_gpioMux[(pin)].rtc:-1) 73 | #define digitalPinToAnalogChannel(pin) (((pin) < 40)?esp32_gpioMux[(pin)].adc:-1) 74 | #define digitalPinToTouchChannel(pin) (((pin) < 40)?esp32_gpioMux[(pin)].touch:-1) 75 | #define digitalPinToDacChannel(pin) (((pin) == 25)?0:((pin) == 26)?1:-1) 76 | 77 | void pinMode(uint8_t pin, uint8_t mode); 78 | void digitalWrite(uint8_t pin, uint8_t val); 79 | int digitalRead(uint8_t pin); 80 | 81 | void attachInterrupt(uint8_t pin, void (*)(void), int mode); 82 | void attachInterruptArg(uint8_t pin, void (*)(void*), void * arg, int mode); 83 | void detachInterrupt(uint8_t pin); 84 | 85 | #ifdef __cplusplus 86 | } 87 | #endif 88 | 89 | #endif /* MAIN_ESP32_HAL_GPIO_H_ */ 90 | -------------------------------------------------------------------------------- /ledc/components/FastLED-idf/hal/esp32-hal-i2c.h: -------------------------------------------------------------------------------- 1 | // Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | // modified Nov 2017 by Chuck Todd to support Interrupt Driven I/O 15 | 16 | #ifndef _ESP32_HAL_I2C_H_ 17 | #define _ESP32_HAL_I2C_H_ 18 | 19 | #ifdef __cplusplus 20 | extern "C" { 21 | #endif 22 | 23 | #include 24 | #include 25 | #include "freertos/FreeRTOS.h" 26 | #include "freertos/event_groups.h" 27 | 28 | // External Wire.h equivalent error Codes 29 | typedef enum { 30 | I2C_ERROR_OK=0, 31 | I2C_ERROR_DEV, 32 | I2C_ERROR_ACK, 33 | I2C_ERROR_TIMEOUT, 34 | I2C_ERROR_BUS, 35 | I2C_ERROR_BUSY, 36 | I2C_ERROR_MEMORY, 37 | I2C_ERROR_CONTINUE, 38 | I2C_ERROR_NO_BEGIN 39 | } i2c_err_t; 40 | 41 | struct i2c_struct_t; 42 | typedef struct i2c_struct_t i2c_t; 43 | 44 | i2c_t * i2cInit(uint8_t i2c_num, int8_t sda, int8_t scl, uint32_t clk_speed); 45 | void i2cRelease(i2c_t *i2c); // free ISR, Free DQ, Power off peripheral clock. Must call i2cInit() to recover 46 | i2c_err_t i2cWrite(i2c_t * i2c, uint16_t address, uint8_t* buff, uint16_t size, bool sendStop, uint16_t timeOutMillis); 47 | i2c_err_t i2cRead(i2c_t * i2c, uint16_t address, uint8_t* buff, uint16_t size, bool sendStop, uint16_t timeOutMillis, uint32_t *readCount); 48 | i2c_err_t i2cFlush(i2c_t *i2c); 49 | i2c_err_t i2cSetFrequency(i2c_t * i2c, uint32_t clk_speed); 50 | uint32_t i2cGetFrequency(i2c_t * i2c); 51 | uint32_t i2cGetStatus(i2c_t * i2c); // Status register of peripheral 52 | 53 | //Functions below should be used only if well understood 54 | //Might be deprecated and removed in future 55 | i2c_err_t i2cAttachSCL(i2c_t * i2c, int8_t scl); 56 | i2c_err_t i2cDetachSCL(i2c_t * i2c, int8_t scl); 57 | i2c_err_t i2cAttachSDA(i2c_t * i2c, int8_t sda); 58 | i2c_err_t i2cDetachSDA(i2c_t * i2c, int8_t sda); 59 | 60 | //Stickbreakers ISR Support 61 | i2c_err_t i2cProcQueue(i2c_t *i2c, uint32_t *readCount, uint16_t timeOutMillis); 62 | i2c_err_t i2cAddQueueWrite(i2c_t *i2c, uint16_t i2cDeviceAddr, uint8_t *dataPtr, uint16_t dataLen, bool SendStop, EventGroupHandle_t event); 63 | i2c_err_t i2cAddQueueRead(i2c_t *i2c, uint16_t i2cDeviceAddr, uint8_t *dataPtr, uint16_t dataLen, bool SendStop, EventGroupHandle_t event); 64 | 65 | //stickbreaker debug support 66 | uint32_t i2cDebug(i2c_t *, uint32_t setBits, uint32_t resetBits); 67 | // Debug actions have 3 currently defined locus 68 | // 0xXX------ : at entry of ProcQueue 69 | // 0x--XX---- : at exit of ProcQueue 70 | // 0x------XX : at entry of Flush 71 | // 72 | // bit 0 causes DumpI2c to execute 73 | // bit 1 causes DumpInts to execute 74 | // bit 2 causes DumpCmdqueue to execute 75 | // bit 3 causes DumpStatus to execute 76 | // bit 4 causes DumpFifo to execute 77 | 78 | #ifdef __cplusplus 79 | } 80 | #endif 81 | 82 | #endif /* _ESP32_HAL_I2C_H_ */ 83 | -------------------------------------------------------------------------------- /ledc/components/FastLED-idf/hal/esp32-hal-timer.h: -------------------------------------------------------------------------------- 1 | /* 2 | Arduino.h - Main include file for the Arduino SDK 3 | Copyright (c) 2005-2013 Arduino Team. All right reserved. 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | #ifndef MAIN_ESP32_HAL_TIMER_H_ 21 | #define MAIN_ESP32_HAL_TIMER_H_ 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif 26 | 27 | #include "esp32-hal.h" 28 | #include "freertos/FreeRTOS.h" 29 | 30 | struct hw_timer_s; 31 | typedef struct hw_timer_s hw_timer_t; 32 | 33 | hw_timer_t * timerBegin(uint8_t timer, uint16_t divider, bool countUp); 34 | void timerEnd(hw_timer_t *timer); 35 | 36 | void timerSetConfig(hw_timer_t *timer, uint32_t config); 37 | uint32_t timerGetConfig(hw_timer_t *timer); 38 | 39 | void timerAttachInterrupt(hw_timer_t *timer, void (*fn)(void), bool edge); 40 | void timerDetachInterrupt(hw_timer_t *timer); 41 | 42 | void timerStart(hw_timer_t *timer); 43 | void timerStop(hw_timer_t *timer); 44 | void timerRestart(hw_timer_t *timer); 45 | void timerWrite(hw_timer_t *timer, uint64_t val); 46 | void timerSetDivider(hw_timer_t *timer, uint16_t divider); 47 | void timerSetCountUp(hw_timer_t *timer, bool countUp); 48 | void timerSetAutoReload(hw_timer_t *timer, bool autoreload); 49 | 50 | bool timerStarted(hw_timer_t *timer); 51 | uint64_t timerRead(hw_timer_t *timer); 52 | uint64_t timerReadMicros(hw_timer_t *timer); 53 | double timerReadSeconds(hw_timer_t *timer); 54 | uint16_t timerGetDivider(hw_timer_t *timer); 55 | bool timerGetCountUp(hw_timer_t *timer); 56 | bool timerGetAutoReload(hw_timer_t *timer); 57 | 58 | void timerAlarmEnable(hw_timer_t *timer); 59 | void timerAlarmDisable(hw_timer_t *timer); 60 | void timerAlarmWrite(hw_timer_t *timer, uint64_t interruptAt, bool autoreload); 61 | 62 | bool timerAlarmEnabled(hw_timer_t *timer); 63 | uint64_t timerAlarmRead(hw_timer_t *timer); 64 | uint64_t timerAlarmReadMicros(hw_timer_t *timer); 65 | double timerAlarmReadSeconds(hw_timer_t *timer); 66 | 67 | 68 | #ifdef __cplusplus 69 | } 70 | #endif 71 | 72 | #endif /* MAIN_ESP32_HAL_TIMER_H_ */ 73 | -------------------------------------------------------------------------------- /ledc/components/FastLED-idf/hal/esp32-hal.h: -------------------------------------------------------------------------------- 1 | /* 2 | Arduino.h - Main include file for the Arduino SDK 3 | Copyright (c) 2005-2013 Arduino Team. All right reserved. 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | #ifndef HAL_ESP32_HAL_H_ 21 | #define HAL_ESP32_HAL_H_ 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif 26 | 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include "sdkconfig.h" 36 | #include "esp_system.h" 37 | 38 | #ifndef F_CPU 39 | #define F_CPU (CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ * 1000000U) 40 | #endif 41 | 42 | //forward declaration from freertos/portmacro.h 43 | void vPortYield(void); 44 | void yield(void); 45 | #define optimistic_yield(u) 46 | 47 | #define ESP_REG(addr) *((volatile uint32_t *)(addr)) 48 | #define NOP() asm volatile ("nop") 49 | 50 | // BB: see how many we can remove 51 | 52 | #include "esp32-hal-log.h" 53 | #include "esp32-hal-gpio.h" 54 | #include "esp32-hal-cpu.h" 55 | 56 | #ifndef BOARD_HAS_PSRAM 57 | #ifdef CONFIG_SPIRAM_SUPPORT 58 | #undef CONFIG_SPIRAM_SUPPORT 59 | #endif 60 | #endif 61 | 62 | // BB a few key functions from esp32-hal-misc, which are defined 63 | // bar Arduino and thus therea re no headers for here 64 | // 65 | unsigned long micros(void); 66 | unsigned long millis(void); 67 | 68 | //returns chip temperature in Celsius 69 | float temperatureRead(void); 70 | 71 | 72 | unsigned long micros(); 73 | unsigned long millis(); 74 | void delay(uint32_t); 75 | void delayMicroseconds(uint32_t us); 76 | 77 | #if !CONFIG_ESP32_PHY_AUTO_INIT 78 | void arduino_phy_init(); 79 | #endif 80 | 81 | 82 | #ifdef __cplusplus 83 | } 84 | #endif 85 | 86 | #endif /* HAL_ESP32_HAL_H_ */ 87 | -------------------------------------------------------------------------------- /ledc/components/FastLED-idf/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 | -------------------------------------------------------------------------------- /ledc/components/FastLED-idf/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(NRF52_SERIES) 11 | #include "platforms/arm/nrf52/led_sysdefs_arm_nrf52.h" 12 | #elif defined(__MK20DX128__) || defined(__MK20DX256__) 13 | // Include k20/T3 headers 14 | #include "platforms/arm/k20/led_sysdefs_arm_k20.h" 15 | #elif defined(__MK66FX1M0__) || defined(__MK64FX512__) 16 | // Include k66/T3.6 headers 17 | #include "platforms/arm/k66/led_sysdefs_arm_k66.h" 18 | #elif defined(__MKL26Z64__) 19 | // Include kl26/T-LC headers 20 | #include "platforms/arm/kl26/led_sysdefs_arm_kl26.h" 21 | #elif defined(__IMXRT1062__) 22 | // teensy4 23 | #include "platforms/arm/mxrt1062/led_sysdefs_arm_mxrt1062.h" 24 | #elif defined(__SAM3X8E__) 25 | // Include sam/due headers 26 | #include "platforms/arm/sam/led_sysdefs_arm_sam.h" 27 | #elif defined(STM32F10X_MD) || defined(__STM32F1__) 28 | #include "platforms/arm/stm32/led_sysdefs_arm_stm32.h" 29 | #elif defined(__SAMD21G18A__) || defined(__SAMD21J18A__) || defined(__SAMD21E17A__) || defined(__SAMD21E18A__) || defined(__SAMD51G19A__) || defined(__SAMD51J19A__) 30 | #include "platforms/arm/d21/led_sysdefs_arm_d21.h" 31 | #elif defined(ESP8266) 32 | #include "platforms/esp/8266/led_sysdefs_esp8266.h" 33 | #elif defined(ESP32) 34 | #include "platforms/esp/32/led_sysdefs_esp32.h" 35 | #elif defined(__AVR__) 36 | // AVR platforms 37 | #include "platforms/avr/led_sysdefs_avr.h" 38 | #else 39 | // 40 | // We got here because we don't recognize the platform that you're 41 | // trying to compile for: it's not AVR, or an ESP or ARM that we recognize. 42 | // 43 | // If you're reading this because you got the error below, 44 | // and if this new platform is just a minor variant of an 45 | // existing supported ARM platform, you may be able to add 46 | // a new 'defined(XXX)' selector in the apporpriate code above. 47 | // 48 | // If this platform is a new microcontroller, see "PORTING.md". 49 | // 50 | #error "This platform isn't recognized by FastLED... yet. See comments in FastLED/led_sysdefs.h for options." 51 | #endif 52 | 53 | #ifndef FASTLED_NAMESPACE_BEGIN 54 | #define FASTLED_NAMESPACE_BEGIN 55 | #define FASTLED_NAMESPACE_END 56 | #define FASTLED_USING_NAMESPACE 57 | #endif 58 | 59 | // Arduino.h needed for convenience functions digitalPinToPort/BitMask/portOutputRegister and the pinMode methods. 60 | #ifdef ARDUINO 61 | #include 62 | #endif 63 | 64 | // F_CPU is almost certainly not defined BB 65 | //#define CLKS_PER_US (F_CPU/1000000) 66 | 67 | #endif 68 | -------------------------------------------------------------------------------- /ledc/components/FastLED-idf/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 | #if defined(LIB8_ATTINY) 16 | #define APPLY_FASTLED_RAND16_2053(x) (x << 11) + (x << 2) + x 17 | #else 18 | #define APPLY_FASTLED_RAND16_2053(x) (x * FASTLED_RAND16_2053) 19 | #endif 20 | 21 | /// random number seed 22 | extern uint16_t rand16seed;// = RAND16_SEED; 23 | 24 | /// Generate an 8-bit random number 25 | LIB8STATIC uint8_t random8() 26 | { 27 | rand16seed = APPLY_FASTLED_RAND16_2053(rand16seed) + FASTLED_RAND16_13849; 28 | // return the sum of the high and low bytes, for better 29 | // mixing and non-sequential correlation 30 | return (uint8_t)(((uint8_t)(rand16seed & 0xFF)) + 31 | ((uint8_t)(rand16seed >> 8))); 32 | } 33 | 34 | /// Generate a 16 bit random number 35 | LIB8STATIC uint16_t random16() 36 | { 37 | rand16seed = APPLY_FASTLED_RAND16_2053(rand16seed) + FASTLED_RAND16_13849; 38 | return rand16seed; 39 | } 40 | 41 | /// Generate an 8-bit random number between 0 and lim 42 | /// @param lim the upper bound for the result 43 | LIB8STATIC uint8_t random8(uint8_t lim) 44 | { 45 | uint8_t r = random8(); 46 | r = (r*lim) >> 8; 47 | return r; 48 | } 49 | 50 | /// Generate an 8-bit random number in the given range 51 | /// @param min the lower bound for the random number 52 | /// @param lim the upper bound for the random number 53 | LIB8STATIC uint8_t random8(uint8_t min, uint8_t lim) 54 | { 55 | uint8_t delta = lim - min; 56 | uint8_t r = random8(delta) + min; 57 | return r; 58 | } 59 | 60 | /// Generate an 16-bit random number between 0 and lim 61 | /// @param lim the upper bound for the result 62 | LIB8STATIC uint16_t random16( uint16_t lim) 63 | { 64 | uint16_t r = random16(); 65 | uint32_t p = (uint32_t)lim * (uint32_t)r; 66 | r = p >> 16; 67 | return r; 68 | } 69 | 70 | /// Generate an 16-bit random number in the given range 71 | /// @param min the lower bound for the random number 72 | /// @param lim the upper bound for the random number 73 | LIB8STATIC uint16_t random16( uint16_t min, uint16_t lim) 74 | { 75 | uint16_t delta = lim - min; 76 | uint16_t r = random16( delta) + min; 77 | return r; 78 | } 79 | 80 | /// Set the 16-bit seed used for the random number generator 81 | LIB8STATIC void random16_set_seed( uint16_t seed) 82 | { 83 | rand16seed = seed; 84 | } 85 | 86 | /// Get the current seed value for the random number generator 87 | LIB8STATIC uint16_t random16_get_seed() 88 | { 89 | return rand16seed; 90 | } 91 | 92 | /// Add entropy into the random number generator 93 | LIB8STATIC void random16_add_entropy( uint16_t entropy) 94 | { 95 | rand16seed += entropy; 96 | } 97 | 98 | ///@} 99 | 100 | #endif 101 | -------------------------------------------------------------------------------- /ledc/components/FastLED-idf/library.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "FastLED", 3 | "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.", 4 | "keywords": "led,noise,rgb,math,fast", 5 | "authors": [ 6 | { 7 | "name": "Daniel Garcia", 8 | "url": "https://github.com/focalintent", 9 | "maintainer": true 10 | }, 11 | { 12 | "name": "Mark Kriegsman", 13 | "url": "https://github.com/kriegsman", 14 | "maintainer": true 15 | }, 16 | { 17 | "name": "Sam Guyer", 18 | "url": "https://github.com/samguyer", 19 | "maintainer": true 20 | }, 21 | { 22 | "name": "Jason Coon", 23 | "url": "https://github.com/jasoncoon", 24 | "maintainer": true 25 | }, 26 | { 27 | "name": "Josh Huber", 28 | "url": "https://github.com/uberjay", 29 | "maintainer": true 30 | } 31 | ], 32 | "repository": { 33 | "type": "git", 34 | "url": "https://github.com/FastLED/FastLED.git" 35 | }, 36 | "version": "3.3.3", 37 | "license": "MIT", 38 | "homepage": "http://fastled.io", 39 | "frameworks": "arduino", 40 | "platforms": "atmelavr, atmelsam, freescalekinetis, nordicnrf51, nxplpc, ststm32, teensy, espressif8266, espressif32, nordicnrf52", 41 | "export": { 42 | "exclude": [ 43 | "docs", 44 | "extras" 45 | ] 46 | }, 47 | "build": { 48 | "srcFilter": [ 49 | "+<*.c>", 50 | "+<*.cpp>", 51 | "+<*.h>" 52 | ], 53 | "libArchive": false 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /ledc/components/FastLED-idf/library.properties: -------------------------------------------------------------------------------- 1 | name=FastLED 2 | version=3.3.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 | includes=FastLED.h 11 | -------------------------------------------------------------------------------- /ledc/components/FastLED-idf/platforms.cpp: -------------------------------------------------------------------------------- 1 | #define FASTLED_INTERNAL 2 | 3 | 4 | // Interrupt handlers cannot be defined in the header. 5 | // They must be defined as C functions, or they won't 6 | // be found (due to name mangling), and thus won't 7 | // override any default weak definition. 8 | #if defined(NRF52_SERIES) 9 | 10 | #include "platforms/arm/nrf52/led_sysdefs_arm_nrf52.h" 11 | #include "platforms/arm/nrf52/arbiter_nrf52.h" 12 | 13 | uint32_t isrCount; 14 | 15 | #ifdef __cplusplus 16 | extern "C" { 17 | #endif 18 | // NOTE: Update platforms.cpp in root of FastLED library if this changes 19 | #if defined(FASTLED_NRF52_ENABLE_PWM_INSTANCE0) 20 | void PWM0_IRQHandler(void) { isrCount++; PWM_Arbiter<0>::isr_handler(); } 21 | #endif 22 | #if defined(FASTLED_NRF52_ENABLE_PWM_INSTANCE1) 23 | void PWM1_IRQHandler(void) { isrCount++; PWM_Arbiter<1>::isr_handler(); } 24 | #endif 25 | #if defined(FASTLED_NRF52_ENABLE_PWM_INSTANCE2) 26 | void PWM2_IRQHandler(void) { isrCount++; PWM_Arbiter<2>::isr_handler(); } 27 | #endif 28 | #if defined(FASTLED_NRF52_ENABLE_PWM_INSTANCE3) 29 | void PWM3_IRQHandler(void) { isrCount++; PWM_Arbiter<3>::isr_handler(); } 30 | #endif 31 | #ifdef __cplusplus 32 | } 33 | #endif 34 | 35 | #endif // defined(NRF52_SERIES) 36 | 37 | 38 | 39 | // FASTLED_NAMESPACE_BEGIN 40 | // FASTLED_NAMESPACE_END 41 | -------------------------------------------------------------------------------- /ledc/components/FastLED-idf/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(NRF52_SERIES) 11 | #include "platforms/arm/nrf52/fastled_arm_nrf52.h" 12 | #elif defined(__MK20DX128__) || defined(__MK20DX256__) 13 | // Include k20/T3 headers 14 | #include "platforms/arm/k20/fastled_arm_k20.h" 15 | #elif defined(__MK66FX1M0__) || defined(__MK64FX512__) 16 | // Include k66/T3.6 headers 17 | #include "platforms/arm/k66/fastled_arm_k66.h" 18 | #elif defined(__MKL26Z64__) 19 | // Include kl26/T-LC headers 20 | #include "platforms/arm/kl26/fastled_arm_kl26.h" 21 | #elif defined(__IMXRT1062__) 22 | // teensy4 23 | #include "platforms/arm/mxrt1062/fastled_arm_mxrt1062.h" 24 | #elif defined(__SAM3X8E__) 25 | // Include sam/due headers 26 | #include "platforms/arm/sam/fastled_arm_sam.h" 27 | #elif defined(STM32F10X_MD) || defined(__STM32F1__) 28 | #include "platforms/arm/stm32/fastled_arm_stm32.h" 29 | #elif defined(__SAMD21G18A__) || defined(__SAMD21J18A__) || defined(__SAMD21E17A__) || defined(__SAMD21E18A__) 30 | #include "platforms/arm/d21/fastled_arm_d21.h" 31 | #elif defined(__SAMD51G19A__) || defined(__SAMD51J19A__) 32 | #include "platforms/arm/d51/fastled_arm_d51.h" 33 | #elif defined(ESP8266) 34 | #include "platforms/esp/8266/fastled_esp8266.h" 35 | #elif defined(ESP32) 36 | #include "platforms/esp/32/fastled_esp32.h" 37 | #elif defined(ARDUINO_ARCH_APOLLO3) 38 | #include "platforms/apollo3/fastled_apollo3.h" 39 | #else 40 | // AVR platforms 41 | #include "platforms/avr/fastled_avr.h" 42 | #endif 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /ledc/components/FastLED-idf/platforms/esp/32/fastled_esp32.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "fastpin_esp32.h" 4 | 5 | #ifdef FASTLED_ALL_PINS_HARDWARE_SPI 6 | #include "fastspi_esp32.h" 7 | #endif 8 | 9 | #ifdef FASTLED_ESP32_I2S 10 | #include "clockless_i2s_esp32.h" 11 | #else 12 | #include "clockless_rmt_esp32.h" 13 | #endif 14 | 15 | // #include "clockless_block_esp32.h" 16 | -------------------------------------------------------------------------------- /ledc/components/FastLED-idf/platforms/esp/32/fastpin_esp32.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // In order to get the GPIO structure, we need 4 | // enough of the headers. 5 | #include 6 | #include "esp_err.h" 7 | #include "freertos/FreeRTOS.h" 8 | #include "freertos/xtensa_api.h" 9 | #include "driver/gpio.h" 10 | #include "soc/gpio_periph.h" 11 | 12 | FASTLED_NAMESPACE_BEGIN 13 | 14 | template class _ESPPIN { 15 | 16 | public: 17 | typedef volatile uint32_t * port_ptr_t; 18 | typedef uint32_t port_t; 19 | 20 | // BB 21 | // It could be better to to the following, then not have to pull in as 22 | // much of the hal: 23 | // inline static void setOutput() { gpio_set_direction(PIN, GPIO_MODE_OUTPUT); } 24 | // inline static void setInput() { gpio_set_direction(PIN, GPIO_MODE_INPUT); } 25 | 26 | 27 | inline static void setOutput() { pinMode(PIN, OUTPUT); } 28 | inline static void setInput() { pinMode(PIN, INPUT); } 29 | 30 | inline static void hi() __attribute__ ((always_inline)) { 31 | if (PIN < 32) GPIO.out_w1ts = MASK; 32 | else GPIO.out1_w1ts.val = MASK; 33 | } 34 | 35 | inline static void lo() __attribute__ ((always_inline)) { 36 | if (PIN < 32) GPIO.out_w1tc = MASK; 37 | else GPIO.out1_w1tc.val = MASK; 38 | } 39 | 40 | inline static void set(register port_t val) __attribute__ ((always_inline)) { 41 | if (PIN < 32) GPIO.out = val; 42 | else GPIO.out1.val = val; 43 | } 44 | 45 | inline static void strobe() __attribute__ ((always_inline)) { toggle(); toggle(); } 46 | 47 | inline static void toggle() __attribute__ ((always_inline)) { 48 | if(PIN < 32) { GPIO.out ^= MASK; } 49 | else { GPIO.out1.val ^=MASK; } 50 | } 51 | 52 | inline static void hi(register port_ptr_t port) __attribute__ ((always_inline)) { hi(); } 53 | inline static void lo(register port_ptr_t port) __attribute__ ((always_inline)) { lo(); } 54 | inline static void fastset(register port_ptr_t port, register port_t val) __attribute__ ((always_inline)) { *port = val; } 55 | 56 | inline static port_t hival() __attribute__ ((always_inline)) { 57 | if (PIN < 32) return GPIO.out | MASK; 58 | else return GPIO.out1.val | MASK; 59 | } 60 | 61 | inline static port_t loval() __attribute__ ((always_inline)) { 62 | if (PIN < 32) return GPIO.out & ~MASK; 63 | else return GPIO.out1.val & ~MASK; 64 | } 65 | 66 | inline static port_ptr_t port() __attribute__ ((always_inline)) { 67 | if (PIN < 32) return &GPIO.out; 68 | else return &GPIO.out1.val; 69 | } 70 | 71 | inline static port_ptr_t sport() __attribute__ ((always_inline)) { 72 | if (PIN < 32) return &GPIO.out_w1ts; 73 | else return &GPIO.out1_w1ts.val; 74 | } 75 | 76 | inline static port_ptr_t cport() __attribute__ ((always_inline)) { 77 | if (PIN < 32) return &GPIO.out_w1tc; 78 | else return &GPIO.out1_w1tc.val; 79 | } 80 | 81 | inline static port_t mask() __attribute__ ((always_inline)) { return MASK; } 82 | 83 | inline static bool isset() __attribute__ ((always_inline)) { 84 | if (PIN < 32) return GPIO.out & MASK; 85 | else return GPIO.out1.val & MASK; 86 | } 87 | }; 88 | 89 | #define _FL_DEFPIN(PIN) template<> class FastPin : public _ESPPIN {}; 90 | 91 | _FL_DEFPIN(0); 92 | _FL_DEFPIN(1); // WARNING: Using TX causes flashiness when uploading 93 | _FL_DEFPIN(2); 94 | _FL_DEFPIN(3); // WARNING: Using RX causes flashiness when uploading 95 | _FL_DEFPIN(4); 96 | _FL_DEFPIN(5); 97 | 98 | // -- These pins are not safe to use: 99 | // _FL_DEFPIN(6,6); _FL_DEFPIN(7,7); _FL_DEFPIN(8,8); 100 | // _FL_DEFPIN(9,9); _FL_DEFPIN(10,10); _FL_DEFPIN(11,11); 101 | 102 | _FL_DEFPIN(12); 103 | _FL_DEFPIN(13); 104 | _FL_DEFPIN(14); 105 | _FL_DEFPIN(15); 106 | _FL_DEFPIN(16); 107 | _FL_DEFPIN(17); 108 | _FL_DEFPIN(18); 109 | _FL_DEFPIN(19); 110 | 111 | // No pin 20 : _FL_DEFPIN(20,20); 112 | 113 | _FL_DEFPIN(21); // Works, but note that GPIO21 is I2C SDA 114 | _FL_DEFPIN(22); // Works, but note that GPIO22 is I2C SCL 115 | _FL_DEFPIN(23); 116 | 117 | // No pin 24 : _FL_DEFPIN(24,24); 118 | 119 | _FL_DEFPIN(25); 120 | _FL_DEFPIN(26); 121 | _FL_DEFPIN(27); 122 | 123 | // No pin 28-31: _FL_DEFPIN(28,28); _FL_DEFPIN(29,29); _FL_DEFPIN(30,30); _FL_DEFPIN(31,31); 124 | 125 | // Need special handling for pins > 31 126 | _FL_DEFPIN(32); 127 | _FL_DEFPIN(33); 128 | 129 | #define HAS_HARDWARE_PIN_SUPPORT 130 | 131 | FASTLED_NAMESPACE_END 132 | -------------------------------------------------------------------------------- /ledc/components/FastLED-idf/platforms/esp/32/led_sysdefs_esp32.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef ESP32 4 | #define ESP32 5 | #endif 6 | 7 | #define FASTLED_ESP32 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 unsigned long prog_uint32_t; 15 | 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 | // BB - I think I'm compiling in CXX in this project 28 | // #define NEED_CXX_BITS 29 | 30 | // These can be overridden 31 | # define FASTLED_ESP32_RAW_PIN_ORDER 32 | 33 | // #define cli() os_intr_lock(); 34 | // #define sei() os_intr_lock(); 35 | -------------------------------------------------------------------------------- /ledc/components/FastLED-idf/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 | /// @deprecated - use FastLED.setMaxPowerInMilliWatts 25 | void set_max_power_in_milliwatts( uint32_t powerInmW); 26 | 27 | /// Select a pin with an led that will be flashed to indicate that power management 28 | /// is pulling down the brightness 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 | -------------------------------------------------------------------------------- /ledc/components/WS2812FX-idf/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | 3 | set(srcs 4 | "FX.cpp" 5 | "FX_fcn.cpp" 6 | ) 7 | 8 | # everything needs the ESP32 flag, not sure why this won't work 9 | # going to hack by adding the ESP32 define in the h file 10 | #`target_compile_options(${COMPONENT_LIB} PRIVATE "-DESP32") 11 | 12 | idf_component_register(SRCS "${srcs}" 13 | INCLUDE_DIRS "." 14 | REQUIRES FastLED-idf ) 15 | -------------------------------------------------------------------------------- /ledc/components/WS2812FX-idf/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 | -------------------------------------------------------------------------------- /ledc/components/WS2812FX-idf/README.md: -------------------------------------------------------------------------------- 1 | # WS2812FX pattern library 2 | 3 | There are a few different pattern libraries scattered throughout the internet. One of the better 4 | and more interesting started here: 5 | 6 | https://github.com/kitesurfer1404/WS2812FX 7 | 8 | and it uses NeoPixel, and Arduino. 9 | 10 | This is a port to FastLED, and to ESP-IDF. 11 | 12 | This version started from the WLED source code, for no really good reason, as of 9/11/2020. 13 | 14 | https://github.com/Aircoookie/WLED 15 | 16 | # differences 17 | 18 | This port doesn't have RGBW support, nor for analog LEDs, simply because FastLED doesn't support them, so 19 | it was easier to rip them out. 20 | 21 | # using 22 | 23 | See `main.cpp` for an example. 24 | 25 | There is one interesting bit about the port, which is instead of subclassing the LEDs, 26 | you init it by passing the CRGB LED array in. 27 | 28 | This means you can support a lot of LEDs on a lot of pins. In order to code for that, make sure the CRGB LED array 29 | you create is contiguous, like this: 30 | 31 | ``` 32 | #define NUM_LEDS1 33 | #define NUM_LEDS2 34 | CRGB leds[NUM_LEDS1 + NUM_LEDS2]; 35 | FastLED.addLeds(&leds[0], NUM_LEDS1); 36 | FastLED.addLeds(&leds[1], NUM_LEDS2); 37 | ``` 38 | 39 | Then you can pass all of the leds array with the entire size. 40 | 41 | Then, another benefit of this interface is the segments system. You can have a completly different mapping of 42 | segments, arbitrarily so. 43 | 44 | # porting and notes 45 | 46 | Annoyingly, the old code used Arduino calls. They got urned into `#define`s. 47 | 48 | Arduino code likes milliseconds, but ESP-IDF code likes microseconds. There should probably be some re-coding. 49 | 50 | A benefit of the WLED version is you can reuse the WS2812FX object. Interestingly, some patterns 51 | allocate per-pixel memory. 52 | 53 | Probably some of the code should be made more FastLED specific, and use more of the 8-bit code. 54 | It should also probably be integrated together with 'show' and double-buffer or similar. 55 | 56 | -------------------------------------------------------------------------------- /ledc/components/WS2812FX-idf/component.mk: -------------------------------------------------------------------------------- 1 | COMPONENT_SRCDIRS := . 2 | COMPONENT_ADD_INCLUDEDIRS := . 3 | 4 | -------------------------------------------------------------------------------- /ledc/components/WiFiMulti-idf/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | 3 | set(srcs 4 | "WiFiMulti.c" 5 | ) 6 | 7 | # everything needs the ESP32 flag, not sure why this won't work 8 | # going to hack by adding the ESP32 define in the h file 9 | #`target_compile_options(${COMPONENT_LIB} PRIVATE "-DESP32") 10 | 11 | idf_component_register(SRCS "WiFiMulti-idf.c" 12 | INCLUDE_DIRS "./include" ) 13 | -------------------------------------------------------------------------------- /ledc/components/WiFiMulti-idf/Kconfig: -------------------------------------------------------------------------------- 1 | menu "WiFiMulti" 2 | 3 | config WIFI_MULTI_TEST 4 | bool "Create a Wifi Multi LED option in case I need to later" 5 | default n 6 | help 7 | I don't know if I'm going to have to add menuconfig options in the future. 8 | Maybe I will. If I do, this is the template for doing it. 9 | 10 | endmenu 11 | -------------------------------------------------------------------------------- /ledc/components/WiFiMulti-idf/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2020 Brian Bulkowski 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 | -------------------------------------------------------------------------------- /ledc/components/WiFiMulti-idf/component.mk: -------------------------------------------------------------------------------- 1 | COMPONENT_SRCDIRS := . 2 | COMPONENT_ADD_INCLUDEDIRS := . 3 | COMPONENT_PRIV_INCLUDEDIRS := lib8tion platforms/esp/32 4 | -------------------------------------------------------------------------------- /ledc/components/WiFiMulti-idf/include/WiFiMulti-idf.h: -------------------------------------------------------------------------------- 1 | /* WiFiMulti-idf 2 | 3 | ** External Interfaces to be called by the application 4 | ** 5 | ** Copyright Brian Bulkowski, (c) 2020 6 | ** brian@bulkowski.org 7 | 8 | Unless required by applicable law or agreed to in writing, this 9 | software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 10 | CONDITIONS OF ANY KIND, either express or implied. 11 | */ 12 | 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | #include "freertos/FreeRTOS.h" 19 | #include "freertos/task.h" 20 | #include "freertos/event_groups.h" 21 | #include "freertos/semphr.h" 22 | 23 | #include "esp_system.h" 24 | #include "esp_wifi.h" 25 | #include "esp_log.h" 26 | #include "esp_err.h" 27 | 28 | extern "C" { 29 | 30 | /* 31 | ** NOT EXISTING! Please see the readme and do some coding if you want this supported! 32 | */ 33 | int wifi_multi_ap_remove(const char *ssid); 34 | 35 | /* 36 | ** Add an AP. If there is no password ( it's open ) you can pass nothing. 37 | ** Both values are put into an internal datastructure and are not consumed. 38 | */ 39 | 40 | int wifi_multi_ap_add(const char* ssid, const char *password); 41 | 42 | /* 43 | ** it's very useful to set the log levels programmatically so you can 44 | ** see the decisions getting made by the unit and report bugs. 45 | ** WARNING - quiet except for disasterous things 46 | ** INFO - shows when you attempt to connect, fail to connect, and get IP addresses 47 | ** DEBUG - shows info about the choices being made 48 | ** VERBOSE shows even more info about the choices being made 49 | */ 50 | 51 | void wifi_multi_loglevel_set(esp_log_level_t loglevel); 52 | 53 | /* 54 | ** call this function BEFORE you add aps to have the background tasks maintain 55 | ** the network connection 56 | */ 57 | 58 | void wifi_multi_start(); 59 | 60 | } /* extern C */ 61 | 62 | -------------------------------------------------------------------------------- /ledc/main/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | idf_component_register(SRCS "ledc_main.cpp" "ledc_server.cpp" "ledc.cpp" 2 | INCLUDE_DIRS "." 3 | EMBED_FILES "jquery.min.js" "index.html") 4 | -------------------------------------------------------------------------------- /ledc/main/component.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Main Makefile. This is basically the same as a component makefile. 3 | # 4 | -------------------------------------------------------------------------------- /ledc/main/ledc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FANC.h 3 | * Fan controler, but more importantly, my first ESP32 4 | * project that controls something with a web interface and 5 | * just a basic thing. 6 | * 7 | * AS-IS 8 | * Copywrite 2020, Brian Bulkowski 9 | * 10 | */ 11 | 12 | esp_err_t ledc_init(void); 13 | void ledc_destroy(void); 14 | 15 | esp_err_t ledc_led_mode_set(int mode); 16 | int ledc_led_mode_get(void); 17 | 18 | esp_err_t ledc_led_speed_set(int mode); 19 | int ledc_led_speed_get(void); 20 | 21 | esp_err_t webserver_init(void); 22 | void webserver_destroy(); 23 | 24 | -------------------------------------------------------------------------------- /ledc/main/palettes.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "FastLED.h" 4 | 5 | // This function fills the palette with totally random colors. 6 | void SetupTotallyRandomPalette() 7 | { 8 | for( int i = 0; i < 16; i++) { 9 | currentPalette[i] = CHSV( random8(), 255, random8()); 10 | } 11 | } 12 | 13 | // This function sets up a palette of black and white stripes, 14 | // using code. Since the palette is effectively an array of 15 | // sixteen CRGB colors, the various fill_* functions can be used 16 | // to set them up. 17 | void SetupBlackAndWhiteStripedPalette() 18 | { 19 | // 'black out' all 16 palette entries... 20 | fill_solid( currentPalette, 16, CRGB::Black); 21 | // and set every fourth one to white. 22 | currentPalette[0] = CRGB::White; 23 | currentPalette[4] = CRGB::White; 24 | currentPalette[8] = CRGB::White; 25 | currentPalette[12] = CRGB::White; 26 | 27 | } 28 | 29 | // This function sets up a palette of purple and green stripes. 30 | void SetupPurpleAndGreenPalette() 31 | { 32 | CRGB purple = CHSV( HUE_PURPLE, 255, 255); 33 | CRGB green = CHSV( HUE_GREEN, 255, 255); 34 | CRGB black = CRGB::Black; 35 | 36 | currentPalette = CRGBPalette16( 37 | green, green, black, black, 38 | purple, purple, black, black, 39 | green, green, black, black, 40 | purple, purple, black, black ); 41 | } 42 | 43 | 44 | // This example shows how to set up a static color palette 45 | // which is stored in PROGMEM (flash), which is almost always more 46 | // plentiful than RAM. A static PROGMEM palette like this 47 | // takes up 64 bytes of flash. 48 | const TProgmemPalette16 myRedWhiteBluePalette_p = 49 | { 50 | CRGB::Red, 51 | CRGB::Gray, // 'white' is too bright compared to red and blue 52 | CRGB::Blue, 53 | CRGB::Black, 54 | 55 | CRGB::Red, 56 | CRGB::Gray, 57 | CRGB::Blue, 58 | CRGB::Black, 59 | 60 | CRGB::Red, 61 | CRGB::Red, 62 | CRGB::Gray, 63 | CRGB::Gray, 64 | CRGB::Blue, 65 | CRGB::Blue, 66 | CRGB::Black, 67 | CRGB::Black 68 | }; 69 | 70 | -------------------------------------------------------------------------------- /ledc/partitions.csv: -------------------------------------------------------------------------------- 1 | # ESP-IDF Partition Table 2 | # Name, Type, SubType, Offset, Size, Flags 3 | nvs, data, nvs, 0x9000, 0x6000, 4 | phy_init, data, phy, 0xf000, 0x1000, 5 | factory, app, factory, 0x10000, 1536K, 6 | -------------------------------------------------------------------------------- /ledc2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # The following lines of boilerplate have to be in your project's CMakeLists 2 | # in this exact order for cmake to work correctly 3 | cmake_minimum_required(VERSION 3.5) 4 | 5 | include($ENV{IDF_PATH}/tools/cmake/project.cmake) 6 | project(ledc2) 7 | -------------------------------------------------------------------------------- /ledc2/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # This is a project Makefile. It is assumed the directory this Makefile resides in is a 3 | # project subdirectory. 4 | # 5 | 6 | PROJECT_NAME := ledc2 7 | 8 | include $(IDF_PATH)/make/project.mk 9 | 10 | -------------------------------------------------------------------------------- /ledc2/README.md: -------------------------------------------------------------------------------- 1 | # LEDC2! 2 | 3 | This is a quick project using the tech / code I built up or FANC, but 4 | now including the LED controller. Which means I want a web page, 5 | I want it continually using Wifi, and I want to see if I can 6 | maintain smooth patterns in a modest LED array. 7 | 8 | # Testing for network and no flashing 9 | 10 | A common problem of the ESP32 with LED control is that when flash is accessed, 11 | it holds of interrupts that also use flash, which means, any execution 12 | from executable flash _or_ the use of any static ( which are automatically put in flash ). 13 | 14 | Since the FANC / LEDC code all uses network requests sourced out of flash, 15 | as many systems will, there is the chance of generating a hold-off. 16 | 17 | This test is to try different simple ways of accessing and using the RMT 18 | driver so that you don't get flashes. There are two types of variants. 19 | 20 | First is which interrupt handler to use. Most of the drivers use their own, not the 21 | supplied drivers, which means if you have your own ISR you have to make sure it's all 22 | in flash and requesting high priority. 23 | 24 | Second is whether to have on-the-fly translation. The RMT bit pattern is not the same as the 25 | waveform, obviously, partially because of the nature of the 1-wire encoding, partially 26 | because of the difference in hertz between what the RMT is being driven, and partially 27 | there's an extra bit out of every 16 that's for another purpose. 28 | 29 | In the most recent version of the RMT driver from Espressif, there's the ability to have a 30 | translator function, so you don't end up blowing your memory. Or you can pre-build the 31 | RMT bit pattern, which means more stability in sending. 32 | 33 | These options are open to the FastLED and NeoPixelBus systems as well. 34 | 35 | # Wifi 36 | 37 | This uses the wifimulti module I wrote. It is configured to use three of the wifi 38 | networks I have around my house, and I have ( mostly ) not checked in the passwords. 39 | 40 | Please replace the information in fanc_main.cpp with wifi that you tend to use. 41 | 42 | A nice enhancement would be to use the wifi system with NVS, but I haven't gotten that far yet. 43 | 44 | # Configure the project 45 | 46 | There are a few settings you might need for your board, I've set up my favorites. 47 | 48 | ``` 49 | idf.py menuconfig 50 | ``` 51 | 52 | ### Build and Flash 53 | 54 | Build the project and flash it to the board, then run monitor tool to view serial output: 55 | 56 | ``` 57 | idf.py -p PORT flash monitor 58 | ``` 59 | 60 | (To exit the serial monitor, type ``Ctrl-]``.) 61 | 62 | 63 | -------------------------------------------------------------------------------- /ledc2/components/WiFiMulti-idf/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | 3 | set(srcs 4 | "WiFiMulti.c" 5 | ) 6 | 7 | # everything needs the ESP32 flag, not sure why this won't work 8 | # going to hack by adding the ESP32 define in the h file 9 | #`target_compile_options(${COMPONENT_LIB} PRIVATE "-DESP32") 10 | 11 | idf_component_register(SRCS "WiFiMulti-idf.c" 12 | INCLUDE_DIRS "./include" ) 13 | -------------------------------------------------------------------------------- /ledc2/components/WiFiMulti-idf/Kconfig: -------------------------------------------------------------------------------- 1 | menu "WiFiMulti" 2 | 3 | config WIFI_MULTI_TEST 4 | bool "Create a Wifi Multi LED option in case I need to later" 5 | default n 6 | help 7 | I don't know if I'm going to have to add menuconfig options in the future. 8 | Maybe I will. If I do, this is the template for doing it. 9 | 10 | endmenu 11 | -------------------------------------------------------------------------------- /ledc2/components/WiFiMulti-idf/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2020 Brian Bulkowski 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 | -------------------------------------------------------------------------------- /ledc2/components/WiFiMulti-idf/component.mk: -------------------------------------------------------------------------------- 1 | COMPONENT_SRCDIRS := . 2 | COMPONENT_ADD_INCLUDEDIRS := . 3 | COMPONENT_PRIV_INCLUDEDIRS := lib8tion platforms/esp/32 4 | -------------------------------------------------------------------------------- /ledc2/components/WiFiMulti-idf/include/WiFiMulti-idf.h: -------------------------------------------------------------------------------- 1 | /* WiFiMulti-idf 2 | 3 | ** External Interfaces to be called by the application 4 | ** 5 | ** Copyright Brian Bulkowski, (c) 2020 6 | ** brian@bulkowski.org 7 | 8 | Unless required by applicable law or agreed to in writing, this 9 | software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 10 | CONDITIONS OF ANY KIND, either express or implied. 11 | */ 12 | 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | #include "freertos/FreeRTOS.h" 19 | #include "freertos/task.h" 20 | #include "freertos/event_groups.h" 21 | #include "freertos/semphr.h" 22 | 23 | #include "esp_system.h" 24 | #include "esp_wifi.h" 25 | #include "esp_log.h" 26 | #include "esp_err.h" 27 | 28 | extern "C" { 29 | 30 | /* 31 | ** NOT EXISTING! Please see the readme and do some coding if you want this supported! 32 | */ 33 | int wifi_multi_ap_remove(const char *ssid); 34 | 35 | /* 36 | ** Add an AP. If there is no password ( it's open ) you can pass nothing. 37 | ** Both values are put into an internal datastructure and are not consumed. 38 | */ 39 | 40 | int wifi_multi_ap_add(const char* ssid, const char *password); 41 | 42 | /* 43 | ** it's very useful to set the log levels programmatically so you can 44 | ** see the decisions getting made by the unit and report bugs. 45 | ** WARNING - quiet except for disasterous things 46 | ** INFO - shows when you attempt to connect, fail to connect, and get IP addresses 47 | ** DEBUG - shows info about the choices being made 48 | ** VERBOSE shows even more info about the choices being made 49 | */ 50 | 51 | void wifi_multi_loglevel_set(esp_log_level_t loglevel); 52 | 53 | /* 54 | ** call this function BEFORE you add aps to have the background tasks maintain 55 | ** the network connection 56 | */ 57 | 58 | void wifi_multi_start(); 59 | 60 | } /* extern C */ 61 | 62 | -------------------------------------------------------------------------------- /ledc2/components/led_strip/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(component_srcs "src/led_strip_rmt_ws2812.c") 2 | 3 | idf_component_register(SRCS "${component_srcs}" 4 | INCLUDE_DIRS "include" 5 | PRIV_INCLUDE_DIRS "" 6 | PRIV_REQUIRES "driver" 7 | REQUIRES "") 8 | 9 | -------------------------------------------------------------------------------- /ledc2/components/led_strip/component.mk: -------------------------------------------------------------------------------- 1 | COMPONENT_ADD_INCLUDEDIRS := include 2 | 3 | COMPONENT_SRCDIRS := src 4 | -------------------------------------------------------------------------------- /ledc2/components/led_strip/include/led_strip.h: -------------------------------------------------------------------------------- 1 | // Copyright 2019 Espressif Systems (Shanghai) PTE LTD 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | #pragma once 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | #include "esp_err.h" 21 | 22 | /** 23 | * @brief LED Strip Type 24 | * 25 | */ 26 | typedef struct led_strip_s led_strip_t; 27 | 28 | /** 29 | * @brief LED Strip Device Type 30 | * 31 | */ 32 | typedef void *led_strip_dev_t; 33 | 34 | /** 35 | * @brief Declare of LED Strip Type 36 | * 37 | */ 38 | struct led_strip_s { 39 | /** 40 | * @brief Set RGB for a specific pixel 41 | * 42 | * @param strip: LED strip 43 | * @param index: index of pixel to set 44 | * @param red: red part of color 45 | * @param green: green part of color 46 | * @param blue: blue part of color 47 | * 48 | * @return 49 | * - ESP_OK: Set RGB for a specific pixel successfully 50 | * - ESP_ERR_INVALID_ARG: Set RGB for a specific pixel failed because of invalid parameters 51 | * - ESP_FAIL: Set RGB for a specific pixel failed because other error occurred 52 | */ 53 | esp_err_t (*set_pixel)(led_strip_t *strip, uint32_t index, uint32_t red, uint32_t green, uint32_t blue); 54 | 55 | /** 56 | * @brief Refresh memory colors to LEDs 57 | * 58 | * @param strip: LED strip 59 | * @param timeout_ms: timeout value for refreshing task 60 | * 61 | * @return 62 | * - ESP_OK: Refresh successfully 63 | * - ESP_ERR_TIMEOUT: Refresh failed because of timeout 64 | * - ESP_FAIL: Refresh failed because some other error occurred 65 | * 66 | * @note: 67 | * After updating the LED colors in the memory, a following invocation of this API is needed to flush colors to strip. 68 | */ 69 | esp_err_t (*refresh)(led_strip_t *strip, uint32_t timeout_ms); 70 | 71 | /** 72 | * @brief Clear LED strip (turn off all LEDs) 73 | * 74 | * @param strip: LED strip 75 | * @param timeout_ms: timeout value for clearing task 76 | * 77 | * @return 78 | * - ESP_OK: Clear LEDs successfully 79 | * - ESP_ERR_TIMEOUT: Clear LEDs failed because of timeout 80 | * - ESP_FAIL: Clear LEDs failed because some other error occurred 81 | */ 82 | esp_err_t (*clear)(led_strip_t *strip, uint32_t timeout_ms); 83 | 84 | /** 85 | * @brief Free LED strip resources 86 | * 87 | * @param strip: LED strip 88 | * 89 | * @return 90 | * - ESP_OK: Free resources successfully 91 | * - ESP_FAIL: Free resources failed because error occurred 92 | */ 93 | esp_err_t (*del)(led_strip_t *strip); 94 | }; 95 | 96 | /** 97 | * @brief LED Strip Configuration Type 98 | * 99 | */ 100 | typedef struct { 101 | uint32_t max_leds; /*!< Maximum LEDs in a single strip */ 102 | led_strip_dev_t dev; /*!< LED strip device (e.g. RMT channel, PWM channel, etc) */ 103 | } led_strip_config_t; 104 | 105 | /** 106 | * @brief Default configuration for LED strip 107 | * 108 | */ 109 | #define LED_STRIP_DEFAULT_CONFIG(number, dev_hdl) \ 110 | { \ 111 | .max_leds = number, \ 112 | .dev = dev_hdl, \ 113 | } 114 | 115 | /** 116 | * @brief Install a new ws2812 driver (based on RMT peripheral) 117 | * 118 | * @param config: LED strip configuration 119 | * @return 120 | * LED strip instance or NULL 121 | */ 122 | led_strip_t *led_strip_new_rmt_ws2812(const led_strip_config_t *config); 123 | 124 | /* 125 | ** helper function allows printing from a fast ISR 126 | */ 127 | void ws2812_memorybuf_get(char *b, int *len); 128 | 129 | #ifdef __cplusplus 130 | } 131 | #endif 132 | -------------------------------------------------------------------------------- /ledc2/main/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | idf_component_register(SRCS "ledc_main.cpp" "ledc_server.cpp" "ledc.cpp" 2 | INCLUDE_DIRS "." 3 | EMBED_FILES "jquery.min.js" "index.html") 4 | -------------------------------------------------------------------------------- /ledc2/main/component.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Main Makefile. This is basically the same as a component makefile. 3 | # 4 | -------------------------------------------------------------------------------- /ledc2/main/ledc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FANC.h 3 | * Fan controler, but more importantly, my first ESP32 4 | * project that controls something with a web interface and 5 | * just a basic thing. 6 | * 7 | * AS-IS 8 | * Copywrite 2020, Brian Bulkowski 9 | * 10 | */ 11 | 12 | esp_err_t ledc_init(void); 13 | void ledc_destroy(void); 14 | 15 | esp_err_t webserver_init(void); 16 | void webserver_destroy(); 17 | 18 | -------------------------------------------------------------------------------- /ledc2/main/ledc_main.cpp: -------------------------------------------------------------------------------- 1 | /* LEDC (LED Controller) fade example 2 | 3 | This example code is in the Public Domain (or CC0 licensed, at your option.) 4 | 5 | Unless required by applicable law or agreed to in writing, this 6 | software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 7 | CONDITIONS OF ANY KIND, either express or implied. 8 | */ 9 | #include 10 | #include "freertos/FreeRTOS.h" 11 | #include "freertos/task.h" 12 | 13 | #include "driver/ledc.h" 14 | #include "nvs_flash.h" 15 | #include "mdns.h" 16 | #include "esp_sntp.h" 17 | 18 | #include "WiFiMulti-idf.h" 19 | 20 | #include "esp_err.h" 21 | 22 | #include "esp_log.h" 23 | static const char *TAG = "ledc"; 24 | 25 | #include "ledc.h" 26 | 27 | 28 | extern "C" { 29 | void app_main(); 30 | } 31 | 32 | 33 | void app_main(void) 34 | { 35 | // logging is good 36 | // Note the following: 37 | // At compile time: in menuconfig, set the verbosity level using the option CONFIG_LOG_DEFAULT_LEVEL. 38 | // All logging statements for verbosity levels higher than CONFIG_LOG_DEFAULT_LEVEL will be removed by the preprocessor. 39 | // At runtime: all logs for verbosity levels lower than CONFIG_LOG_DEFAULT_LEVEL are enabled by default. 40 | // The function esp_log_level_set() can be used to set a logging level on a per module basis. 41 | // Modules are identified by their tags, which are human-readable ASCII zero-terminated strings. 42 | 43 | // ESP_LOG_NONE, ESP_LOG_ERROR (error), ESP_LOG_WARN, ESP_LOG_INFO, ESP_LOG_DEBUG, ESP_LOG_VERBOSE 44 | esp_log_level_set(TAG, ESP_LOG_DEBUG); 45 | 46 | // this seems to help the Wifi unit. Not so sure about that... 47 | esp_err_t ret = nvs_flash_init(); 48 | if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND) { 49 | ESP_ERROR_CHECK(nvs_flash_erase()); 50 | ret = nvs_flash_init(); 51 | } 52 | ESP_ERROR_CHECK(ret); 53 | 54 | // start the wifi service 55 | ESP_LOGI(TAG, " starting wifi"); 56 | wifi_multi_start(); 57 | 58 | wifi_multi_ap_add("sisyphus", "!medea4u"); 59 | wifi_multi_ap_add("bb-ap-x", "landshark"); 60 | wifi_multi_ap_add("laertes", "!medea4u"); 61 | ESP_LOGI(TAG, "finished configuring wifi"); 62 | 63 | // why not get network time, if it's out there? 64 | sntp_set_sync_mode(SNTP_SYNC_MODE_SMOOTH); 65 | sntp_setoperatingmode(SNTP_OPMODE_POLL); 66 | sntp_setservername(0, "us.pool.ntp.org"); 67 | sntp_init(); 68 | 69 | // start the fanc task 70 | ledc_init(); 71 | 72 | // start the webserver 73 | webserver_init(); 74 | 75 | // start the mdns service, it's helpful 76 | // going to hard code the name fanc at the moment, seems the project or NVS should have it 77 | mdns_init(); 78 | mdns_hostname_set(TAG); 79 | 80 | while(1) { 81 | 82 | vTaskDelay(1000 / portTICK_PERIOD_MS); 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /ledc2/main/palettes.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "FastLED.h" 4 | 5 | // This function fills the palette with totally random colors. 6 | void SetupTotallyRandomPalette() 7 | { 8 | for( int i = 0; i < 16; i++) { 9 | currentPalette[i] = CHSV( random8(), 255, random8()); 10 | } 11 | } 12 | 13 | // This function sets up a palette of black and white stripes, 14 | // using code. Since the palette is effectively an array of 15 | // sixteen CRGB colors, the various fill_* functions can be used 16 | // to set them up. 17 | void SetupBlackAndWhiteStripedPalette() 18 | { 19 | // 'black out' all 16 palette entries... 20 | fill_solid( currentPalette, 16, CRGB::Black); 21 | // and set every fourth one to white. 22 | currentPalette[0] = CRGB::White; 23 | currentPalette[4] = CRGB::White; 24 | currentPalette[8] = CRGB::White; 25 | currentPalette[12] = CRGB::White; 26 | 27 | } 28 | 29 | // This function sets up a palette of purple and green stripes. 30 | void SetupPurpleAndGreenPalette() 31 | { 32 | CRGB purple = CHSV( HUE_PURPLE, 255, 255); 33 | CRGB green = CHSV( HUE_GREEN, 255, 255); 34 | CRGB black = CRGB::Black; 35 | 36 | currentPalette = CRGBPalette16( 37 | green, green, black, black, 38 | purple, purple, black, black, 39 | green, green, black, black, 40 | purple, purple, black, black ); 41 | } 42 | 43 | 44 | // This example shows how to set up a static color palette 45 | // which is stored in PROGMEM (flash), which is almost always more 46 | // plentiful than RAM. A static PROGMEM palette like this 47 | // takes up 64 bytes of flash. 48 | const TProgmemPalette16 myRedWhiteBluePalette_p = 49 | { 50 | CRGB::Red, 51 | CRGB::Gray, // 'white' is too bright compared to red and blue 52 | CRGB::Blue, 53 | CRGB::Black, 54 | 55 | CRGB::Red, 56 | CRGB::Gray, 57 | CRGB::Blue, 58 | CRGB::Black, 59 | 60 | CRGB::Red, 61 | CRGB::Red, 62 | CRGB::Gray, 63 | CRGB::Gray, 64 | CRGB::Blue, 65 | CRGB::Blue, 66 | CRGB::Black, 67 | CRGB::Black 68 | }; 69 | 70 | -------------------------------------------------------------------------------- /ledc2/partitions.csv: -------------------------------------------------------------------------------- 1 | # ESP-IDF Partition Table 2 | # Name, Type, SubType, Offset, Size, Flags 3 | nvs, data, nvs, 0x9000, 0x6000, 4 | phy_init, data, phy, 0xf000, 0x1000, 5 | factory, app, factory, 0x10000, 1536K, 6 | -------------------------------------------------------------------------------- /scan/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # The following lines of boilerplate have to be in your project's CMakeLists 2 | # in this exact order for cmake to work correctly 3 | cmake_minimum_required(VERSION 3.5) 4 | 5 | include($ENV{IDF_PATH}/tools/cmake/project.cmake) 6 | project(scan) 7 | -------------------------------------------------------------------------------- /scan/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # This is a project Makefile. It is assumed the directory this Makefile resides in is a 3 | # project subdirectory. 4 | # 5 | 6 | PROJECT_NAME := scan 7 | 8 | include $(IDF_PATH)/make/project.mk 9 | 10 | -------------------------------------------------------------------------------- /scan/README.md: -------------------------------------------------------------------------------- 1 | # Wifi SCAN Example 2 | 3 | This example shows how to use the scan functionality of the Wi-Fi driver of ESP32. 4 | 5 | Two scan methods are supported: fast scan and all channel scan. 6 | 7 | * fast scan: in this mode, scan finishes right after a matching AP is detected, even if channels are not completely scanned. You can set thresholds for signal strength, as well as select desired authentication modes provided by the AP's. The Wi-Fi driver will ignore AP's that fail to meet mentioned criteria. 8 | 9 | * all channel scan: scan will end only after all channels are scanned; the Wi-Fi driver will store 4 of the fully matching AP's. Sort methods for AP's include rssi and authmode. After the scan, the Wi-Fi driver selects the AP that fits best based on the sort. 10 | 11 | After the scan, the Wi-Fi driver will try to connect. Because it needs to to allocate precious dynamic memory to store matching AP's, and, most of the cases, connect to the AP with the strongest reception, it does not need to record all the AP's matched. The number of matches stored is limited to 4 in order to limit dynamic memory usage. Among the 4 matches, AP's are allowed to carry the same SSID name and all possible authentication modes - Open, WEP, WPA and WPA2. 12 | -------------------------------------------------------------------------------- /scan/main/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | idf_component_register(SRCS "scan.c" 2 | INCLUDE_DIRS ".") -------------------------------------------------------------------------------- /scan/main/Kconfig.projbuild: -------------------------------------------------------------------------------- 1 | menu "Example Configuration" 2 | 3 | config EXAMPLE_WIFI_SSID 4 | string "WiFi SSID" 5 | default "myssid" 6 | help 7 | SSID (network name) for the example to connect to. 8 | 9 | config EXAMPLE_WIFI_PASSWORD 10 | string "WiFi Password" 11 | default "mypassword" 12 | help 13 | WiFi password (WPA or WPA2) for the example to use. 14 | 15 | choice EXAMPLE_SCAN_METHOD 16 | prompt "scan method" 17 | default EXAMPLE_WIFI_FAST_SCAN 18 | help 19 | scan method for the esp32 to use 20 | 21 | config EXAMPLE_WIFI_FAST_SCAN 22 | bool "fast" 23 | config EXAMPLE_WIFI_ALL_CHANNEL_SCAN 24 | bool "all" 25 | endchoice 26 | 27 | choice EXAMPLE_SORT_METHOD 28 | prompt "sort method" 29 | default EXAMPLE_WIFI_CONNECT_AP_BY_SIGNAL 30 | help 31 | sort method for the esp32 to use 32 | 33 | config EXAMPLE_WIFI_CONNECT_AP_BY_SIGNAL 34 | bool "rssi" 35 | config EXAMPLE_WIFI_CONNECT_AP_BY_SECURITY 36 | bool "authmode" 37 | endchoice 38 | 39 | config EXAMPLE_FAST_SCAN_THRESHOLD 40 | bool "fast scan threshold" 41 | default y 42 | help 43 | wifi fast scan threshold 44 | 45 | config EXAMPLE_FAST_SCAN_MINIMUM_SIGNAL 46 | int "fast scan minimum rssi" 47 | depends on EXAMPLE_FAST_SCAN_THRESHOLD 48 | range -127 0 49 | default -127 50 | help 51 | rssi is use to measure the signal 52 | 53 | choice EXAMPLE_FAST_SCAN_WEAKEST_AUTHMODE 54 | prompt "fast scan weakest authmode" 55 | depends on EXAMPLE_FAST_SCAN_THRESHOLD 56 | default EXAMPLE_FAST_SCAN_WEAKEST_AUTHMODE_OPEN 57 | 58 | config EXAMPLE_FAST_SCAN_WEAKEST_AUTHMODE_OPEN 59 | bool "open" 60 | config EXAMPLE_FAST_SCAN_WEAKEST_AUTHMODE_WEP 61 | bool "wep" 62 | config EXAMPLE_FAST_SCAN_WEAKEST_AUTHMODE_WPA 63 | bool "wpa" 64 | config EXAMPLE_FAST_SCAN_WEAKEST_AUTHMODE_WPA2 65 | bool "wpa2" 66 | endchoice 67 | 68 | endmenu 69 | -------------------------------------------------------------------------------- /scan/main/component.mk: -------------------------------------------------------------------------------- 1 | # 2 | # "main" pseudo-component makefile. 3 | # 4 | # (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.) 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /sign/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # The following five lines of boilerplate have to be in your project's 2 | # CMakeLists in this exact order for cmake to work correctly 3 | cmake_minimum_required(VERSION 3.5) 4 | 5 | include($ENV{IDF_PATH}/tools/cmake/project.cmake) 6 | project(sign) 7 | -------------------------------------------------------------------------------- /sign/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # This is a project Makefile. It is assumed the directory this Makefile resides in is a 3 | # project subdirectory. 4 | # 5 | 6 | PROJECT_NAME := sign 7 | 8 | include $(IDF_PATH)/make/project.mk 9 | 10 | -------------------------------------------------------------------------------- /sign/README.md: -------------------------------------------------------------------------------- 1 | # Sign Project 2 | 3 | Do whatever you'd like to in order to make a cool sign 4 | 5 | -------------------------------------------------------------------------------- /sign/components/FastLED-idf/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | 3 | set(srcs 4 | "FastLED.cpp" 5 | "bitswap.cpp" 6 | "colorpalettes.cpp" 7 | "colorutils.cpp" 8 | "hsv2rgb.cpp" 9 | "lib8tion.cpp" 10 | "noise.cpp" 11 | "platforms.cpp" 12 | "power_mgt.cpp" 13 | "wiring.cpp" 14 | "hal/esp32-hal-misc.c" 15 | "hal/esp32-hal-gpio.c" 16 | ) 17 | 18 | # everything needs the ESP32 flag, not sure why this won't work 19 | # going to hack by adding the ESP32 define in the h file 20 | #`target_compile_options(${COMPONENT_LIB} PRIVATE "-DESP32") 21 | 22 | idf_component_register(SRCS "${srcs}" 23 | INCLUDE_DIRS "." "./hal" ) 24 | -------------------------------------------------------------------------------- /sign/components/FastLED-idf/ESP-IDF.md: -------------------------------------------------------------------------------- 1 | # Port to ESP-IDF 2 | 3 | Describe what had to be done, when we did it 4 | 5 | # Environment 6 | 7 | This port is to be used with ESP-IDF version 4.x, which went GA on about Feb, 2020. 8 | 9 | The FastLED code is vintage 3.3, which includes sophisticated ESP32 support. 10 | -------------------------------------------------------------------------------- /sign/components/FastLED-idf/Kconfig: -------------------------------------------------------------------------------- 1 | menu "Fast LED" 2 | 3 | config FAST_LED_TEST 4 | bool "Create a Fast LED option in case I need to later" 5 | default n 6 | help 7 | I don't know if I'm going to have to add menuconfig options in the future. 8 | Maybe I will. If I do, this is the template for doing it. 9 | 10 | endmenu 11 | -------------------------------------------------------------------------------- /sign/components/FastLED-idf/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 | -------------------------------------------------------------------------------- /sign/components/FastLED-idf/PORTING.md: -------------------------------------------------------------------------------- 1 | =New platform porting guide= 2 | 3 | == Fast porting for a new board on existing hardware == 4 | 5 | Sometimes "porting" FastLED simply consists of supplying new pin definitions for the given platform. For example, platforms/avr/fastpin_avr.h contains various pin definitions for all the AVR variant chipsets/boards that FastLED supports. Defining a set of pins involves setting up a set of definitions - for example here's one full set from the avr fastpin file: 6 | 7 | ``` 8 | #elif defined(__AVR_ATmega1284P__) || defined(__AVR_ATmega644P__) 9 | 10 | _FL_IO(A); _FL_IO(B); _FL_IO(C); _FL_IO(D); 11 | 12 | #define MAX_PIN 31 13 | _FL_DEFPIN(0, 0, B); _FL_DEFPIN(1, 1, B); _FL_DEFPIN(2, 2, B); _FL_DEFPIN(3, 3, B); 14 | _FL_DEFPIN(4, 4, B); _FL_DEFPIN(5, 5, B); _FL_DEFPIN(6, 6, B); _FL_DEFPIN(7, 7, B); 15 | _FL_DEFPIN(8, 0, D); _FL_DEFPIN(9, 1, D); _FL_DEFPIN(10, 2, D); _FL_DEFPIN(11, 3, D); 16 | _FL_DEFPIN(12, 4, D); _FL_DEFPIN(13, 5, D); _FL_DEFPIN(14, 6, D); _FL_DEFPIN(15, 7, D); 17 | _FL_DEFPIN(16, 0, C); _FL_DEFPIN(17, 1, C); _FL_DEFPIN(18, 2, C); _FL_DEFPIN(19, 3, C); 18 | _FL_DEFPIN(20, 4, C); _FL_DEFPIN(21, 5, C); _FL_DEFPIN(22, 6, C); _FL_DEFPIN(23, 7, C); 19 | _FL_DEFPIN(24, 0, A); _FL_DEFPIN(25, 1, A); _FL_DEFPIN(26, 2, A); _FL_DEFPIN(27, 3, A); 20 | _FL_DEFPIN(28, 4, A); _FL_DEFPIN(29, 5, A); _FL_DEFPIN(30, 6, A); _FL_DEFPIN(31, 7, A); 21 | 22 | #define HAS_HARDWARE_PIN_SUPPORT 1 23 | ``` 24 | 25 | The ```_FL_IO``` macro is used to define the port registers for the platform while the ```_FL_DEFPIN``` macro is used to define pins. The parameters to the macro are the pin number, the bit on the port that represents that pin, and the port identifier itself. On some platforms, like the AVR, ports are identified by letter. On other platforms, like arm, ports are identified by number. 26 | 27 | The ```HAS_HARDWARE_PIN_SUPPORT``` define tells the rest of the FastLED library that there is hardware pin support available. There may be other platform specific defines for things like hardware SPI ports and such. 28 | 29 | == Setting up the basic files/folders == 30 | 31 | * Create platform directory (e.g. platforms/arm/kl26) 32 | * Create configuration header led_sysdefs_arm_kl26.h: 33 | * Define platform flags (like FASTLED_ARM/FASTLED_TEENSY) 34 | * Define configuration parameters re: interrupts, or clock doubling 35 | * Include extar system header files if needed 36 | * Create main platform include, fastled_arm_kl26.h 37 | * Include the various other header files as needed 38 | * Modify led_sysdefs.h to conditionally include platform sysdefs header file 39 | * Modify platforms.h to conditionally include platform fastled header 40 | 41 | == Porting fastpin.h == 42 | 43 | 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. 44 | 45 | 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. 46 | 47 | Explaining how the macros work and should be used is currently beyond the scope of this document. 48 | 49 | == Porting fastspi.h == 50 | 51 | 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. 52 | 53 | == Porting clockless.h == 54 | 55 | 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. 56 | -------------------------------------------------------------------------------- /sign/components/FastLED-idf/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 | -------------------------------------------------------------------------------- /sign/components/FastLED-idf/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 | -------------------------------------------------------------------------------- /sign/components/FastLED-idf/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 | -------------------------------------------------------------------------------- /sign/components/FastLED-idf/component.mk: -------------------------------------------------------------------------------- 1 | COMPONENT_SRCDIRS := . 2 | COMPONENT_ADD_INCLUDEDIRS := . 3 | COMPONENT_PRIV_INCLUDEDIRS := lib8tion platforms/esp/32 4 | -------------------------------------------------------------------------------- /sign/components/FastLED-idf/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 | -------------------------------------------------------------------------------- /sign/components/FastLED-idf/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 | -------------------------------------------------------------------------------- /sign/components/FastLED-idf/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 | #define FASTLED_SCALE8_FIXED 1 38 | // #define FASTLED_SCALE8_FIXED 0 39 | 40 | // Use this toggle whether to use 'fixed' FastLED pixel blending, including ColorFromPalette. 41 | // The prior pixel blend functions had integer-rounding math errors that led to 42 | // small errors being inadvertently added to the low bits of blended colors, including colors 43 | // retrieved from color palettes using LINEAR_BLEND. This is now fixed, and the 44 | // fix is enabled by default. However, if for some reason you wish to run with the old 45 | // blending, including the integer rounding and color errors, you can disable the bugfix here. 46 | #define FASTLED_BLEND_FIXED 1 47 | // #define FASTLED_BLEND_FIXED 0 48 | 49 | // Use this toggle whether to use 'fixed' FastLED 8- and 16-bit noise functions. 50 | // The prior noise functions had some math errors that led to 'discontinuities' in the 51 | // output, which by definition should be smooth and continuous. The bug led to 52 | // noise function output that had 'edges' and glitches in it. This is now fixed, and the 53 | // fix is enabled by default. However, if for some reason you wish to run with the old 54 | // noise code, including the glitches, you can disable the bugfix here. 55 | #define FASTLED_NOISE_FIXED 1 56 | //#define FASTLED_NOISE_FIXED 0 57 | 58 | // Use this to determine how many times FastLED will attempt to re-transmit a frame if interrupted 59 | // for too long by interrupts. 60 | #ifndef FASTLED_INTERRUPT_RETRY_COUNT 61 | #define FASTLED_INTERRUPT_RETRY_COUNT 2 62 | #endif 63 | 64 | // Use this toggle to enable global brightness in contollers that support is (ADA102 and SK9822). 65 | // It changes how color scaling works and uses global brightness before scaling down color values. 66 | // This enable much more accurate color control on low brightness settings. 67 | //#define FASTLED_USE_GLOBAL_BRIGHTNESS 1 68 | 69 | #endif 70 | -------------------------------------------------------------------------------- /sign/components/FastLED-idf/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 | // On some platforms, most notably ARM M0, unaligned access 67 | // to 'PROGMEM' for multibyte values (eg read dword) is 68 | // not allowed and causes a crash. This macro can help 69 | // force 4-byte alignment as needed. The FastLED gradient 70 | // palette code uses 'read dword', and now uses this macro 71 | // to make sure that gradient palettes are 4-byte aligned. 72 | #if defined(FASTLED_ARM) || defined(ESP32) || defined(ESP8266) 73 | #define FL_ALIGN_PROGMEM __attribute__ ((aligned (4))) 74 | #else 75 | #define FL_ALIGN_PROGMEM 76 | #endif 77 | 78 | 79 | FASTLED_NAMESPACE_END 80 | 81 | #endif 82 | -------------------------------------------------------------------------------- /sign/components/FastLED-idf/fastspi_dma.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bbulkow/esp32/46ebf3962d7aecb81c6ed24b86d680fd40567cbd/sign/components/FastLED-idf/fastspi_dma.h -------------------------------------------------------------------------------- /sign/components/FastLED-idf/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 | -------------------------------------------------------------------------------- /sign/components/FastLED-idf/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 | -------------------------------------------------------------------------------- /sign/components/FastLED-idf/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 | -------------------------------------------------------------------------------- /sign/components/FastLED-idf/hal/README.md: -------------------------------------------------------------------------------- 1 | # Source 2 | 3 | These files were taken from https://github.com/espressif/arduino-esp32 . 4 | 5 | They are licensed under Gnu LGPL. 6 | -------------------------------------------------------------------------------- /sign/components/FastLED-idf/hal/esp32-hal-cpu.h: -------------------------------------------------------------------------------- 1 | // Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef _ESP32_HAL_CPU_H_ 16 | #define _ESP32_HAL_CPU_H_ 17 | 18 | #ifdef __cplusplus 19 | extern "C" { 20 | #endif 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | typedef enum { APB_BEFORE_CHANGE, APB_AFTER_CHANGE } apb_change_ev_t; 27 | 28 | typedef void (* apb_change_cb_t)(void * arg, apb_change_ev_t ev_type, uint32_t old_apb, uint32_t new_apb); 29 | 30 | bool addApbChangeCallback(void * arg, apb_change_cb_t cb); 31 | bool removeApbChangeCallback(void * arg, apb_change_cb_t cb); 32 | 33 | //function takes the following frequencies as valid values: 34 | // 240, 160, 80 <<< For all XTAL types 35 | // 40, 20, 10 <<< For 40MHz XTAL 36 | // 26, 13 <<< For 26MHz XTAL 37 | // 24, 12 <<< For 24MHz XTAL 38 | bool setCpuFrequencyMhz(uint32_t cpu_freq_mhz); 39 | 40 | uint32_t getCpuFrequencyMhz(); // In MHz 41 | uint32_t getXtalFrequencyMhz(); // In MHz 42 | uint32_t getApbFrequency(); // In Hz 43 | 44 | #ifdef __cplusplus 45 | } 46 | #endif 47 | 48 | #endif /* _ESP32_HAL_CPU_H_ */ 49 | -------------------------------------------------------------------------------- /sign/components/FastLED-idf/hal/esp32-hal-gpio.h: -------------------------------------------------------------------------------- 1 | /* 2 | Arduino.h - Main include file for the Arduino SDK 3 | Copyright (c) 2005-2013 Arduino Team. All right reserved. 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | #ifndef MAIN_ESP32_HAL_GPIO_H_ 21 | #define MAIN_ESP32_HAL_GPIO_H_ 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif 26 | 27 | #include "esp32-hal.h" 28 | 29 | #define LOW 0x0 30 | #define HIGH 0x1 31 | 32 | //GPIO FUNCTIONS 33 | #define INPUT 0x01 34 | #define OUTPUT 0x02 35 | #define PULLUP 0x04 36 | #define INPUT_PULLUP 0x05 37 | #define PULLDOWN 0x08 38 | #define INPUT_PULLDOWN 0x09 39 | #define OPEN_DRAIN 0x10 40 | #define OUTPUT_OPEN_DRAIN 0x12 41 | #define SPECIAL 0xF0 42 | #define FUNCTION_1 0x00 43 | #define FUNCTION_2 0x20 44 | #define FUNCTION_3 0x40 45 | #define FUNCTION_4 0x60 46 | #define FUNCTION_5 0x80 47 | #define FUNCTION_6 0xA0 48 | #define ANALOG 0xC0 49 | 50 | //Interrupt Modes 51 | #define DISABLED 0x00 52 | #define RISING 0x01 53 | #define FALLING 0x02 54 | #define CHANGE 0x03 55 | #define ONLOW 0x04 56 | #define ONHIGH 0x05 57 | #define ONLOW_WE 0x0C 58 | #define ONHIGH_WE 0x0D 59 | 60 | typedef struct { 61 | uint8_t reg; /*!< GPIO register offset from DR_REG_IO_MUX_BASE */ 62 | int8_t rtc; /*!< RTC GPIO number (-1 if not RTC GPIO pin) */ 63 | int8_t adc; /*!< ADC Channel number (-1 if not ADC pin) */ 64 | int8_t touch; /*!< Touch Channel number (-1 if not Touch pin) */ 65 | } esp32_gpioMux_t; 66 | 67 | extern const esp32_gpioMux_t esp32_gpioMux[40]; 68 | extern const int8_t esp32_adc2gpio[20]; 69 | 70 | #define digitalPinIsValid(pin) ((pin) < 40 && esp32_gpioMux[(pin)].reg) 71 | #define digitalPinCanOutput(pin) ((pin) < 34 && esp32_gpioMux[(pin)].reg) 72 | #define digitalPinToRtcPin(pin) (((pin) < 40)?esp32_gpioMux[(pin)].rtc:-1) 73 | #define digitalPinToAnalogChannel(pin) (((pin) < 40)?esp32_gpioMux[(pin)].adc:-1) 74 | #define digitalPinToTouchChannel(pin) (((pin) < 40)?esp32_gpioMux[(pin)].touch:-1) 75 | #define digitalPinToDacChannel(pin) (((pin) == 25)?0:((pin) == 26)?1:-1) 76 | 77 | void pinMode(uint8_t pin, uint8_t mode); 78 | void digitalWrite(uint8_t pin, uint8_t val); 79 | int digitalRead(uint8_t pin); 80 | 81 | void attachInterrupt(uint8_t pin, void (*)(void), int mode); 82 | void attachInterruptArg(uint8_t pin, void (*)(void*), void * arg, int mode); 83 | void detachInterrupt(uint8_t pin); 84 | 85 | #ifdef __cplusplus 86 | } 87 | #endif 88 | 89 | #endif /* MAIN_ESP32_HAL_GPIO_H_ */ 90 | -------------------------------------------------------------------------------- /sign/components/FastLED-idf/hal/esp32-hal-i2c.h: -------------------------------------------------------------------------------- 1 | // Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | // modified Nov 2017 by Chuck Todd to support Interrupt Driven I/O 15 | 16 | #ifndef _ESP32_HAL_I2C_H_ 17 | #define _ESP32_HAL_I2C_H_ 18 | 19 | #ifdef __cplusplus 20 | extern "C" { 21 | #endif 22 | 23 | #include 24 | #include 25 | #include "freertos/FreeRTOS.h" 26 | #include "freertos/event_groups.h" 27 | 28 | // External Wire.h equivalent error Codes 29 | typedef enum { 30 | I2C_ERROR_OK=0, 31 | I2C_ERROR_DEV, 32 | I2C_ERROR_ACK, 33 | I2C_ERROR_TIMEOUT, 34 | I2C_ERROR_BUS, 35 | I2C_ERROR_BUSY, 36 | I2C_ERROR_MEMORY, 37 | I2C_ERROR_CONTINUE, 38 | I2C_ERROR_NO_BEGIN 39 | } i2c_err_t; 40 | 41 | struct i2c_struct_t; 42 | typedef struct i2c_struct_t i2c_t; 43 | 44 | i2c_t * i2cInit(uint8_t i2c_num, int8_t sda, int8_t scl, uint32_t clk_speed); 45 | void i2cRelease(i2c_t *i2c); // free ISR, Free DQ, Power off peripheral clock. Must call i2cInit() to recover 46 | i2c_err_t i2cWrite(i2c_t * i2c, uint16_t address, uint8_t* buff, uint16_t size, bool sendStop, uint16_t timeOutMillis); 47 | i2c_err_t i2cRead(i2c_t * i2c, uint16_t address, uint8_t* buff, uint16_t size, bool sendStop, uint16_t timeOutMillis, uint32_t *readCount); 48 | i2c_err_t i2cFlush(i2c_t *i2c); 49 | i2c_err_t i2cSetFrequency(i2c_t * i2c, uint32_t clk_speed); 50 | uint32_t i2cGetFrequency(i2c_t * i2c); 51 | uint32_t i2cGetStatus(i2c_t * i2c); // Status register of peripheral 52 | 53 | //Functions below should be used only if well understood 54 | //Might be deprecated and removed in future 55 | i2c_err_t i2cAttachSCL(i2c_t * i2c, int8_t scl); 56 | i2c_err_t i2cDetachSCL(i2c_t * i2c, int8_t scl); 57 | i2c_err_t i2cAttachSDA(i2c_t * i2c, int8_t sda); 58 | i2c_err_t i2cDetachSDA(i2c_t * i2c, int8_t sda); 59 | 60 | //Stickbreakers ISR Support 61 | i2c_err_t i2cProcQueue(i2c_t *i2c, uint32_t *readCount, uint16_t timeOutMillis); 62 | i2c_err_t i2cAddQueueWrite(i2c_t *i2c, uint16_t i2cDeviceAddr, uint8_t *dataPtr, uint16_t dataLen, bool SendStop, EventGroupHandle_t event); 63 | i2c_err_t i2cAddQueueRead(i2c_t *i2c, uint16_t i2cDeviceAddr, uint8_t *dataPtr, uint16_t dataLen, bool SendStop, EventGroupHandle_t event); 64 | 65 | //stickbreaker debug support 66 | uint32_t i2cDebug(i2c_t *, uint32_t setBits, uint32_t resetBits); 67 | // Debug actions have 3 currently defined locus 68 | // 0xXX------ : at entry of ProcQueue 69 | // 0x--XX---- : at exit of ProcQueue 70 | // 0x------XX : at entry of Flush 71 | // 72 | // bit 0 causes DumpI2c to execute 73 | // bit 1 causes DumpInts to execute 74 | // bit 2 causes DumpCmdqueue to execute 75 | // bit 3 causes DumpStatus to execute 76 | // bit 4 causes DumpFifo to execute 77 | 78 | #ifdef __cplusplus 79 | } 80 | #endif 81 | 82 | #endif /* _ESP32_HAL_I2C_H_ */ 83 | -------------------------------------------------------------------------------- /sign/components/FastLED-idf/hal/esp32-hal-rmt.h: -------------------------------------------------------------------------------- 1 | // Copyright 2018 Espressif Systems (Shanghai) PTE LTD 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef MAIN_ESP32_HAL_RMT_H_ 16 | #define MAIN_ESP32_HAL_RMT_H_ 17 | 18 | #ifdef __cplusplus 19 | extern "C" { 20 | #endif 21 | 22 | // notification flags 23 | #define RMT_FLAG_TX_DONE (1) 24 | #define RMT_FLAG_RX_DONE (2) 25 | #define RMT_FLAG_ERROR (4) 26 | #define RMT_FLAGS_ALL (RMT_FLAG_TX_DONE | RMT_FLAG_RX_DONE | RMT_FLAG_ERROR) 27 | 28 | struct rmt_obj_s; 29 | 30 | typedef enum { 31 | RMT_MEM_64 = 1, 32 | RMT_MEM_128 = 2, 33 | RMT_MEM_192 = 3, 34 | RMT_MEM_256 = 4, 35 | RMT_MEM_320 = 5, 36 | RMT_MEM_384 = 6, 37 | RMT_MEM_448 = 7, 38 | RMT_MEM_512 = 8, 39 | } rmt_reserve_memsize_t; 40 | 41 | typedef struct rmt_obj_s rmt_obj_t; 42 | 43 | typedef void (*rmt_rx_data_cb_t)(uint32_t *data, size_t len); 44 | 45 | typedef struct { 46 | union { 47 | struct { 48 | uint32_t duration0 :15; 49 | uint32_t level0 :1; 50 | uint32_t duration1 :15; 51 | uint32_t level1 :1; 52 | }; 53 | uint32_t val; 54 | }; 55 | } rmt_data_t; 56 | 57 | /** 58 | * Initialize the object 59 | * 60 | */ 61 | rmt_obj_t* rmtInit(int pin, bool tx_not_rx, rmt_reserve_memsize_t memsize); 62 | 63 | /** 64 | * Sets the clock/divider of timebase the nearest tick to the supplied value in nanoseconds 65 | * return the real actual tick value in ns 66 | */ 67 | float rmtSetTick(rmt_obj_t* rmt, float tick); 68 | 69 | /** 70 | * Sending data in one-go mode or continual mode 71 | * (more data being send while updating buffers in interrupts) 72 | * 73 | */ 74 | bool rmtWrite(rmt_obj_t* rmt, rmt_data_t* data, size_t size); 75 | 76 | /** 77 | * Loop data up to the reserved memsize continuously 78 | * 79 | */ 80 | bool rmtLoop(rmt_obj_t* rmt, rmt_data_t* data, size_t size); 81 | 82 | /** 83 | * Initiates async receive, event flag indicates data received 84 | * 85 | */ 86 | bool rmtReadAsync(rmt_obj_t* rmt, rmt_data_t* data, size_t size, void* eventFlag, bool waitForData, uint32_t timeout); 87 | 88 | /** 89 | * Initiates async receive with automatic buffering 90 | * and callback with data from ISR 91 | * 92 | */ 93 | bool rmtRead(rmt_obj_t* rmt, rmt_rx_data_cb_t cb); 94 | 95 | 96 | /* Additional interface */ 97 | 98 | /** 99 | * Start reception 100 | * 101 | */ 102 | bool rmtBeginReceive(rmt_obj_t* rmt); 103 | 104 | /** 105 | * Checks if reception completes 106 | * 107 | */ 108 | bool rmtReceiveCompleted(rmt_obj_t* rmt); 109 | 110 | /** 111 | * Reads the data for particular channel 112 | * 113 | */ 114 | bool rmtReadData(rmt_obj_t* rmt, uint32_t* data, size_t size); 115 | 116 | /** 117 | * Setting threshold for Rx completed 118 | */ 119 | bool rmtSetRxThreshold(rmt_obj_t* rmt, uint32_t value); 120 | 121 | /** 122 | * Setting carrier 123 | */ 124 | bool rmtSetCarrier(rmt_obj_t* rmt, bool carrier_en, bool carrier_level, uint32_t low, uint32_t high); 125 | 126 | /** 127 | * Setting input filter 128 | */ 129 | bool rmtSetFilter(rmt_obj_t* rmt, bool filter_en, uint32_t filter_level); 130 | 131 | /** 132 | * Deinitialize the driver 133 | */ 134 | bool rmtDeinit(rmt_obj_t *rmt); 135 | 136 | // TODO: 137 | // * uninstall interrupt when all channels are deinit 138 | // * send only-conti mode with circular-buffer 139 | // * put sanity checks to some macro or inlines 140 | // * doxy comments 141 | // * error reporting 142 | 143 | #ifdef __cplusplus 144 | } 145 | #endif 146 | 147 | #endif /* MAIN_ESP32_HAL_RMT_H_ */ 148 | -------------------------------------------------------------------------------- /sign/components/FastLED-idf/hal/esp32-hal-timer.h: -------------------------------------------------------------------------------- 1 | /* 2 | Arduino.h - Main include file for the Arduino SDK 3 | Copyright (c) 2005-2013 Arduino Team. All right reserved. 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | #ifndef MAIN_ESP32_HAL_TIMER_H_ 21 | #define MAIN_ESP32_HAL_TIMER_H_ 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif 26 | 27 | #include "esp32-hal.h" 28 | #include "freertos/FreeRTOS.h" 29 | 30 | struct hw_timer_s; 31 | typedef struct hw_timer_s hw_timer_t; 32 | 33 | hw_timer_t * timerBegin(uint8_t timer, uint16_t divider, bool countUp); 34 | void timerEnd(hw_timer_t *timer); 35 | 36 | void timerSetConfig(hw_timer_t *timer, uint32_t config); 37 | uint32_t timerGetConfig(hw_timer_t *timer); 38 | 39 | void timerAttachInterrupt(hw_timer_t *timer, void (*fn)(void), bool edge); 40 | void timerDetachInterrupt(hw_timer_t *timer); 41 | 42 | void timerStart(hw_timer_t *timer); 43 | void timerStop(hw_timer_t *timer); 44 | void timerRestart(hw_timer_t *timer); 45 | void timerWrite(hw_timer_t *timer, uint64_t val); 46 | void timerSetDivider(hw_timer_t *timer, uint16_t divider); 47 | void timerSetCountUp(hw_timer_t *timer, bool countUp); 48 | void timerSetAutoReload(hw_timer_t *timer, bool autoreload); 49 | 50 | bool timerStarted(hw_timer_t *timer); 51 | uint64_t timerRead(hw_timer_t *timer); 52 | uint64_t timerReadMicros(hw_timer_t *timer); 53 | double timerReadSeconds(hw_timer_t *timer); 54 | uint16_t timerGetDivider(hw_timer_t *timer); 55 | bool timerGetCountUp(hw_timer_t *timer); 56 | bool timerGetAutoReload(hw_timer_t *timer); 57 | 58 | void timerAlarmEnable(hw_timer_t *timer); 59 | void timerAlarmDisable(hw_timer_t *timer); 60 | void timerAlarmWrite(hw_timer_t *timer, uint64_t interruptAt, bool autoreload); 61 | 62 | bool timerAlarmEnabled(hw_timer_t *timer); 63 | uint64_t timerAlarmRead(hw_timer_t *timer); 64 | uint64_t timerAlarmReadMicros(hw_timer_t *timer); 65 | double timerAlarmReadSeconds(hw_timer_t *timer); 66 | 67 | 68 | #ifdef __cplusplus 69 | } 70 | #endif 71 | 72 | #endif /* MAIN_ESP32_HAL_TIMER_H_ */ 73 | -------------------------------------------------------------------------------- /sign/components/FastLED-idf/hal/esp32-hal.h: -------------------------------------------------------------------------------- 1 | /* 2 | Arduino.h - Main include file for the Arduino SDK 3 | Copyright (c) 2005-2013 Arduino Team. All right reserved. 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | #ifndef HAL_ESP32_HAL_H_ 21 | #define HAL_ESP32_HAL_H_ 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif 26 | 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include "sdkconfig.h" 36 | #include "esp_system.h" 37 | 38 | #ifndef F_CPU 39 | #define F_CPU (CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ * 1000000U) 40 | #endif 41 | 42 | //forward declaration from freertos/portmacro.h 43 | void vPortYield(void); 44 | void yield(void); 45 | #define optimistic_yield(u) 46 | 47 | #define ESP_REG(addr) *((volatile uint32_t *)(addr)) 48 | #define NOP() asm volatile ("nop") 49 | 50 | // BB: see how many we can remove 51 | 52 | #include "esp32-hal-log.h" 53 | // #include "esp32-hal-matrix.h" 54 | // #include "esp32-hal-uart.h" 55 | #include "esp32-hal-gpio.h" 56 | // #include "esp32-hal-touch.h" 57 | // #include "esp32-hal-dac.h" 58 | // #include "esp32-hal-adc.h" 59 | #include "esp32-hal-spi.h" 60 | #include "esp32-hal-i2c.h" 61 | // #include "esp32-hal-ledc.h" 62 | #include "esp32-hal-rmt.h" 63 | // #include "esp32-hal-sigmadelta.h" 64 | // #include "esp32-hal-timer.h" 65 | // #include "esp32-hal-bt.h" 66 | // #include "esp32-hal-psram.h" 67 | #include "esp32-hal-cpu.h" 68 | 69 | #ifndef BOARD_HAS_PSRAM 70 | #ifdef CONFIG_SPIRAM_SUPPORT 71 | #undef CONFIG_SPIRAM_SUPPORT 72 | #endif 73 | #endif 74 | 75 | // BB a few key functions from esp32-hal-misc, which are defined 76 | // bar Arduino and thus therea re no headers for here 77 | // 78 | unsigned long micros(void); 79 | unsigned long millis(void); 80 | 81 | //returns chip temperature in Celsius 82 | float temperatureRead(void); 83 | 84 | #if CONFIG_AUTOSTART_ARDUINO 85 | //enable/disable WDT for Arduino's setup and loop functions 86 | void enableLoopWDT(void); 87 | void disableLoopWDT(void); 88 | //feed WDT for the loop task 89 | void feedLoopWDT(void); 90 | #endif 91 | 92 | //enable/disable WDT for the IDLE task on Core 0 (SYSTEM) 93 | void enableCore0WDT(); 94 | void disableCore0WDT(); 95 | #ifndef CONFIG_FREERTOS_UNICORE 96 | //enable/disable WDT for the IDLE task on Core 1 (Arduino) 97 | void enableCore1WDT(); 98 | void disableCore1WDT(); 99 | #endif 100 | 101 | //if xCoreID < 0 or CPU is unicore, it will use xTaskCreate, else xTaskCreatePinnedToCore 102 | //allows to easily handle all possible situations without repetitive code 103 | BaseType_t xTaskCreateUniversal( TaskFunction_t pxTaskCode, 104 | const char * const pcName, 105 | const uint32_t usStackDepth, 106 | void * const pvParameters, 107 | UBaseType_t uxPriority, 108 | TaskHandle_t * const pxCreatedTask, 109 | const BaseType_t xCoreID ); 110 | 111 | unsigned long micros(); 112 | unsigned long millis(); 113 | void delay(uint32_t); 114 | void delayMicroseconds(uint32_t us); 115 | 116 | #if !CONFIG_ESP32_PHY_AUTO_INIT 117 | void arduino_phy_init(); 118 | #endif 119 | 120 | #if !CONFIG_AUTOSTART_ARDUINO 121 | void initArduino(); 122 | #endif 123 | 124 | #ifdef __cplusplus 125 | } 126 | #endif 127 | 128 | #endif /* HAL_ESP32_HAL_H_ */ 129 | -------------------------------------------------------------------------------- /sign/components/FastLED-idf/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 | -------------------------------------------------------------------------------- /sign/components/FastLED-idf/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(NRF52_SERIES) 11 | #include "platforms/arm/nrf52/led_sysdefs_arm_nrf52.h" 12 | #elif defined(__MK20DX128__) || defined(__MK20DX256__) 13 | // Include k20/T3 headers 14 | #include "platforms/arm/k20/led_sysdefs_arm_k20.h" 15 | #elif defined(__MK66FX1M0__) || defined(__MK64FX512__) 16 | // Include k66/T3.6 headers 17 | #include "platforms/arm/k66/led_sysdefs_arm_k66.h" 18 | #elif defined(__MKL26Z64__) 19 | // Include kl26/T-LC headers 20 | #include "platforms/arm/kl26/led_sysdefs_arm_kl26.h" 21 | #elif defined(__IMXRT1062__) 22 | // teensy4 23 | #include "platforms/arm/mxrt1062/led_sysdefs_arm_mxrt1062.h" 24 | #elif defined(__SAM3X8E__) 25 | // Include sam/due headers 26 | #include "platforms/arm/sam/led_sysdefs_arm_sam.h" 27 | #elif defined(STM32F10X_MD) || defined(__STM32F1__) 28 | #include "platforms/arm/stm32/led_sysdefs_arm_stm32.h" 29 | #elif defined(__SAMD21G18A__) || defined(__SAMD21J18A__) || defined(__SAMD21E17A__) || defined(__SAMD21E18A__) || defined(__SAMD51G19A__) || defined(__SAMD51J19A__) 30 | #include "platforms/arm/d21/led_sysdefs_arm_d21.h" 31 | #elif defined(ESP8266) 32 | #include "platforms/esp/8266/led_sysdefs_esp8266.h" 33 | #elif defined(ESP32) 34 | #include "platforms/esp/32/led_sysdefs_esp32.h" 35 | #elif defined(__AVR__) 36 | // AVR platforms 37 | #include "platforms/avr/led_sysdefs_avr.h" 38 | #else 39 | // 40 | // We got here because we don't recognize the platform that you're 41 | // trying to compile for: it's not AVR, or an ESP or ARM that we recognize. 42 | // 43 | // If you're reading this because you got the error below, 44 | // and if this new platform is just a minor variant of an 45 | // existing supported ARM platform, you may be able to add 46 | // a new 'defined(XXX)' selector in the apporpriate code above. 47 | // 48 | // If this platform is a new microcontroller, see "PORTING.md". 49 | // 50 | #error "This platform isn't recognized by FastLED... yet. See comments in FastLED/led_sysdefs.h for options." 51 | #endif 52 | 53 | #ifndef FASTLED_NAMESPACE_BEGIN 54 | #define FASTLED_NAMESPACE_BEGIN 55 | #define FASTLED_NAMESPACE_END 56 | #define FASTLED_USING_NAMESPACE 57 | #endif 58 | 59 | // Arduino.h needed for convenience functions digitalPinToPort/BitMask/portOutputRegister and the pinMode methods. 60 | #ifdef ARDUINO 61 | #include 62 | #endif 63 | 64 | // F_CPU is almost certainly not defined BB 65 | //#define CLKS_PER_US (F_CPU/1000000) 66 | 67 | #endif 68 | -------------------------------------------------------------------------------- /sign/components/FastLED-idf/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 | -------------------------------------------------------------------------------- /sign/components/FastLED-idf/library.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "FastLED", 3 | "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.", 4 | "keywords": "led,noise,rgb,math,fast", 5 | "authors": [ 6 | { 7 | "name": "Daniel Garcia", 8 | "url": "https://github.com/focalintent", 9 | "maintainer": true 10 | }, 11 | { 12 | "name": "Mark Kriegsman", 13 | "url": "https://github.com/kriegsman", 14 | "maintainer": true 15 | }, 16 | { 17 | "name": "Sam Guyer", 18 | "url": "https://github.com/samguyer", 19 | "maintainer": true 20 | }, 21 | { 22 | "name": "Jason Coon", 23 | "url": "https://github.com/jasoncoon", 24 | "maintainer": true 25 | }, 26 | { 27 | "name": "Josh Huber", 28 | "url": "https://github.com/uberjay", 29 | "maintainer": true 30 | } 31 | ], 32 | "repository": { 33 | "type": "git", 34 | "url": "https://github.com/FastLED/FastLED.git" 35 | }, 36 | "version": "3.3.3", 37 | "license": "MIT", 38 | "homepage": "http://fastled.io", 39 | "frameworks": "arduino", 40 | "platforms": "atmelavr, atmelsam, freescalekinetis, nordicnrf51, nxplpc, ststm32, teensy, espressif8266, espressif32, nordicnrf52", 41 | "export": { 42 | "exclude": [ 43 | "docs", 44 | "extras" 45 | ] 46 | }, 47 | "build": { 48 | "srcFilter": [ 49 | "+<*.c>", 50 | "+<*.cpp>", 51 | "+<*.h>" 52 | ], 53 | "libArchive": false 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /sign/components/FastLED-idf/library.properties: -------------------------------------------------------------------------------- 1 | name=FastLED 2 | version=3.3.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 | includes=FastLED.h 11 | -------------------------------------------------------------------------------- /sign/components/FastLED-idf/platforms.cpp: -------------------------------------------------------------------------------- 1 | #define FASTLED_INTERNAL 2 | 3 | 4 | // Interrupt handlers cannot be defined in the header. 5 | // They must be defined as C functions, or they won't 6 | // be found (due to name mangling), and thus won't 7 | // override any default weak definition. 8 | #if defined(NRF52_SERIES) 9 | 10 | #include "platforms/arm/nrf52/led_sysdefs_arm_nrf52.h" 11 | #include "platforms/arm/nrf52/arbiter_nrf52.h" 12 | 13 | uint32_t isrCount; 14 | 15 | #ifdef __cplusplus 16 | extern "C" { 17 | #endif 18 | // NOTE: Update platforms.cpp in root of FastLED library if this changes 19 | #if defined(FASTLED_NRF52_ENABLE_PWM_INSTANCE0) 20 | void PWM0_IRQHandler(void) { isrCount++; PWM_Arbiter<0>::isr_handler(); } 21 | #endif 22 | #if defined(FASTLED_NRF52_ENABLE_PWM_INSTANCE1) 23 | void PWM1_IRQHandler(void) { isrCount++; PWM_Arbiter<1>::isr_handler(); } 24 | #endif 25 | #if defined(FASTLED_NRF52_ENABLE_PWM_INSTANCE2) 26 | void PWM2_IRQHandler(void) { isrCount++; PWM_Arbiter<2>::isr_handler(); } 27 | #endif 28 | #if defined(FASTLED_NRF52_ENABLE_PWM_INSTANCE3) 29 | void PWM3_IRQHandler(void) { isrCount++; PWM_Arbiter<3>::isr_handler(); } 30 | #endif 31 | #ifdef __cplusplus 32 | } 33 | #endif 34 | 35 | #endif // defined(NRF52_SERIES) 36 | 37 | 38 | 39 | // FASTLED_NAMESPACE_BEGIN 40 | // FASTLED_NAMESPACE_END 41 | -------------------------------------------------------------------------------- /sign/components/FastLED-idf/platforms.h: -------------------------------------------------------------------------------- 1 | #ifndef __INC_PLATFORMS_H 2 | #define __INC_PLATFORMS_H 3 | 4 | #define ESP32 5 | 6 | #include "FastLED.h" 7 | 8 | #include "fastled_config.h" 9 | 10 | #if defined(NRF51) 11 | #include "platforms/arm/nrf51/fastled_arm_nrf51.h" 12 | #elif defined(NRF52_SERIES) 13 | #include "platforms/arm/nrf52/fastled_arm_nrf52.h" 14 | #elif defined(__MK20DX128__) || defined(__MK20DX256__) 15 | // Include k20/T3 headers 16 | #include "platforms/arm/k20/fastled_arm_k20.h" 17 | #elif defined(__MK66FX1M0__) || defined(__MK64FX512__) 18 | // Include k66/T3.6 headers 19 | #include "platforms/arm/k66/fastled_arm_k66.h" 20 | #elif defined(__MKL26Z64__) 21 | // Include kl26/T-LC headers 22 | #include "platforms/arm/kl26/fastled_arm_kl26.h" 23 | #elif defined(__IMXRT1062__) 24 | // teensy4 25 | #include "platforms/arm/mxrt1062/fastled_arm_mxrt1062.h" 26 | #elif defined(__SAM3X8E__) 27 | // Include sam/due headers 28 | #include "platforms/arm/sam/fastled_arm_sam.h" 29 | #elif defined(STM32F10X_MD) || defined(__STM32F1__) 30 | #include "platforms/arm/stm32/fastled_arm_stm32.h" 31 | #elif defined(__SAMD21G18A__) || defined(__SAMD21J18A__) || defined(__SAMD21E17A__) || defined(__SAMD21E18A__) 32 | #include "platforms/arm/d21/fastled_arm_d21.h" 33 | #elif defined(__SAMD51G19A__) || defined(__SAMD51J19A__) 34 | #include "platforms/arm/d51/fastled_arm_d51.h" 35 | #elif defined(ESP8266) 36 | #include "platforms/esp/8266/fastled_esp8266.h" 37 | #elif defined(ESP32) 38 | #include "platforms/esp/32/fastled_esp32.h" 39 | #else 40 | // AVR platforms 41 | #include "platforms/avr/fastled_avr.h" 42 | #endif 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /sign/components/FastLED-idf/platforms/esp/32/fastled_esp32.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "fastpin_esp32.h" 4 | 5 | #ifdef FASTLED_ESP32_I2S 6 | #include "clockless_i2s_esp32.h" 7 | #else 8 | #include "clockless_rmt_esp32.h" 9 | #endif 10 | 11 | // #include "clockless_block_esp32.h" 12 | -------------------------------------------------------------------------------- /sign/components/FastLED-idf/platforms/esp/32/fastpin_esp32.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // In order to get the GPIO structure, we need 4 | // enough of the headers. 5 | #include 6 | #include "esp_err.h" 7 | #include "freertos/FreeRTOS.h" 8 | #include "freertos/xtensa_api.h" 9 | #include "driver/gpio.h" 10 | #include "soc/gpio_periph.h" 11 | 12 | FASTLED_NAMESPACE_BEGIN 13 | 14 | template class _ESPPIN { 15 | 16 | public: 17 | typedef volatile uint32_t * port_ptr_t; 18 | typedef uint32_t port_t; 19 | 20 | // BB 21 | // It could be better to to the following, then not have to pull in as 22 | // much of the hal: 23 | // inline static void setOutput() { gpio_set_direction(PIN, GPIO_MODE_OUTPUT); } 24 | // inline static void setInput() { gpio_set_direction(PIN, GPIO_MODE_INPUT); } 25 | 26 | 27 | inline static void setOutput() { pinMode(PIN, OUTPUT); } 28 | inline static void setInput() { pinMode(PIN, INPUT); } 29 | 30 | inline static void hi() __attribute__ ((always_inline)) { 31 | if (PIN < 32) GPIO.out_w1ts = MASK; 32 | else GPIO.out1_w1ts.val = MASK; 33 | } 34 | 35 | inline static void lo() __attribute__ ((always_inline)) { 36 | if (PIN < 32) GPIO.out_w1tc = MASK; 37 | else GPIO.out1_w1tc.val = MASK; 38 | } 39 | 40 | inline static void set(register port_t val) __attribute__ ((always_inline)) { 41 | if (PIN < 32) GPIO.out = val; 42 | else GPIO.out1.val = val; 43 | } 44 | 45 | inline static void strobe() __attribute__ ((always_inline)) { toggle(); toggle(); } 46 | 47 | inline static void toggle() __attribute__ ((always_inline)) { 48 | if(PIN < 32) { GPIO.out ^= MASK; } 49 | else { GPIO.out1.val ^=MASK; } 50 | } 51 | 52 | inline static void hi(register port_ptr_t port) __attribute__ ((always_inline)) { hi(); } 53 | inline static void lo(register port_ptr_t port) __attribute__ ((always_inline)) { lo(); } 54 | inline static void fastset(register port_ptr_t port, register port_t val) __attribute__ ((always_inline)) { *port = val; } 55 | 56 | inline static port_t hival() __attribute__ ((always_inline)) { 57 | if (PIN < 32) return GPIO.out | MASK; 58 | else return GPIO.out1.val | MASK; 59 | } 60 | 61 | inline static port_t loval() __attribute__ ((always_inline)) { 62 | if (PIN < 32) return GPIO.out & ~MASK; 63 | else return GPIO.out1.val & ~MASK; 64 | } 65 | 66 | inline static port_ptr_t port() __attribute__ ((always_inline)) { 67 | if (PIN < 32) return &GPIO.out; 68 | else return &GPIO.out1.val; 69 | } 70 | 71 | inline static port_ptr_t sport() __attribute__ ((always_inline)) { 72 | if (PIN < 32) return &GPIO.out_w1ts; 73 | else return &GPIO.out1_w1ts.val; 74 | } 75 | 76 | inline static port_ptr_t cport() __attribute__ ((always_inline)) { 77 | if (PIN < 32) return &GPIO.out_w1tc; 78 | else return &GPIO.out1_w1tc.val; 79 | } 80 | 81 | inline static port_t mask() __attribute__ ((always_inline)) { return MASK; } 82 | 83 | inline static bool isset() __attribute__ ((always_inline)) { 84 | if (PIN < 32) return GPIO.out & MASK; 85 | else return GPIO.out1.val & MASK; 86 | } 87 | }; 88 | 89 | #define _FL_DEFPIN(PIN) template<> class FastPin : public _ESPPIN {}; 90 | 91 | _FL_DEFPIN(0); 92 | _FL_DEFPIN(1); // WARNING: Using TX causes flashiness when uploading 93 | _FL_DEFPIN(2); 94 | _FL_DEFPIN(3); // WARNING: Using RX causes flashiness when uploading 95 | _FL_DEFPIN(4); 96 | _FL_DEFPIN(5); 97 | 98 | // -- These pins are not safe to use: 99 | // _FL_DEFPIN(6,6); _FL_DEFPIN(7,7); _FL_DEFPIN(8,8); 100 | // _FL_DEFPIN(9,9); _FL_DEFPIN(10,10); _FL_DEFPIN(11,11); 101 | 102 | _FL_DEFPIN(12); 103 | _FL_DEFPIN(13); 104 | _FL_DEFPIN(14); 105 | _FL_DEFPIN(15); 106 | _FL_DEFPIN(16); 107 | _FL_DEFPIN(17); 108 | _FL_DEFPIN(18); 109 | _FL_DEFPIN(19); 110 | 111 | // No pin 20 : _FL_DEFPIN(20,20); 112 | 113 | _FL_DEFPIN(21); // Works, but note that GPIO21 is I2C SDA 114 | _FL_DEFPIN(22); // Works, but note that GPIO22 is I2C SCL 115 | _FL_DEFPIN(23); 116 | 117 | // No pin 24 : _FL_DEFPIN(24,24); 118 | 119 | _FL_DEFPIN(25); 120 | _FL_DEFPIN(26); 121 | _FL_DEFPIN(27); 122 | 123 | // No pin 28-31: _FL_DEFPIN(28,28); _FL_DEFPIN(29,29); _FL_DEFPIN(30,30); _FL_DEFPIN(31,31); 124 | 125 | // Need special handling for pins > 31 126 | _FL_DEFPIN(32); 127 | _FL_DEFPIN(33); 128 | 129 | #define HAS_HARDWARE_PIN_SUPPORT 130 | 131 | FASTLED_NAMESPACE_END 132 | -------------------------------------------------------------------------------- /sign/components/FastLED-idf/platforms/esp/32/led_sysdefs_esp32.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef ESP32 4 | #define ESP32 5 | #endif 6 | 7 | #define FASTLED_ESP32 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 unsigned long prog_uint32_t; 15 | 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 | // BB - I think I'm compiling in CXX in this project 28 | // #define NEED_CXX_BITS 29 | 30 | // These can be overridden 31 | # define FASTLED_ESP32_RAW_PIN_ORDER 32 | 33 | // #define cli() os_intr_lock(); 34 | // #define sei() os_intr_lock(); 35 | -------------------------------------------------------------------------------- /sign/components/FastLED-idf/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 | /// @deprecated - use FastLED.setMaxPowerInMilliWatts 25 | void set_max_power_in_milliwatts( uint32_t powerInmW); 26 | 27 | /// Select a pin with an led that will be flashed to indicate that power management 28 | /// is pulling down the brightness 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 | -------------------------------------------------------------------------------- /sign/main/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | idf_component_register(SRCS "main.cpp" 2 | INCLUDE_DIRS ".") 3 | -------------------------------------------------------------------------------- /sign/main/component.mk: -------------------------------------------------------------------------------- 1 | # 2 | # "main" pseudo-component makefile. 3 | # 4 | # (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.) 5 | -------------------------------------------------------------------------------- /sign/main/palettes.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "FastLED.h" 4 | 5 | // This function fills the palette with totally random colors. 6 | void SetupTotallyRandomPalette() 7 | { 8 | for( int i = 0; i < 16; i++) { 9 | currentPalette[i] = CHSV( random8(), 255, random8()); 10 | } 11 | } 12 | 13 | // This function sets up a palette of black and white stripes, 14 | // using code. Since the palette is effectively an array of 15 | // sixteen CRGB colors, the various fill_* functions can be used 16 | // to set them up. 17 | void SetupBlackAndWhiteStripedPalette() 18 | { 19 | // 'black out' all 16 palette entries... 20 | fill_solid( currentPalette, 16, CRGB::Black); 21 | // and set every fourth one to white. 22 | currentPalette[0] = CRGB::White; 23 | currentPalette[4] = CRGB::White; 24 | currentPalette[8] = CRGB::White; 25 | currentPalette[12] = CRGB::White; 26 | 27 | } 28 | 29 | // This function sets up a palette of purple and green stripes. 30 | void SetupPurpleAndGreenPalette() 31 | { 32 | CRGB purple = CHSV( HUE_PURPLE, 255, 255); 33 | CRGB green = CHSV( HUE_GREEN, 255, 255); 34 | CRGB black = CRGB::Black; 35 | 36 | currentPalette = CRGBPalette16( 37 | green, green, black, black, 38 | purple, purple, black, black, 39 | green, green, black, black, 40 | purple, purple, black, black ); 41 | } 42 | 43 | 44 | // This example shows how to set up a static color palette 45 | // which is stored in PROGMEM (flash), which is almost always more 46 | // plentiful than RAM. A static PROGMEM palette like this 47 | // takes up 64 bytes of flash. 48 | const TProgmemPalette16 myRedWhiteBluePalette_p = 49 | { 50 | CRGB::Red, 51 | CRGB::Gray, // 'white' is too bright compared to red and blue 52 | CRGB::Blue, 53 | CRGB::Black, 54 | 55 | CRGB::Red, 56 | CRGB::Gray, 57 | CRGB::Blue, 58 | CRGB::Black, 59 | 60 | CRGB::Red, 61 | CRGB::Red, 62 | CRGB::Gray, 63 | CRGB::Gray, 64 | CRGB::Blue, 65 | CRGB::Blue, 66 | CRGB::Black, 67 | CRGB::Black 68 | }; 69 | 70 | -------------------------------------------------------------------------------- /sign/sdkconfig.defaults: -------------------------------------------------------------------------------- 1 | # 2 | 3 | -------------------------------------------------------------------------------- /wifi_station/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # The following five lines of boilerplate have to be in your project's 2 | # CMakeLists in this exact order for cmake to work correctly 3 | cmake_minimum_required(VERSION 3.5) 4 | 5 | include($ENV{IDF_PATH}/tools/cmake/project.cmake) 6 | project(wifi_station) 7 | -------------------------------------------------------------------------------- /wifi_station/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # This is a project Makefile. It is assumed the directory this Makefile resides in is a 3 | # project subdirectory. 4 | # 5 | 6 | PROJECT_NAME := wifi_station 7 | 8 | include $(IDF_PATH)/make/project.mk 9 | 10 | -------------------------------------------------------------------------------- /wifi_station/README.md: -------------------------------------------------------------------------------- 1 | # WiFi station example 2 | 3 | (See the README.md file in the upper level 'examples' directory for more information about examples.) 4 | 5 | 6 | ## How to use example 7 | 8 | ### Configure the project 9 | 10 | ``` 11 | idf.py menuconfig 12 | ``` 13 | 14 | * Set serial port under Serial Flasher Options. 15 | 16 | * Set WiFi SSID and WiFi Password and Maximum retry under Example Configuration Options. 17 | 18 | ### Build and Flash 19 | 20 | Build the project and flash it to the board, then run monitor tool to view serial output: 21 | 22 | ``` 23 | idf.py -p PORT flash monitor 24 | ``` 25 | 26 | (To exit the serial monitor, type ``Ctrl-]``.) 27 | 28 | See the Getting Started Guide for full steps to configure and use ESP-IDF to build projects. 29 | 30 | ## Example Output 31 | 32 | There is the console output for station connects to ap successfully: 33 | ``` 34 | I (727) wifi station: ESP_WIFI_MODE_STA 35 | I (727) wifi: wifi driver task: 3ffc0c68, prio:23, stack:3584, core=0 36 | I (727) wifi: wifi firmware version: 19b3110 37 | I (727) wifi: config NVS flash: enabled 38 | I (727) wifi: config nano formating: disabled 39 | I (737) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE 40 | I (747) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE 41 | I (777) wifi: Init dynamic tx buffer num: 32 42 | I (777) wifi: Init data frame dynamic rx buffer num: 32 43 | I (777) wifi: Init management frame dynamic rx buffer num: 32 44 | I (777) wifi: Init static rx buffer size: 1600 45 | I (787) wifi: Init static rx buffer num: 10 46 | I (787) wifi: Init dynamic rx buffer num: 32 47 | I (907) phy: phy_version: 3960, 5211945, Jul 18 2018, 10:40:07, 0, 0 48 | I (907) wifi: mode : sta (30:ae:a4:80:45:68) 49 | I (907) wifi station: wifi_init_sta finished. 50 | I (907) wifi station: connect to ap SSID:myssid password:mypassword 51 | I (1027) wifi: n:6 0, o:1 0, ap:255 255, sta:6 0, prof:1 52 | I (2017) wifi: state: init -> auth (b0) 53 | I (2017) wifi: state: auth -> assoc (0) 54 | I (2027) wifi: state: assoc -> run (10) 55 | I (2067) wifi: connected with myssid, channel 6 56 | I (2067) wifi: pm start, type: 1 57 | 58 | I (3227) event: sta ip: 172.20.10.7, mask: 255.255.255.240, gw: 172.20.10.1 59 | I (3227) wifi station: got ip:172.20.10.7 60 | ``` 61 | 62 | There is the console output for station connects to ap failed: 63 | ``` 64 | I (728) wifi station: ESP_WIFI_MODE_STA 65 | I (728) wifi: wifi driver task: 3ffc0c68, prio:23, stack:3584, core=0 66 | I (728) wifi: wifi firmware version: 19b3110 67 | I (728) wifi: config NVS flash: enabled 68 | I (738) wifi: config nano formating: disabled 69 | I (738) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE 70 | I (748) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE 71 | I (778) wifi: Init dynamic tx buffer num: 32 72 | I (778) wifi: Init data frame dynamic rx buffer num: 32 73 | I (778) wifi: Init management frame dynamic rx buffer num: 32 74 | I (788) wifi: Init static rx buffer size: 1600 75 | I (788) wifi: Init static rx buffer num: 10 76 | I (788) wifi: Init dynamic rx buffer num: 32 77 | I (908) phy: phy_version: 3960, 5211945, Jul 18 2018, 10:40:07, 0, 0 78 | I (908) wifi: mode : sta (30:ae:a4:80:45:68) 79 | I (908) wifi station: wifi_init_sta finished. 80 | I (918) wifi station: connect to ap SSID:myssid password:mypassword 81 | I (3328) wifi station: retry to connect to the AP 82 | I (3328) wifi station: connect to the AP fail 83 | 84 | I (5738) wifi station: retry to connect to the AP 85 | I (5738) wifi station: connect to the AP fail 86 | 87 | I (8148) wifi station: retry to connect to the AP 88 | I (8148) wifi station: connect to the AP fail 89 | 90 | I (10558) wifi station: retry to connect to the AP 91 | I (10558) wifi station: connect to the AP fail 92 | 93 | I (12968) wifi station: retry to connect to the AP 94 | I (12968) wifi station: connect to the AP fail 95 | 96 | I (15378) wifi station: connect to the AP fail 97 | ``` 98 | -------------------------------------------------------------------------------- /wifi_station/main/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | idf_component_register(SRCS "wifi_station_main.c" 2 | INCLUDE_DIRS ".") -------------------------------------------------------------------------------- /wifi_station/main/Kconfig.projbuild: -------------------------------------------------------------------------------- 1 | menu "Example Configuration" 2 | 3 | config ESP_WIFI_SSID 4 | string "WiFi SSID" 5 | default "myssid" 6 | help 7 | SSID (network name) for the example to connect to. 8 | 9 | config ESP_WIFI_PASSWORD 10 | string "WiFi Password" 11 | default "mypassword" 12 | help 13 | WiFi password (WPA or WPA2) for the example to use. 14 | 15 | config ESP_MAXIMUM_RETRY 16 | int "Maximum retry" 17 | default 5 18 | help 19 | Set the Maximum retry to avoid station reconnecting to the AP unlimited when the AP is really inexistent. 20 | endmenu 21 | -------------------------------------------------------------------------------- /wifi_station/main/component.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Main component makefile. 3 | # 4 | # This Makefile can be left empty. By default, it will take the sources in the 5 | # src/ directory, compile them and link them into lib(subdirectory_name).a 6 | # in the build directory. This behaviour is entirely configurable, 7 | # please read the ESP-IDF documents if you need to do this. 8 | # 9 | --------------------------------------------------------------------------------