denko 0.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.github/workflows/build_avr.yml +61 -0
- data/.github/workflows/build_esp32.yml +58 -0
- data/.github/workflows/build_esp8266.yml +57 -0
- data/.github/workflows/build_megaavr.yml +61 -0
- data/.github/workflows/build_rp2040.yml +61 -0
- data/.github/workflows/build_sam3x.yml +59 -0
- data/.github/workflows/build_samd.yml +61 -0
- data/.github/workflows/ruby.yml +47 -0
- data/.gitignore +24 -0
- data/.gitmodules +3 -0
- data/.vscode/settings.json +5 -0
- data/.vscode/tasks.json +20 -0
- data/CHANGELOG.md +466 -0
- data/DEPS_CLI.md +80 -0
- data/DEPS_IDE.md +120 -0
- data/Gemfile +4 -0
- data/HARDWARE.md +195 -0
- data/LICENSE +22 -0
- data/README.md +152 -0
- data/Rakefile +11 -0
- data/bin/denko +22 -0
- data/build +27 -0
- data/denko.gemspec +47 -0
- data/examples/advanced/rotary_encoder_mac_volume.rb +48 -0
- data/examples/advanced/ssd1306_time_temp_rh.rb +48 -0
- data/examples/analog_io/ads1118.rb +74 -0
- data/examples/analog_io/dac_loopback.rb +32 -0
- data/examples/analog_io/input.rb +52 -0
- data/examples/connection/tcp.rb +34 -0
- data/examples/digital_io/rotary_encoder.rb +26 -0
- data/examples/display/hd44780.png +0 -0
- data/examples/display/hd44780.rb +39 -0
- data/examples/display/ssd1306.rb +40 -0
- data/examples/display/ssd1306_s2_pico.rb +29 -0
- data/examples/eeprom/built_in.rb +32 -0
- data/examples/i2c/search.rb +53 -0
- data/examples/led/apa102_bounce.rb +33 -0
- data/examples/led/apa102_breathe.rb +45 -0
- data/examples/led/builtin_blink.rb +12 -0
- data/examples/led/seven_segment_char_echo.rb +15 -0
- data/examples/led/ws2812_bounce.rb +32 -0
- data/examples/led/ws2812_builtin_blink.rb +21 -0
- data/examples/motor/l298.rb +43 -0
- data/examples/motor/servo.rb +16 -0
- data/examples/motor/stepper.png +0 -0
- data/examples/motor/stepper.rb +43 -0
- data/examples/pulse_io/buzzer.rb +30 -0
- data/examples/pulse_io/ir_transmitter.rb +55 -0
- data/examples/rtc/ds3231.rb +48 -0
- data/examples/sensor/aht10.rb +15 -0
- data/examples/sensor/aht20.rb +15 -0
- data/examples/sensor/bme280.rb +75 -0
- data/examples/sensor/dht.rb +24 -0
- data/examples/sensor/ds18b20.rb +58 -0
- data/examples/sensor/htu21d.rb +54 -0
- data/examples/sensor/htu31d.rb +31 -0
- data/examples/spi/input_register.rb +50 -0
- data/examples/spi/output_register.rb +49 -0
- data/examples/spi/ssd_through_register.rb +40 -0
- data/examples/spi/two_registers.rb +46 -0
- data/examples/uart/bit_bang_read.rb +16 -0
- data/examples/uart/bit_bang_write.rb +16 -0
- data/examples/uart/board_passthrough.rb +34 -0
- data/examples/uart/hardware_loopback.rb +16 -0
- data/lib/denko/analog_io/ads1118.rb +182 -0
- data/lib/denko/analog_io/input.rb +79 -0
- data/lib/denko/analog_io/output.rb +20 -0
- data/lib/denko/analog_io/potentiometer.rb +15 -0
- data/lib/denko/analog_io/sensor.rb +6 -0
- data/lib/denko/analog_io.rb +9 -0
- data/lib/denko/behaviors/board_proxy.rb +23 -0
- data/lib/denko/behaviors/bus_controller.rb +11 -0
- data/lib/denko/behaviors/bus_controller_addressed.rb +15 -0
- data/lib/denko/behaviors/bus_peripheral.rb +21 -0
- data/lib/denko/behaviors/bus_peripheral_addressed.rb +15 -0
- data/lib/denko/behaviors/callbacks.rb +67 -0
- data/lib/denko/behaviors/component.rb +48 -0
- data/lib/denko/behaviors/input_pin.rb +24 -0
- data/lib/denko/behaviors/listener.rb +22 -0
- data/lib/denko/behaviors/multi_pin.rb +72 -0
- data/lib/denko/behaviors/output_pin.rb +13 -0
- data/lib/denko/behaviors/poller.rb +31 -0
- data/lib/denko/behaviors/reader.rb +49 -0
- data/lib/denko/behaviors/single_pin.rb +26 -0
- data/lib/denko/behaviors/state.rb +24 -0
- data/lib/denko/behaviors/subcomponents.rb +35 -0
- data/lib/denko/behaviors/threaded.rb +54 -0
- data/lib/denko/behaviors.rb +26 -0
- data/lib/denko/board/core.rb +151 -0
- data/lib/denko/board/eeprom.rb +20 -0
- data/lib/denko/board/i2c.rb +68 -0
- data/lib/denko/board/infrared.rb +18 -0
- data/lib/denko/board/led_array.rb +18 -0
- data/lib/denko/board/map.rb +46 -0
- data/lib/denko/board/message_pack.rb +7 -0
- data/lib/denko/board/one_wire.rb +34 -0
- data/lib/denko/board/pulse.rb +26 -0
- data/lib/denko/board/servo.rb +22 -0
- data/lib/denko/board/spi.rb +65 -0
- data/lib/denko/board/spi_bit_bang.rb +41 -0
- data/lib/denko/board/tone.rb +23 -0
- data/lib/denko/board/uart.rb +42 -0
- data/lib/denko/board/uart_bit_bang.rb +33 -0
- data/lib/denko/board.rb +104 -0
- data/lib/denko/connection/base.rb +75 -0
- data/lib/denko/connection/board_uart.rb +36 -0
- data/lib/denko/connection/flow_control.rb +153 -0
- data/lib/denko/connection/handshake.rb +60 -0
- data/lib/denko/connection/serial.rb +90 -0
- data/lib/denko/connection/tcp.rb +44 -0
- data/lib/denko/connection.rb +10 -0
- data/lib/denko/digital_io/button.rb +8 -0
- data/lib/denko/digital_io/input.rb +44 -0
- data/lib/denko/digital_io/output.rb +47 -0
- data/lib/denko/digital_io/relay.rb +6 -0
- data/lib/denko/digital_io/rotary_encoder.rb +107 -0
- data/lib/denko/digital_io.rb +9 -0
- data/lib/denko/display/canvas.rb +282 -0
- data/lib/denko/display/hd44780.rb +266 -0
- data/lib/denko/display/ssd1306.rb +179 -0
- data/lib/denko/display.rb +7 -0
- data/lib/denko/eeprom/built_in.rb +69 -0
- data/lib/denko/eeprom.rb +5 -0
- data/lib/denko/fonts.rb +106 -0
- data/lib/denko/i2c/bus.rb +52 -0
- data/lib/denko/i2c/peripheral.rb +38 -0
- data/lib/denko/i2c.rb +6 -0
- data/lib/denko/led/apa102.rb +87 -0
- data/lib/denko/led/base.rb +12 -0
- data/lib/denko/led/rgb.rb +38 -0
- data/lib/denko/led/seven_segment.rb +111 -0
- data/lib/denko/led/ws2812.rb +48 -0
- data/lib/denko/led.rb +13 -0
- data/lib/denko/message.rb +92 -0
- data/lib/denko/motor/l298.rb +49 -0
- data/lib/denko/motor/servo.rb +51 -0
- data/lib/denko/motor/stepper.rb +71 -0
- data/lib/denko/motor.rb +7 -0
- data/lib/denko/one_wire/bus.rb +61 -0
- data/lib/denko/one_wire/bus_enumeration.rb +88 -0
- data/lib/denko/one_wire/constants.rb +17 -0
- data/lib/denko/one_wire/helper.rb +33 -0
- data/lib/denko/one_wire/peripheral.rb +62 -0
- data/lib/denko/one_wire.rb +9 -0
- data/lib/denko/pulse_io/buzzer.rb +25 -0
- data/lib/denko/pulse_io/ir_transmitter.rb +22 -0
- data/lib/denko/pulse_io/pwm_output.rb +34 -0
- data/lib/denko/pulse_io.rb +7 -0
- data/lib/denko/rtc/ds3231.rb +48 -0
- data/lib/denko/rtc.rb +5 -0
- data/lib/denko/sensor/aht.rb +165 -0
- data/lib/denko/sensor/bme280.rb +366 -0
- data/lib/denko/sensor/dht.rb +43 -0
- data/lib/denko/sensor/ds18b20.rb +74 -0
- data/lib/denko/sensor/htu21d.rb +168 -0
- data/lib/denko/sensor/htu31d.rb +187 -0
- data/lib/denko/sensor/virtual.rb +42 -0
- data/lib/denko/sensor.rb +13 -0
- data/lib/denko/spi/base_register.rb +37 -0
- data/lib/denko/spi/bit_bang.rb +74 -0
- data/lib/denko/spi/bus.rb +44 -0
- data/lib/denko/spi/input_register.rb +130 -0
- data/lib/denko/spi/output_register.rb +67 -0
- data/lib/denko/spi/peripheral.rb +43 -0
- data/lib/denko/spi.rb +10 -0
- data/lib/denko/uart/bit_bang.rb +69 -0
- data/lib/denko/uart/hardware.rb +65 -0
- data/lib/denko/uart.rb +6 -0
- data/lib/denko/version.rb +3 -0
- data/lib/denko.rb +39 -0
- data/lib/denko_cli/generator.rb +171 -0
- data/lib/denko_cli/helper.rb +29 -0
- data/lib/denko_cli/missing_files.txt +20 -0
- data/lib/denko_cli/packages.rb +101 -0
- data/lib/denko_cli/parser.rb +73 -0
- data/lib/denko_cli/targets.rb +30 -0
- data/lib/denko_cli/targets.txt +113 -0
- data/lib/denko_cli/usage.txt +34 -0
- data/lib/denko_cli.rb +18 -0
- data/src/denko_ethernet.ino +78 -0
- data/src/denko_serial.ino +41 -0
- data/src/denko_wifi.ino +157 -0
- data/src/lib/Denko.cpp +330 -0
- data/src/lib/Denko.h +259 -0
- data/src/lib/DenkoCoreIO.cpp +322 -0
- data/src/lib/DenkoDefines.h +116 -0
- data/src/lib/DenkoEEPROM.cpp +64 -0
- data/src/lib/DenkoI2C.cpp +155 -0
- data/src/lib/DenkoIROut.cpp +33 -0
- data/src/lib/DenkoIROutESP.cpp +26 -0
- data/src/lib/DenkoLEDArray.cpp +49 -0
- data/src/lib/DenkoOneWire.cpp +156 -0
- data/src/lib/DenkoPulseInput.cpp +57 -0
- data/src/lib/DenkoSPI.cpp +165 -0
- data/src/lib/DenkoSPIBB.cpp +156 -0
- data/src/lib/DenkoServo.cpp +83 -0
- data/src/lib/DenkoTone.cpp +25 -0
- data/src/lib/DenkoUART.cpp +118 -0
- data/src/lib/DenkoUARTBB.cpp +62 -0
- data/target.yml +3 -0
- data/test/analog_io/input_test.rb +38 -0
- data/test/analog_io/output_test.rb +26 -0
- data/test/analog_io/potentiometer_test.rb +62 -0
- data/test/behaviors/board_proxy_test.rb +24 -0
- data/test/behaviors/bus_controller_addressed_test.rb +40 -0
- data/test/behaviors/bus_controller_test.rb +28 -0
- data/test/behaviors/bus_peripheral_addressed.rb +44 -0
- data/test/behaviors/bus_peripheral_test.rb +39 -0
- data/test/behaviors/callbacks_test.rb +118 -0
- data/test/behaviors/component_test.rb +56 -0
- data/test/behaviors/input_pin_test.rb +42 -0
- data/test/behaviors/listener_test.rb +60 -0
- data/test/behaviors/multi_pin_test.rb +70 -0
- data/test/behaviors/output_pin_test.rb +27 -0
- data/test/behaviors/poller_test.rb +64 -0
- data/test/behaviors/reader_test.rb +68 -0
- data/test/behaviors/single_pin_test.rb +41 -0
- data/test/behaviors/subcomponents_test.rb +75 -0
- data/test/behaviors/threaded_test.rb +98 -0
- data/test/board/board_test.rb +130 -0
- data/test/board/core_test.rb +182 -0
- data/test/board/eeprom_test.rb +34 -0
- data/test/board/helper_test.rb +38 -0
- data/test/board/i2c_test.rb +114 -0
- data/test/board/infrared_test.rb +37 -0
- data/test/board/message_test.rb +54 -0
- data/test/board/one_wire_test.rb +69 -0
- data/test/board/pulse_test.rb +51 -0
- data/test/board/servo_test.rb +47 -0
- data/test/board/spi_test.rb +97 -0
- data/test/board/tone_test.rb +42 -0
- data/test/connection/serial_test.rb +172 -0
- data/test/connection/tcp_test.rb +37 -0
- data/test/digital_io/input_test.rb +65 -0
- data/test/digital_io/output_test.rb +64 -0
- data/test/digital_io/rotary_encoder_test.rb +99 -0
- data/test/display/hd44780_test.rb +23 -0
- data/test/eeprom/built_in_test.rb +61 -0
- data/test/i2c/bus_test.rb +66 -0
- data/test/i2c/peripheral_test.rb +50 -0
- data/test/led/base_test.rb +24 -0
- data/test/led/rgb_test.rb +64 -0
- data/test/led/seven_segment_test.rb +86 -0
- data/test/motor/servo_test.rb +62 -0
- data/test/motor/stepper_test.rb +51 -0
- data/test/one_wire/bus_enumerator_test.rb +134 -0
- data/test/one_wire/bus_test.rb +142 -0
- data/test/one_wire/helper_test.rb +18 -0
- data/test/one_wire/peripheral_test.rb +158 -0
- data/test/pulse_io/buzzer_test.rb +48 -0
- data/test/pulse_io/ir_transmitter_test.rb +38 -0
- data/test/pulse_io/pwm_output_test.rb +72 -0
- data/test/rtc/ds3231_test.rb +55 -0
- data/test/sensor/dht_test.rb +64 -0
- data/test/sensor/ds18b20_test.rb +107 -0
- data/test/spi/base_register_test.rb +34 -0
- data/test/spi/bus_test.rb +76 -0
- data/test/spi/input_register_test.rb +140 -0
- data/test/spi/output_register_test.rb +93 -0
- data/test/test_helper.rb +223 -0
- data/test/uart/bitbang_test.rb +37 -0
- data/tutorial/01-led/led.fzz +0 -0
- data/tutorial/01-led/led.pdf +0 -0
- data/tutorial/01-led/led.rb +73 -0
- data/tutorial/02-button/button.fzz +0 -0
- data/tutorial/02-button/button.pdf +0 -0
- data/tutorial/02-button/button.rb +64 -0
- data/tutorial/03-potentiometer/potentiometer.fzz +0 -0
- data/tutorial/03-potentiometer/potentiometer.pdf +0 -0
- data/tutorial/03-potentiometer/potentiometer.rb +62 -0
- data/tutorial/04-pwm_led/pwm_led.fzz +0 -0
- data/tutorial/04-pwm_led/pwm_led.pdf +0 -0
- data/tutorial/04-pwm_led/pwm_led.rb +66 -0
- data/tutorial/05-rgb_led/rgb_led.fzz +0 -0
- data/tutorial/05-rgb_led/rgb_led.pdf +0 -0
- data/tutorial/05-rgb_led/rgb_led.rb +58 -0
- data/tutorial/05-rgb_led/rgb_mapping.rb +76 -0
- data/vendor/board-maps/.gitignore +56 -0
- data/vendor/board-maps/.gitmodules +21 -0
- data/vendor/board-maps/BoardMap.h +1364 -0
- data/vendor/board-maps/README.md +51 -0
- data/vendor/board-maps/lib/boards_parser.rb +66 -0
- data/vendor/board-maps/lib/header_parser.rb +164 -0
- data/vendor/board-maps/run.rb +47 -0
- data/vendor/board-maps/yaml/0XCB_HELIOS.yml +48 -0
- data/vendor/board-maps/yaml/ADAFRUIT_FEATHER_ESP32S2.yml +25 -0
- data/vendor/board-maps/yaml/ADAFRUIT_FEATHER_ESP32S2_REVTFT.yml +25 -0
- data/vendor/board-maps/yaml/ADAFRUIT_FEATHER_ESP32S2_TFT.yml +27 -0
- data/vendor/board-maps/yaml/ADAFRUIT_FEATHER_ESP32S3.yml +29 -0
- data/vendor/board-maps/yaml/ADAFRUIT_FEATHER_ESP32S3_NOPSRAM.yml +29 -0
- data/vendor/board-maps/yaml/ADAFRUIT_FEATHER_ESP32S3_REVTFT.yml +25 -0
- data/vendor/board-maps/yaml/ADAFRUIT_FEATHER_ESP32S3_TFT.yml +27 -0
- data/vendor/board-maps/yaml/ADAFRUIT_FEATHER_ESP32_V2.yml +30 -0
- data/vendor/board-maps/yaml/ADAFRUIT_FEATHER_RP2040.yml +48 -0
- data/vendor/board-maps/yaml/ADAFRUIT_FEATHER_RP2040_CAN.yml +48 -0
- data/vendor/board-maps/yaml/ADAFRUIT_FEATHER_RP2040_DVI.yml +48 -0
- data/vendor/board-maps/yaml/ADAFRUIT_FEATHER_RP2040_PROP_MAKER.yml +48 -0
- data/vendor/board-maps/yaml/ADAFRUIT_FEATHER_RP2040_RFM.yml +48 -0
- data/vendor/board-maps/yaml/ADAFRUIT_FEATHER_RP2040_SCORPIO.yml +48 -0
- data/vendor/board-maps/yaml/ADAFRUIT_FEATHER_RP2040_THINKINK.yml +48 -0
- data/vendor/board-maps/yaml/ADAFRUIT_FEATHER_RP2040_USB_HOST.yml +48 -0
- data/vendor/board-maps/yaml/ADAFRUIT_ITSYBITSY_ESP32.yml +24 -0
- data/vendor/board-maps/yaml/ADAFRUIT_ITSYBITSY_RP2040.yml +48 -0
- data/vendor/board-maps/yaml/ADAFRUIT_KB2040_RP2040.yml +48 -0
- data/vendor/board-maps/yaml/ADAFRUIT_MACROPAD_RP2040.yml +48 -0
- data/vendor/board-maps/yaml/ADAFRUIT_MATRIXPORTAL_ESP32S3.yml +16 -0
- data/vendor/board-maps/yaml/ADAFRUIT_QTPY_ESP32C3.yml +12 -0
- data/vendor/board-maps/yaml/ADAFRUIT_QTPY_ESP32S2.yml +22 -0
- data/vendor/board-maps/yaml/ADAFRUIT_QTPY_ESP32S3_NOPSRAM.yml +20 -0
- data/vendor/board-maps/yaml/ADAFRUIT_QTPY_ESP32_PICO.yml +27 -0
- data/vendor/board-maps/yaml/ADAFRUIT_QTPY_RP2040.yml +48 -0
- data/vendor/board-maps/yaml/ADAFRUIT_STEMMAFRIEND_RP2040.yml +48 -0
- data/vendor/board-maps/yaml/ADAFRUIT_TRINKEYQT_RP2040.yml +48 -0
- data/vendor/board-maps/yaml/ALKS.yml +34 -0
- data/vendor/board-maps/yaml/AMPERKA_WIFI_SLOT.yml +16 -0
- data/vendor/board-maps/yaml/AVR_ADK.yml +24 -0
- data/vendor/board-maps/yaml/AVR_BT.yml +16 -0
- data/vendor/board-maps/yaml/AVR_CIRCUITPLAY.yml +14 -0
- data/vendor/board-maps/yaml/AVR_DUEMILANOVE.yml +16 -0
- data/vendor/board-maps/yaml/AVR_ESPLORA.yml +20 -0
- data/vendor/board-maps/yaml/AVR_ETHERNET.yml +16 -0
- data/vendor/board-maps/yaml/AVR_FIO.yml +16 -0
- data/vendor/board-maps/yaml/AVR_GEMMA.yml +6 -0
- data/vendor/board-maps/yaml/AVR_INDUSTRIAL101.yml +20 -0
- data/vendor/board-maps/yaml/AVR_LEONARDO.yml +20 -0
- data/vendor/board-maps/yaml/AVR_LEONARDO_ETH.yml +20 -0
- data/vendor/board-maps/yaml/AVR_LILYPAD.yml +16 -0
- data/vendor/board-maps/yaml/AVR_LILYPAD_USB.yml +20 -0
- data/vendor/board-maps/yaml/AVR_LININO_ONE.yml +20 -0
- data/vendor/board-maps/yaml/AVR_MEGA.yml +24 -0
- data/vendor/board-maps/yaml/AVR_MEGA2560.yml +24 -0
- data/vendor/board-maps/yaml/AVR_MICRO.yml +20 -0
- data/vendor/board-maps/yaml/AVR_MINI.yml +16 -0
- data/vendor/board-maps/yaml/AVR_NANO.yml +16 -0
- data/vendor/board-maps/yaml/AVR_NANO_EVERY.yml +22 -0
- data/vendor/board-maps/yaml/AVR_NG.yml +16 -0
- data/vendor/board-maps/yaml/AVR_PRO.yml +16 -0
- data/vendor/board-maps/yaml/AVR_ROBOT_CONTROL.yml +22 -0
- data/vendor/board-maps/yaml/AVR_ROBOT_MOTOR.yml +19 -0
- data/vendor/board-maps/yaml/AVR_UNO.yml +16 -0
- data/vendor/board-maps/yaml/AVR_UNO_WIFI_DEV_ED.yml +16 -0
- data/vendor/board-maps/yaml/AVR_UNO_WIFI_REV2.yml +22 -0
- data/vendor/board-maps/yaml/AVR_YUN.yml +20 -0
- data/vendor/board-maps/yaml/AVR_YUNMINI.yml +20 -0
- data/vendor/board-maps/yaml/AirM2M_CORE_ESP32C3.yml +14 -0
- data/vendor/board-maps/yaml/BEE_DATA_LOGGER.yml +39 -0
- data/vendor/board-maps/yaml/BPI_BIT.yml +9 -0
- data/vendor/board-maps/yaml/BPI_LEAF_S3.yml +31 -0
- data/vendor/board-maps/yaml/BRIDGETEK_IDM2040-7A.yml +48 -0
- data/vendor/board-maps/yaml/BeeMotionS3.yml +40 -0
- data/vendor/board-maps/yaml/Bee_Motion.yml +27 -0
- data/vendor/board-maps/yaml/Bee_Motion_Mini.yml +1 -0
- data/vendor/board-maps/yaml/Bee_S3.yml +38 -0
- data/vendor/board-maps/yaml/CHALLENGER_2040_LORA_RP2040.yml +39 -0
- data/vendor/board-maps/yaml/CHALLENGER_2040_LTE_RP2040.yml +38 -0
- data/vendor/board-maps/yaml/CHALLENGER_2040_NFC_RP2040.yml +32 -0
- data/vendor/board-maps/yaml/CHALLENGER_2040_SDRTC_RP2040.yml +36 -0
- data/vendor/board-maps/yaml/CHALLENGER_2040_SUBGHZ_RP2040.yml +39 -0
- data/vendor/board-maps/yaml/CHALLENGER_2040_UWB_RP2040.yml +39 -0
- data/vendor/board-maps/yaml/CHALLENGER_2040_WIFI_BLE_RP2040.yml +42 -0
- data/vendor/board-maps/yaml/CHALLENGER_2040_WIFI_RP2040.yml +38 -0
- data/vendor/board-maps/yaml/CHALLENGER_NB_2040_WIFI_RP2040.yml +38 -0
- data/vendor/board-maps/yaml/CRABIK_SLOT_ESP32_S3.yml +19 -0
- data/vendor/board-maps/yaml/CYTRON_MAKER_FEATHER_AIOT_S3.yml +26 -0
- data/vendor/board-maps/yaml/CYTRON_MAKER_NANO_RP2040.yml +48 -0
- data/vendor/board-maps/yaml/CYTRON_MAKER_PI_RP2040.yml +48 -0
- data/vendor/board-maps/yaml/CoreESP32.yml +49 -0
- data/vendor/board-maps/yaml/D1_MINI32.yml +36 -0
- data/vendor/board-maps/yaml/D1_UNO32.yml +28 -0
- data/vendor/board-maps/yaml/DATANOISETV_PICOADK.yml +48 -0
- data/vendor/board-maps/yaml/DENKY.yml +26 -0
- data/vendor/board-maps/yaml/DENKY_PICOV3.yml +26 -0
- data/vendor/board-maps/yaml/DENKY_WROOM32.yml +26 -0
- data/vendor/board-maps/yaml/DEPARTMENT_OF_ALCHEMY_MINIMAIN_ESP32S2.yml +26 -0
- data/vendor/board-maps/yaml/DFROBOT_BEETLE_ESP32_C3.yml +14 -0
- data/vendor/board-maps/yaml/DFROBOT_BEETLE_RP2040.yml +48 -0
- data/vendor/board-maps/yaml/DFROBOT_FIREBEETLE_2_ESP32E.yml +44 -0
- data/vendor/board-maps/yaml/DFROBOT_FIREBEETLE_2_ESP32S3.yml +38 -0
- data/vendor/board-maps/yaml/DFROBOT_ROMEO_ESP32S3.yml +7 -0
- data/vendor/board-maps/yaml/DPU_ESP32.yml +26 -0
- data/vendor/board-maps/yaml/DYDK.yml +38 -0
- data/vendor/board-maps/yaml/DYDK1A.yml +37 -0
- data/vendor/board-maps/yaml/DYDK1Av2.yml +45 -0
- data/vendor/board-maps/yaml/DYG.yml +20 -0
- data/vendor/board-maps/yaml/DYM.yml +40 -0
- data/vendor/board-maps/yaml/DYMv2.yml +39 -0
- data/vendor/board-maps/yaml/D_Duino_32.yml +29 -0
- data/vendor/board-maps/yaml/ELECTRONICCATS_HUNTERCAT_NFC.yml +44 -0
- data/vendor/board-maps/yaml/ESP320.yml +8 -0
- data/vendor/board-maps/yaml/ESP32C3_DEV.yml +14 -0
- data/vendor/board-maps/yaml/ESP32C3_M1_I_KIT.yml +13 -0
- data/vendor/board-maps/yaml/ESP32S2_DEV.yml +33 -0
- data/vendor/board-maps/yaml/ESP32S2_THING_PLUS.yml +34 -0
- data/vendor/board-maps/yaml/ESP32S2_USB.yml +33 -0
- data/vendor/board-maps/yaml/ESP32S3_CAM_LCD.yml +7 -0
- data/vendor/board-maps/yaml/ESP32S3_DEV.yml +38 -0
- data/vendor/board-maps/yaml/ESP32_DEV.yml +26 -0
- data/vendor/board-maps/yaml/ESP32_DEVKIT_LIPO.yml +26 -0
- data/vendor/board-maps/yaml/ESP32_EVB.yml +7 -0
- data/vendor/board-maps/yaml/ESP32_GATEWAY.yml +13 -0
- data/vendor/board-maps/yaml/ESP32_GATEWAY_C.yml +13 -0
- data/vendor/board-maps/yaml/ESP32_GATEWAY_E.yml +13 -0
- data/vendor/board-maps/yaml/ESP32_GATEWAY_F.yml +13 -0
- data/vendor/board-maps/yaml/ESP32_IOT_REDBOARD.yml +27 -0
- data/vendor/board-maps/yaml/ESP32_MICROMOD.yml +24 -0
- data/vendor/board-maps/yaml/ESP32_PICO.yml +26 -0
- data/vendor/board-maps/yaml/ESP32_POE.yml +7 -0
- data/vendor/board-maps/yaml/ESP32_POE_ISO.yml +7 -0
- data/vendor/board-maps/yaml/ESP32_S3_BOX.yml +16 -0
- data/vendor/board-maps/yaml/ESP32_S3_USB_OTG.yml +11 -0
- data/vendor/board-maps/yaml/ESP32_THING.yml +27 -0
- data/vendor/board-maps/yaml/ESP32_THING_PLUS.yml +30 -0
- data/vendor/board-maps/yaml/ESP32_THING_PLUS_C.yml +30 -0
- data/vendor/board-maps/yaml/ESP32_WROOM_DA.yml +26 -0
- data/vendor/board-maps/yaml/ESP32_WROVER_KIT.yml +26 -0
- data/vendor/board-maps/yaml/ESP8266_ADAFRUIT_HUZZAH.yml +9 -0
- data/vendor/board-maps/yaml/ESP8266_AGRUMINO_LEMON_V4.yml +8 -0
- data/vendor/board-maps/yaml/ESP8266_ARDUINO_PRIMO.yml +7 -0
- data/vendor/board-maps/yaml/ESP8266_ARDUINO_STAR_OTTO.yml +7 -0
- data/vendor/board-maps/yaml/ESP8266_ARDUINO_UNOWIFI.yml +9 -0
- data/vendor/board-maps/yaml/ESP8266_ESP01.yml +9 -0
- data/vendor/board-maps/yaml/ESP8266_ESP07.yml +20 -0
- data/vendor/board-maps/yaml/ESP8266_ESP12.yml +20 -0
- data/vendor/board-maps/yaml/ESP8266_ESP13.yml +17 -0
- data/vendor/board-maps/yaml/ESP8266_ESP210.yml +9 -0
- data/vendor/board-maps/yaml/ESP8266_ESPECTRO_CORE.yml +9 -0
- data/vendor/board-maps/yaml/ESP8266_ESPINO_ESP12.yml +9 -0
- data/vendor/board-maps/yaml/ESP8266_ESPINO_ESP13.yml +9 -0
- data/vendor/board-maps/yaml/ESP8266_ESPRESSO_LITE_V1.yml +9 -0
- data/vendor/board-maps/yaml/ESP8266_ESPRESSO_LITE_V2.yml +9 -0
- data/vendor/board-maps/yaml/ESP8266_GENERIC.yml +9 -0
- data/vendor/board-maps/yaml/ESP8266_INVENT_ONE.yml +22 -0
- data/vendor/board-maps/yaml/ESP8266_NODEMCU_ESP12.yml +20 -0
- data/vendor/board-maps/yaml/ESP8266_NODEMCU_ESP12E.yml +20 -0
- data/vendor/board-maps/yaml/ESP8266_OAK.yml +9 -0
- data/vendor/board-maps/yaml/ESP8266_PHOENIX_V1.yml +9 -0
- data/vendor/board-maps/yaml/ESP8266_PHOENIX_V2.yml +9 -0
- data/vendor/board-maps/yaml/ESP8266_SCHIRMILABS_EDUINO_WIFI.yml +25 -0
- data/vendor/board-maps/yaml/ESP8266_SONOFF_BASIC.yml +9 -0
- data/vendor/board-maps/yaml/ESP8266_SONOFF_S20.yml +9 -0
- data/vendor/board-maps/yaml/ESP8266_SONOFF_SV.yml +9 -0
- data/vendor/board-maps/yaml/ESP8266_SONOFF_TH.yml +9 -0
- data/vendor/board-maps/yaml/ESP8266_THING.yml +9 -0
- data/vendor/board-maps/yaml/ESP8266_THING_DEV.yml +9 -0
- data/vendor/board-maps/yaml/ESP8266_WEMOS_D1MINI.yml +18 -0
- data/vendor/board-maps/yaml/ESP8266_WEMOS_D1MINILITE.yml +18 -0
- data/vendor/board-maps/yaml/ESP8266_WEMOS_D1MINIPRO.yml +18 -0
- data/vendor/board-maps/yaml/ESP8266_WEMOS_D1R1.yml +25 -0
- data/vendor/board-maps/yaml/ESP8266_WEMOS_D1WROOM02.yml +18 -0
- data/vendor/board-maps/yaml/ESP8266_WIO_LINK.yml +9 -0
- data/vendor/board-maps/yaml/ESP8266_XINABOX_CW01.yml +9 -0
- data/vendor/board-maps/yaml/ESPECTRO32.yml +27 -0
- data/vendor/board-maps/yaml/ESPea32.yml +27 -0
- data/vendor/board-maps/yaml/ESPino32.yml +27 -0
- data/vendor/board-maps/yaml/ET-Board.yml +26 -0
- data/vendor/board-maps/yaml/EXTREMEELEXTRONICS_RC2040.yml +46 -0
- data/vendor/board-maps/yaml/Edgebox-ESP-100.yml +7 -0
- data/vendor/board-maps/yaml/FEATHERS2.yml +33 -0
- data/vendor/board-maps/yaml/FEATHERS2NEO.yml +30 -0
- data/vendor/board-maps/yaml/FEATHERS3.yml +29 -0
- data/vendor/board-maps/yaml/FEATHER_ESP32.yml +28 -0
- data/vendor/board-maps/yaml/FLYBOARD2040_CORE.yml +48 -0
- data/vendor/board-maps/yaml/FRANZININHO_WIFI.yml +33 -0
- data/vendor/board-maps/yaml/FRANZININHO_WIFI_MSC.yml +33 -0
- data/vendor/board-maps/yaml/FROG_ESP32.yml +26 -0
- data/vendor/board-maps/yaml/FUNHOUSE_ESP32S2.yml +22 -0
- data/vendor/board-maps/yaml/GEN4_IOD.yml +9 -0
- data/vendor/board-maps/yaml/GENERIC_RP2040.yml +48 -0
- data/vendor/board-maps/yaml/HEALTHYPI_4.yml +27 -0
- data/vendor/board-maps/yaml/HONEYLEMON.yml +27 -0
- data/vendor/board-maps/yaml/HORNBILL_ESP32_DEV.yml +27 -0
- data/vendor/board-maps/yaml/HORNBILL_ESP32_MINIMA.yml +16 -0
- data/vendor/board-maps/yaml/ILABS_2040_RPICO32_RP2040.yml +47 -0
- data/vendor/board-maps/yaml/IMBRIOS_LOGSENS_V1P1.yml +19 -0
- data/vendor/board-maps/yaml/INTOROBOT_ESP32_DEV.yml +34 -0
- data/vendor/board-maps/yaml/LILYGO_T_DISPLAY_S3.yml +26 -0
- data/vendor/board-maps/yaml/LOLIN32.yml +27 -0
- data/vendor/board-maps/yaml/LOLIN32_LITE.yml +27 -0
- data/vendor/board-maps/yaml/LOLIN_C3_MINI.yml +14 -0
- data/vendor/board-maps/yaml/LOLIN_D32.yml +27 -0
- data/vendor/board-maps/yaml/LOLIN_D32_PRO.yml +27 -0
- data/vendor/board-maps/yaml/LOLIN_S2_MINI.yml +34 -0
- data/vendor/board-maps/yaml/LOLIN_S2_PICO.yml +34 -0
- data/vendor/board-maps/yaml/LOLIN_S3.yml +32 -0
- data/vendor/board-maps/yaml/LOLIN_S3_MINI.yml +32 -0
- data/vendor/board-maps/yaml/LOLIN_S3_PRO.yml +32 -0
- data/vendor/board-maps/yaml/Lion_Bit_Dev_Board.yml +18 -0
- data/vendor/board-maps/yaml/LoPy.yml +27 -0
- data/vendor/board-maps/yaml/LoPy4.yml +27 -0
- data/vendor/board-maps/yaml/M5STACK_CORES3.yml +8 -0
- data/vendor/board-maps/yaml/M5STACK_Core2.yml +9 -0
- data/vendor/board-maps/yaml/M5STACK_FIRE.yml +10 -0
- data/vendor/board-maps/yaml/M5Stack-Timer-CAM.yml +10 -0
- data/vendor/board-maps/yaml/M5Stack_ATOM.yml +10 -0
- data/vendor/board-maps/yaml/M5Stack_ATOMS3.yml +7 -0
- data/vendor/board-maps/yaml/M5Stack_CoreInk.yml +9 -0
- data/vendor/board-maps/yaml/M5Stack_Core_ESP32.yml +10 -0
- data/vendor/board-maps/yaml/M5Stack_Station.yml +10 -0
- data/vendor/board-maps/yaml/M5Stick_C.yml +10 -0
- data/vendor/board-maps/yaml/MAGTAG29_ESP32S2.yml +21 -0
- data/vendor/board-maps/yaml/MELOPERO_COOKIE_RP2040.yml +48 -0
- data/vendor/board-maps/yaml/MELOPERO_SHAKE_RP2040.yml +48 -0
- data/vendor/board-maps/yaml/METRO_ESP32S2.yml +34 -0
- data/vendor/board-maps/yaml/MGBOT_IOTIK32A.yml +27 -0
- data/vendor/board-maps/yaml/MGBOT_IOTIK32B.yml +27 -0
- data/vendor/board-maps/yaml/MH_ET_LIVE_ESP32DEVKIT.yml +27 -0
- data/vendor/board-maps/yaml/MH_ET_LIVE_ESP32MINIKIT.yml +27 -0
- data/vendor/board-maps/yaml/MICROS2.yml +34 -0
- data/vendor/board-maps/yaml/MOD_WIFI_ESP8266.yml +9 -0
- data/vendor/board-maps/yaml/Metro.yml +8 -0
- data/vendor/board-maps/yaml/NANO32.yml +27 -0
- data/vendor/board-maps/yaml/NANO_RP2040_CONNECT.yml +35 -0
- data/vendor/board-maps/yaml/NEBULAS3.yml +33 -0
- data/vendor/board-maps/yaml/NEKOSYSTEMS_BL2040_MINI.yml +48 -0
- data/vendor/board-maps/yaml/NULLBITS_BIT_C_PRO.yml +48 -0
- data/vendor/board-maps/yaml/Node32s.yml +27 -0
- data/vendor/board-maps/yaml/NodeMCU_32S.yml +27 -0
- data/vendor/board-maps/yaml/ODROID_ESP32.yml +10 -0
- data/vendor/board-maps/yaml/ONEHORSE_ESP32_DEV.yml +24 -0
- data/vendor/board-maps/yaml/OROCA_EDUBOT.yml +33 -0
- data/vendor/board-maps/yaml/PIMORONI_PGA2040.yml +48 -0
- data/vendor/board-maps/yaml/PROS3.yml +28 -0
- data/vendor/board-maps/yaml/PYCOM_GPY.yml +27 -0
- data/vendor/board-maps/yaml/Piranha.yml +16 -0
- data/vendor/board-maps/yaml/Pocket32.yml +27 -0
- data/vendor/board-maps/yaml/QUANTUM.yml +26 -0
- data/vendor/board-maps/yaml/RASPBERRY_PI_PICO.yml +48 -0
- data/vendor/board-maps/yaml/RASPBERRY_PI_PICO_W.yml +48 -0
- data/vendor/board-maps/yaml/REDPILL_ESP32S3.yml +32 -0
- data/vendor/board-maps/yaml/RMP.yml +33 -0
- data/vendor/board-maps/yaml/SAMD_CIRCUITPLAYGROUND_EXPRESS.yml +12 -0
- data/vendor/board-maps/yaml/SAMD_MKR1000.yml +20 -0
- data/vendor/board-maps/yaml/SAMD_MKRFox1200.yml +19 -0
- data/vendor/board-maps/yaml/SAMD_MKRGSM1400.yml +15 -0
- data/vendor/board-maps/yaml/SAMD_MKRNB1500.yml +15 -0
- data/vendor/board-maps/yaml/SAMD_MKRVIDOR4000.yml +19 -0
- data/vendor/board-maps/yaml/SAMD_MKRWAN1300.yml +18 -0
- data/vendor/board-maps/yaml/SAMD_MKRWAN1310.yml +18 -0
- data/vendor/board-maps/yaml/SAMD_MKRWIFI1010.yml +19 -0
- data/vendor/board-maps/yaml/SAMD_MKRZERO.yml +19 -0
- data/vendor/board-maps/yaml/SAMD_NANO_33_IOT.yml +13 -0
- data/vendor/board-maps/yaml/SAMD_TIAN.yml +15 -0
- data/vendor/board-maps/yaml/SAMD_ZERO.yml +14 -0
- data/vendor/board-maps/yaml/SAM_DUE.yml +26 -0
- data/vendor/board-maps/yaml/SAM_ZERO.yml +15 -0
- data/vendor/board-maps/yaml/SEEED_INDICATOR_RP2040.yml +47 -0
- data/vendor/board-maps/yaml/SEEED_XIAO_RP2040.yml +29 -0
- data/vendor/board-maps/yaml/SOLDERPARTY_RP2040_STAMP.yml +48 -0
- data/vendor/board-maps/yaml/SONOFF_DUALR3.yml +26 -0
- data/vendor/board-maps/yaml/SPARKFUN_PROMICRO_RP2040.yml +48 -0
- data/vendor/board-maps/yaml/SPARKFUN_THINGPLUS_RP2040.yml +48 -0
- data/vendor/board-maps/yaml/STAMP_S3.yml +4 -0
- data/vendor/board-maps/yaml/TAMC_TERMOD_S3.yml +31 -0
- data/vendor/board-maps/yaml/TBEAM_USE_RADIO_SX1262.yml +23 -0
- data/vendor/board-maps/yaml/TBEAM_USE_RADIO_SX1268.yml +23 -0
- data/vendor/board-maps/yaml/TBEAM_USE_RADIO_SX1276.yml +23 -0
- data/vendor/board-maps/yaml/TBEAM_USE_RADIO_SX1278.yml +23 -0
- data/vendor/board-maps/yaml/TBEAM_USE_RADIO_SX1280.yml +23 -0
- data/vendor/board-maps/yaml/TBeam.yml +23 -0
- data/vendor/board-maps/yaml/TINYPICO.yml +26 -0
- data/vendor/board-maps/yaml/TINYS2.yml +33 -0
- data/vendor/board-maps/yaml/TINYS3.yml +25 -0
- data/vendor/board-maps/yaml/TTGO-T-OI-PLUS_DEV.yml +11 -0
- data/vendor/board-maps/yaml/TTGO_LoRa32_V1.yml +28 -0
- data/vendor/board-maps/yaml/TTGO_LoRa32_V2.yml +28 -0
- data/vendor/board-maps/yaml/TTGO_LoRa32_v21new.yml +28 -0
- data/vendor/board-maps/yaml/TTGO_T1.yml +27 -0
- data/vendor/board-maps/yaml/TTGO_T7_V13_Mini32.yml +27 -0
- data/vendor/board-maps/yaml/TTGO_T7_V14_Mini32.yml +27 -0
- data/vendor/board-maps/yaml/TWATCH_2020_V1.yml +10 -0
- data/vendor/board-maps/yaml/TWATCH_2020_V2.yml +10 -0
- data/vendor/board-maps/yaml/TWATCH_2020_V3.yml +10 -0
- data/vendor/board-maps/yaml/TWATCH_BASE.yml +10 -0
- data/vendor/board-maps/yaml/TWatch.yml +10 -0
- data/vendor/board-maps/yaml/Trueverit_ESP32_Universal_IoT_Driver.yml +18 -0
- data/vendor/board-maps/yaml/Trueverit_ESP32_Universal_IoT_Driver_MK_II.yml +18 -0
- data/vendor/board-maps/yaml/UBLOX_NINA_W10.yml +48 -0
- data/vendor/board-maps/yaml/UBLOX_NORA_W10.yml +43 -0
- data/vendor/board-maps/yaml/UPESY_RP2040_DEVKIT.yml +48 -0
- data/vendor/board-maps/yaml/VALTRACK_V4_MFW_ESP32_C3.yml +23 -0
- data/vendor/board-maps/yaml/VALTRACK_V4_VTS_ESP32_C3.yml +23 -0
- data/vendor/board-maps/yaml/VIYALAB_MIZU_RP2040.yml +48 -0
- data/vendor/board-maps/yaml/WATCHY.yml +7 -0
- data/vendor/board-maps/yaml/WATCHY_V10.yml +7 -0
- data/vendor/board-maps/yaml/WATCHY_V15.yml +7 -0
- data/vendor/board-maps/yaml/WATCHY_V20.yml +7 -0
- data/vendor/board-maps/yaml/WAVESHARE_RP2040_LCD_0_96.yml +47 -0
- data/vendor/board-maps/yaml/WAVESHARE_RP2040_LCD_1_28.yml +47 -0
- data/vendor/board-maps/yaml/WAVESHARE_RP2040_ONE.yml +47 -0
- data/vendor/board-maps/yaml/WAVESHARE_RP2040_PLUS.yml +48 -0
- data/vendor/board-maps/yaml/WAVESHARE_RP2040_ZERO.yml +47 -0
- data/vendor/board-maps/yaml/WESP32.yml +17 -0
- data/vendor/board-maps/yaml/WIDORA_AIR.yml +34 -0
- data/vendor/board-maps/yaml/WIFIDUINO_ESP8266.yml +23 -0
- data/vendor/board-maps/yaml/WIFINFO.yml +20 -0
- data/vendor/board-maps/yaml/WIPY3.yml +27 -0
- data/vendor/board-maps/yaml/WIZNET_5100S_EVB_PICO.yml +48 -0
- data/vendor/board-maps/yaml/WIZNET_5500_EVB_PICO.yml +48 -0
- data/vendor/board-maps/yaml/WIZNET_WIZFI360_EVB_PICO.yml +48 -0
- data/vendor/board-maps/yaml/WT32_ETH01.yml +8 -0
- data/vendor/board-maps/yaml/WiFiduino32S3.yml +27 -0
- data/vendor/board-maps/yaml/WiFiduinoV2.yml +27 -0
- data/vendor/board-maps/yaml/Wifiduino32.yml +40 -0
- data/vendor/board-maps/yaml/XIAO_ESP32C3.yml +22 -0
- data/vendor/board-maps/yaml/XIAO_ESP32S3.yml +36 -0
- data/vendor/board-maps/yaml/YD_RP2040.yml +48 -0
- data/vendor/board-maps/yaml/atmegazero_esp32s2.yml +30 -0
- data/vendor/board-maps/yaml/connaxio_espoir.yml +18 -0
- data/vendor/board-maps/yaml/esp32vn_iot_uno.yml +22 -0
- data/vendor/board-maps/yaml/fm_devkit.yml +15 -0
- data/vendor/board-maps/yaml/heltec_wifi_32_lora_V3.yml +31 -0
- data/vendor/board-maps/yaml/heltec_wifi_kit_32.yml +28 -0
- data/vendor/board-maps/yaml/heltec_wifi_kit_32_V3.yml +32 -0
- data/vendor/board-maps/yaml/heltec_wifi_lora_32.yml +27 -0
- data/vendor/board-maps/yaml/heltec_wifi_lora_32_V2.yml +27 -0
- data/vendor/board-maps/yaml/heltec_wireless_stick.yml +27 -0
- data/vendor/board-maps/yaml/heltec_wireless_stick_LITE.yml +27 -0
- data/vendor/board-maps/yaml/openkb.yml +27 -0
- data/vendor/board-maps/yaml/roboheart_hercules.yml +17 -0
- data/vendor/board-maps/yaml/sensesiot_weizen.yml +26 -0
- data/vendor/board-maps/yaml/uPesy_WROOM.yml +27 -0
- data/vendor/board-maps/yaml/uPesy_WROVER.yml +27 -0
- data/vendor/board-maps/yaml/unphone8.yml +32 -0
- data/vendor/board-maps/yaml/unphone9.yml +32 -0
- data/vendor/board-maps/yaml/wifi_kit_8.yml +15 -0
- metadata +800 -0
@@ -0,0 +1,26 @@
|
|
1
|
+
//
|
2
|
+
// Denko IR output for the ESP8266 and ESP32.
|
3
|
+
// Depends on: https://github.com/crankyoldgit/IRremoteESP8266
|
4
|
+
// DENKO_IR_OUT must be defeind in DenkoDefines.h
|
5
|
+
//
|
6
|
+
#include "Denko.h"
|
7
|
+
#if defined(DENKO_IR_OUT) && (defined(ESP8266) || defined(ESP32))
|
8
|
+
|
9
|
+
#include <IRremoteESP8266.h>
|
10
|
+
#include <IRsend.h>
|
11
|
+
|
12
|
+
// CMD = 16
|
13
|
+
// Send an infrared signal.
|
14
|
+
void Denko::irSend(){
|
15
|
+
// Byte 1+ of auxMsg is already little-endian uint16 pulses.
|
16
|
+
uint16_t *pulseArray = reinterpret_cast<uint16_t *>(auxMsg + 1);
|
17
|
+
|
18
|
+
// Can work on any pin.
|
19
|
+
IRsend infraredOut(pin);
|
20
|
+
infraredOut.begin();
|
21
|
+
|
22
|
+
// auxMsg[0] is how many pulses were packed.
|
23
|
+
// val is frequency
|
24
|
+
infraredOut.sendRaw(pulseArray, auxMsg[0], val);
|
25
|
+
}
|
26
|
+
#endif
|
@@ -0,0 +1,49 @@
|
|
1
|
+
//
|
2
|
+
// Write addressable LEDs using standard Arduino libraries.
|
3
|
+
//
|
4
|
+
#include "Denko.h"
|
5
|
+
#ifdef DENKO_LED_ARRAY
|
6
|
+
|
7
|
+
//
|
8
|
+
// WS2812 / NeoPixel support using Adafruit library from:
|
9
|
+
// https://github.com/adafruit/Adafruit_NeoPixel
|
10
|
+
//
|
11
|
+
# ifdef DENKO_LED_WS2812
|
12
|
+
#include <Adafruit_NeoPixel.h>
|
13
|
+
#endif
|
14
|
+
|
15
|
+
//
|
16
|
+
// CMD = 19
|
17
|
+
// Write data to a WS2812 LED array. Will generalize to other types later.
|
18
|
+
//
|
19
|
+
// pin = Microcontroller pin connected to Data In pin of the LED array.
|
20
|
+
// val = Number of RGB or RGBW LEDS (aka pixels) in the array.
|
21
|
+
// auxMsg[0..3] = Reserved for future settings.
|
22
|
+
// auxMsg[4+] = Raw pixel data, already in correct byte order (GRB, RGB, etc.).
|
23
|
+
//
|
24
|
+
void Denko::showLEDArray() {
|
25
|
+
// Setup a new LED array object.
|
26
|
+
Adafruit_NeoPixel ledArray(val, pin, NEO_GRB + NEO_KHZ800);
|
27
|
+
ledArray.begin();
|
28
|
+
|
29
|
+
// Copy LED data into the pixel buffer.
|
30
|
+
// NOTE: val * 3 will have to change to val * 4 for RGBW leds.
|
31
|
+
memcpy(ledArray.getPixels(), &auxMsg[4], val * 3);
|
32
|
+
|
33
|
+
// I have NO idea what causes the first green LED to stay stuck on.
|
34
|
+
// A small delay here seems like a consistent fix. ESP32 doesn't need it.
|
35
|
+
// AVR can get away with 32us, but others need 64.
|
36
|
+
#if defined(ESP8266) || defined(__SAMD21G18A__) || defined(__SAM3X8E__)
|
37
|
+
delayMicroseconds(64);
|
38
|
+
#endif
|
39
|
+
#ifdef __AVR__
|
40
|
+
delayMicroseconds(32);
|
41
|
+
#endif
|
42
|
+
|
43
|
+
// Write the pixel buffer to the array.
|
44
|
+
ledArray.show();
|
45
|
+
|
46
|
+
// Tell the computer to resume sending data.
|
47
|
+
sendReady();
|
48
|
+
}
|
49
|
+
#endif
|
@@ -0,0 +1,156 @@
|
|
1
|
+
//
|
2
|
+
// This file contains low-level functions to get precise (enough)
|
3
|
+
// timing required for using the Dallas/Maxim 1-Wire protocol.
|
4
|
+
// Higher level logic is handled in Ruby.
|
5
|
+
//
|
6
|
+
#include "Denko.h"
|
7
|
+
#ifdef DENKO_ONE_WIRE
|
8
|
+
|
9
|
+
// CMD = 41
|
10
|
+
// Reset the OneWire bus and return a presence value only if requested.
|
11
|
+
//
|
12
|
+
void Denko::owReset(){
|
13
|
+
byte present;
|
14
|
+
pinMode(pin, OUTPUT);
|
15
|
+
digitalWrite(pin, LOW);
|
16
|
+
microDelay(500);
|
17
|
+
pinMode(pin, INPUT);
|
18
|
+
digitalWrite(pin, HIGH); // Essential on ESP32. Enables pullup on others.
|
19
|
+
microDelay(80);
|
20
|
+
present = digitalRead(pin);
|
21
|
+
microDelay(420);
|
22
|
+
if(val>0) coreResponse(pin, present);
|
23
|
+
}
|
24
|
+
|
25
|
+
// CMD = 42
|
26
|
+
// Read a 64-bit address and complement, echoing each address bit to the bus,
|
27
|
+
// unless we are searching a branch that has that bit set to 1, then echo 1.
|
28
|
+
//
|
29
|
+
void Denko::owSearch(){
|
30
|
+
byte addr = 0x00;
|
31
|
+
byte comp = 0x00;
|
32
|
+
|
33
|
+
// Start streaming the message.
|
34
|
+
stream->print(pin); stream->print(':');
|
35
|
+
|
36
|
+
for(byte i=0; i<8; i++){
|
37
|
+
for(byte j=0; j<8; j++){
|
38
|
+
bitWrite(addr, j, owReadBit());
|
39
|
+
bitWrite(comp, j, owReadBit());
|
40
|
+
|
41
|
+
// First 8 bytes of auxMsg is a 64-bit branch mask. Any bit set to 1 says
|
42
|
+
// that we're searching a branch with that bit set to 1, and must force
|
43
|
+
// it to be 1 on this pass. Write 1 to both the address bit and the bus.
|
44
|
+
//
|
45
|
+
// We also do not change the complement bit from 0, Even though the bus
|
46
|
+
// said 0/0, we are sending back 1/0, hiding discrepancies we are testing,
|
47
|
+
// only sending those that appeared this time, which is what we care about.
|
48
|
+
//
|
49
|
+
if(bitRead(auxMsg[i], j) == 1){
|
50
|
+
owWriteBit(1);
|
51
|
+
bitWrite(addr, j, 1);
|
52
|
+
|
53
|
+
// Whether there was no "1-branch" marked for this bit, or there is no
|
54
|
+
// discrepancy at all, just echo address bit to the bus. We compare
|
55
|
+
// addr/comp remotely to find discrepancies for future passes.
|
56
|
+
//
|
57
|
+
} else {
|
58
|
+
owWriteBit(bitRead(addr, j));
|
59
|
+
}
|
60
|
+
}
|
61
|
+
stream->print(addr);
|
62
|
+
stream->print(',');
|
63
|
+
stream->print(comp);
|
64
|
+
stream->print((i == 7) ? '\n' : ',');
|
65
|
+
}
|
66
|
+
}
|
67
|
+
|
68
|
+
// CMD = 43
|
69
|
+
// Write to the OneWire bus.
|
70
|
+
//
|
71
|
+
// val = number of bytes to write + parasite power condition flag in MSB.
|
72
|
+
// auxMsg[0] = first byte of data and so on...
|
73
|
+
// Limited to 127 bytes. Validate remotely.
|
74
|
+
//
|
75
|
+
void Denko::owWrite(){
|
76
|
+
// Check and clear parasite flag.
|
77
|
+
bool parasite = bitRead(val, 7);
|
78
|
+
bitClear(val, 7);
|
79
|
+
|
80
|
+
byte b;
|
81
|
+
for(byte i=0; i<val; i++){
|
82
|
+
b = auxMsg[i];
|
83
|
+
for(byte j=0; j<8; j++){
|
84
|
+
owWriteBit(bitRead(b, j));
|
85
|
+
}
|
86
|
+
}
|
87
|
+
|
88
|
+
// Drive bus high to feed the parasite capacitor after writing if necessary.
|
89
|
+
if (parasite) {
|
90
|
+
pinMode(pin, OUTPUT);
|
91
|
+
digitalWrite(pin, HIGH);
|
92
|
+
}
|
93
|
+
}
|
94
|
+
|
95
|
+
void Denko::owWriteBit(byte b){
|
96
|
+
// Write slot always starts with pulling the bus low for at least 1us.
|
97
|
+
pinMode(pin, OUTPUT);
|
98
|
+
digitalWrite(pin, LOW);
|
99
|
+
microDelay(1);
|
100
|
+
|
101
|
+
// If 1, release so the bus idles high, and wait out the 60us write slot.
|
102
|
+
if(b == 1){
|
103
|
+
pinMode(pin, INPUT);
|
104
|
+
digitalWrite(pin, HIGH); // Essential on ESP32. Enables pullup on others.
|
105
|
+
microDelay(59);
|
106
|
+
// If 0, keep it low for the rest of the 60us write slot, then release.
|
107
|
+
} else {
|
108
|
+
microDelay(59);
|
109
|
+
pinMode(pin, INPUT);
|
110
|
+
digitalWrite(pin, HIGH); // Essential on ESP32. Enables pullup on others.
|
111
|
+
}
|
112
|
+
// Minimum 1us recovery time after each slot.
|
113
|
+
microDelay(1);
|
114
|
+
}
|
115
|
+
|
116
|
+
// CMD = 44
|
117
|
+
// Read bytes from the OneWire bus.
|
118
|
+
//
|
119
|
+
// val = number of bytes to read
|
120
|
+
//
|
121
|
+
void Denko::owRead(){
|
122
|
+
byte b = 0x00;
|
123
|
+
|
124
|
+
// Start streaming the message.
|
125
|
+
stream->print(pin); stream->print(':');
|
126
|
+
|
127
|
+
// Print each byte read, followed by a comma, or newline for last byte.
|
128
|
+
for(byte i=0; i<val; i++){
|
129
|
+
for(byte j=0; j<8; j++){
|
130
|
+
bitWrite(b, j, owReadBit());
|
131
|
+
}
|
132
|
+
stream->print(b);
|
133
|
+
stream->print((i == (val-1)) ? '\n' : ',');
|
134
|
+
}
|
135
|
+
}
|
136
|
+
|
137
|
+
byte Denko::owReadBit(){
|
138
|
+
byte b = 0x00;
|
139
|
+
// Pull low for at least 1us to start a read slot, then release.
|
140
|
+
pinMode(pin, OUTPUT);
|
141
|
+
digitalWrite(pin, LOW);
|
142
|
+
microDelay(1);
|
143
|
+
pinMode(pin, INPUT);
|
144
|
+
digitalWrite(pin, HIGH); // Essential on ESP32. Enables pullup on others.
|
145
|
+
|
146
|
+
// Wait for the slave to write to the bus. It should hold for up to 15us.
|
147
|
+
microDelay(5);
|
148
|
+
|
149
|
+
// If slave pulled the bus high, the bit is a 1, else 0.
|
150
|
+
b = digitalRead(pin);
|
151
|
+
|
152
|
+
// Wait out the 60us read slot + recovery time.
|
153
|
+
microDelay(55);
|
154
|
+
return b;
|
155
|
+
}
|
156
|
+
#endif
|
@@ -0,0 +1,57 @@
|
|
1
|
+
//
|
2
|
+
// Read chains of input pulses. Only used for DHT sensors right now.
|
3
|
+
//
|
4
|
+
#include "Denko.h"
|
5
|
+
|
6
|
+
// CMD = 11
|
7
|
+
//
|
8
|
+
// Rapidly polls a digital input looking for rising or falling edges,
|
9
|
+
// recording the time in microseconds between consecutive edges.
|
10
|
+
// There is an optional reset at the beginning if the pin must be held opposite
|
11
|
+
// to its idle state to trigger a reading.
|
12
|
+
//
|
13
|
+
// Max 65535 microseconds reset time.
|
14
|
+
// Max 255 microseconds per pulse (between 2 consecutive edges).
|
15
|
+
// Max 255 pulses counted.
|
16
|
+
//
|
17
|
+
// val bit 0 : whether to reset the line first or not (0 = no, 1 = yes)
|
18
|
+
// val bit 1 : direction to pull the line (0 = low, 1 = high)
|
19
|
+
// auxMsg[0-1] : unsigned 16-bit reset duration
|
20
|
+
// auxMsg[2-3] : unsigned 16-bit pulse read timeout (in milliseconds)
|
21
|
+
// auxMsg[4] : unsigned 8-bit pulse count limit
|
22
|
+
// auxMsg[8+] : reserved as output buffer, will be overwritten
|
23
|
+
//
|
24
|
+
void Denko::pulseRead(){
|
25
|
+
// Reset
|
26
|
+
if (bitRead(val, 0)) {
|
27
|
+
uint16_t resetTime = (auxMsg[1] << 8) | auxMsg[0];
|
28
|
+
pinMode(pin, OUTPUT);
|
29
|
+
digitalWrite(pin, bitRead(val, 1));
|
30
|
+
delayMicroseconds(resetTime);
|
31
|
+
}
|
32
|
+
pinMode(pin, INPUT);
|
33
|
+
byte state = digitalRead(pin);
|
34
|
+
|
35
|
+
uint16_t timeout = (auxMsg[3] << 8) | auxMsg[2];
|
36
|
+
byte pulseCount = 0;
|
37
|
+
|
38
|
+
uint32_t start = millis();
|
39
|
+
uint32_t lastWrite = micros();
|
40
|
+
|
41
|
+
while ((millis() - start < timeout) && (pulseCount < auxMsg[4])) {
|
42
|
+
if (digitalRead(pin) != state){
|
43
|
+
uint32_t now = micros();
|
44
|
+
pulseCount++;
|
45
|
+
auxMsg[pulseCount+8] = now - lastWrite;
|
46
|
+
lastWrite = now;
|
47
|
+
state = state ^ 1;
|
48
|
+
}
|
49
|
+
}
|
50
|
+
|
51
|
+
stream->print(pin); stream->print(':');
|
52
|
+
for (byte i=1; i<=pulseCount; i++){
|
53
|
+
stream->print(auxMsg[i+8]);
|
54
|
+
stream->print((i == pulseCount) ? '\n' : ',');
|
55
|
+
}
|
56
|
+
if (pulseCount == 0) stream->print('\n');
|
57
|
+
}
|
@@ -0,0 +1,165 @@
|
|
1
|
+
#include "Denko.h"
|
2
|
+
|
3
|
+
//
|
4
|
+
// Functions for listeners shared between hardware and bit bang SPI.
|
5
|
+
//
|
6
|
+
#if defined(DENKO_SPI) || defined(DENKO_SPI_BB)
|
7
|
+
// CMD = 28
|
8
|
+
// Send a number for a select pin to remove a SPI listener.
|
9
|
+
void Denko::spiRemoveListener(){
|
10
|
+
for (int i = 0; i < SPI_LISTENER_COUNT; i++) {
|
11
|
+
if (spiListeners[i].select == pin) {
|
12
|
+
spiListeners[i].enabled = 0;
|
13
|
+
}
|
14
|
+
}
|
15
|
+
}
|
16
|
+
|
17
|
+
// Gets called by Denko::reset to clear all listeners.
|
18
|
+
void Denko::spiClearListeners(){
|
19
|
+
for (int i = 0; i < SPI_LISTENER_COUNT; i++) {
|
20
|
+
spiListeners[i].enabled = 0;
|
21
|
+
}
|
22
|
+
}
|
23
|
+
|
24
|
+
void Denko::spiUpdateListeners(){
|
25
|
+
for (byte i = 0; i < SPI_LISTENER_COUNT; i++){
|
26
|
+
switch(spiListeners[i].enabled) {
|
27
|
+
case 1: spiReadListener(i); break;
|
28
|
+
#ifdef DENKO_SPI_BB
|
29
|
+
case 2: spiBBreadListener(i); break;
|
30
|
+
#endif
|
31
|
+
default: break;
|
32
|
+
}
|
33
|
+
}
|
34
|
+
}
|
35
|
+
#endif
|
36
|
+
|
37
|
+
//
|
38
|
+
// Adds hardware SPI support if DENKO_SPI defined in DenkoDefines.h.
|
39
|
+
//
|
40
|
+
#ifdef DENKO_SPI
|
41
|
+
#include <SPI.h>
|
42
|
+
// Convenience wrapper for SPI.begin
|
43
|
+
void Denko::spiBegin(byte settings, uint32_t clockRate) {
|
44
|
+
SPI.begin();
|
45
|
+
|
46
|
+
// SPI mode is the lowest 2 bits of settings.
|
47
|
+
byte mode = settings & 0B00000011;
|
48
|
+
|
49
|
+
// Bit 7 of settings controls bit order. 0 = LSBFIRST, 1 = MSBFIRST.
|
50
|
+
if (bitRead(settings, 7) == 0) {
|
51
|
+
// True integer value for these macros vary by platform, so just do this.
|
52
|
+
switch(mode){
|
53
|
+
case 0: SPI.beginTransaction(SPISettings(clockRate, LSBFIRST, SPI_MODE0)); break;
|
54
|
+
case 1: SPI.beginTransaction(SPISettings(clockRate, LSBFIRST, SPI_MODE1)); break;
|
55
|
+
case 2: SPI.beginTransaction(SPISettings(clockRate, LSBFIRST, SPI_MODE2)); break;
|
56
|
+
case 3: SPI.beginTransaction(SPISettings(clockRate, LSBFIRST, SPI_MODE3)); break;
|
57
|
+
}
|
58
|
+
} else {
|
59
|
+
switch(mode){
|
60
|
+
case 0: SPI.beginTransaction(SPISettings(clockRate, MSBFIRST, SPI_MODE0)); break;
|
61
|
+
case 1: SPI.beginTransaction(SPISettings(clockRate, MSBFIRST, SPI_MODE1)); break;
|
62
|
+
case 2: SPI.beginTransaction(SPISettings(clockRate, MSBFIRST, SPI_MODE2)); break;
|
63
|
+
case 3: SPI.beginTransaction(SPISettings(clockRate, MSBFIRST, SPI_MODE3)); break;
|
64
|
+
}
|
65
|
+
}
|
66
|
+
}
|
67
|
+
|
68
|
+
// Convenience wrapper for SPI.end
|
69
|
+
void Denko::spiEnd() {
|
70
|
+
SPI.endTransaction();
|
71
|
+
// TXRX_SPI in defined for WiFi/Ethernet sketches on AVR chips.
|
72
|
+
// In those cases, SPI.end() can't be called since the network hardware uses it.
|
73
|
+
// ESP32 doesn't like when SPI.end is called either. Might be safe to never do it.
|
74
|
+
#if !defined(TXRX_SPI) && defined(__AVR__)
|
75
|
+
SPI.end();
|
76
|
+
#endif
|
77
|
+
}
|
78
|
+
|
79
|
+
// CMD = 26
|
80
|
+
// Simultaneous read from and write to an SPI device.
|
81
|
+
//
|
82
|
+
// Request format for SPI 2-way transfers
|
83
|
+
// pin = select pin
|
84
|
+
// val = empty
|
85
|
+
// auxMsg[0] = SPI settings
|
86
|
+
// Bit 0..1 = SPI mode
|
87
|
+
// Bit 2..6 = ** unused **
|
88
|
+
// Bit 7 = Read and write bit order: MSBFIRST(1) or LSBFIRST(0)
|
89
|
+
// auxMsg[1] = read length (number of bytes)
|
90
|
+
// auxMsg[2] = write length (number of bytes)
|
91
|
+
// auxMsg[3-6] = clock frequency (uint32_t as 4 bytes)
|
92
|
+
// auxMsg[7+] = data (bytes) (write only)
|
93
|
+
//
|
94
|
+
void Denko::spiTransfer(uint32_t clockRate, uint8_t select, uint8_t settings, uint8_t rLength, uint8_t wLength, byte *data) {
|
95
|
+
spiBegin(settings, clockRate);
|
96
|
+
|
97
|
+
// Stream read bytes as if coming from select pin.
|
98
|
+
if (rLength > 0) {
|
99
|
+
stream->print(select);
|
100
|
+
stream->print(':');
|
101
|
+
}
|
102
|
+
|
103
|
+
// Pull select pin low, treating 255 as no select pin.
|
104
|
+
if (select != 255) {
|
105
|
+
pinMode(select, OUTPUT);
|
106
|
+
digitalWrite(select, LOW);
|
107
|
+
}
|
108
|
+
|
109
|
+
for (byte i = 0; (i < rLength || i < wLength); i++) {
|
110
|
+
byte b;
|
111
|
+
|
112
|
+
if (i < wLength) {
|
113
|
+
b = SPI.transfer(data[i]);
|
114
|
+
} else {
|
115
|
+
b = SPI.transfer(0x00);
|
116
|
+
}
|
117
|
+
|
118
|
+
if (i < rLength) {
|
119
|
+
// Print read byte, then a comma or \n if it's the last read byte.
|
120
|
+
stream->print(b);
|
121
|
+
stream->print((i+1 == rLength) ? '\n' : ',');
|
122
|
+
}
|
123
|
+
}
|
124
|
+
|
125
|
+
// Leave select high, treating 255 as no select pin.
|
126
|
+
if (select != 255) digitalWrite(select, HIGH);
|
127
|
+
|
128
|
+
spiEnd();
|
129
|
+
}
|
130
|
+
|
131
|
+
// CMD = 27
|
132
|
+
// Start listening to a register with hardware SPI.
|
133
|
+
void Denko::spiAddListener() {
|
134
|
+
// Do this since RP2040 crashes with reinterpet_cast of uint32_t.
|
135
|
+
uint32_t clockRate = (uint32_t)auxMsg[3];
|
136
|
+
clockRate |= (uint32_t)auxMsg[4] << 8;
|
137
|
+
clockRate |= (uint32_t)auxMsg[5] << 16;
|
138
|
+
clockRate |= (uint32_t)auxMsg[6] << 24;
|
139
|
+
|
140
|
+
for (int i = 0; i < SPI_LISTENER_COUNT; i++) {
|
141
|
+
if (spiListeners[i].enabled == 0) {
|
142
|
+
spiListeners[i] = {
|
143
|
+
clockRate,
|
144
|
+
pin, // Select pin
|
145
|
+
auxMsg[0], // Settings
|
146
|
+
auxMsg[1], // Read length
|
147
|
+
1 // Enabled = 1 sets hardware SPI listener
|
148
|
+
};
|
149
|
+
return;
|
150
|
+
} else {
|
151
|
+
// Should send some kind of error if all are in use.
|
152
|
+
}
|
153
|
+
}
|
154
|
+
}
|
155
|
+
|
156
|
+
// Called by spiUpdateListeners to read an individual hardware SPI listener.
|
157
|
+
void Denko::spiReadListener(uint8_t i) {
|
158
|
+
spiTransfer(spiListeners[i].clock,
|
159
|
+
spiListeners[i].select,
|
160
|
+
spiListeners[i].settings,
|
161
|
+
spiListeners[i].length,
|
162
|
+
0, // 0 bytes written to output
|
163
|
+
&auxMsg[0]); // Get "write" data from anywhere since not writing
|
164
|
+
}
|
165
|
+
#endif
|
@@ -0,0 +1,156 @@
|
|
1
|
+
//
|
2
|
+
// Adds SPI bitbang functionality to the Denko class if DENKO_SPI_BB defined in DenkoDefines.h.
|
3
|
+
//
|
4
|
+
#include "Denko.h"
|
5
|
+
|
6
|
+
#ifdef DENKO_SPI_BB
|
7
|
+
// CMD = 21
|
8
|
+
//
|
9
|
+
// Request format for bit banged SPI 2-way transfers
|
10
|
+
// pin = select pin
|
11
|
+
// val = empty
|
12
|
+
// auxMsg[0] = SPI settings
|
13
|
+
// Bit 0..1 = SPI mode
|
14
|
+
// Bit 2..6 = ** unused **
|
15
|
+
// Bit 7 = Read and write bit order: MSBFIRST(1) or LSBFIRST(0)
|
16
|
+
// auxMsg[1] = read length (number of bytes)
|
17
|
+
// auxMsg[2] = write length (number of bytes)
|
18
|
+
// auxMsg[3] = clock pin (uint8)
|
19
|
+
// auxMsg[4] = input pin (uint8) - Set to 255 for one-way transfer.
|
20
|
+
// auxMsg[5] = output pin (uint8) - Set to 255 for one-way transfer.
|
21
|
+
// auxMsg[6] = ** unused **
|
22
|
+
// auxMsg[7+] = data (bytes) (write only) - Start from 7 for parity with hardware SPI.
|
23
|
+
//
|
24
|
+
void Denko::spiBBtransfer( uint8_t clock, uint8_t input, uint8_t output, uint8_t select, uint8_t settings,
|
25
|
+
uint8_t rLength, uint8_t wLength, byte *data) {
|
26
|
+
|
27
|
+
// Mode is the lowest 2 bits of settings.
|
28
|
+
uint8_t mode = settings & 0b00000011;
|
29
|
+
|
30
|
+
// Bit order is stored in the highest bit of settings.
|
31
|
+
uint8_t bitOrder = bitRead(settings, 7);
|
32
|
+
|
33
|
+
// Set modes for input and output pins.
|
34
|
+
// Use a pin number of 255 to avoid touching either.
|
35
|
+
if (output < 255) pinMode(output, OUTPUT);
|
36
|
+
if (input < 255) pinMode(input, INPUT);
|
37
|
+
|
38
|
+
// Set idle state of clock pin based on SPI mode.
|
39
|
+
pinMode(clock, OUTPUT);
|
40
|
+
if ((mode == 0)||(mode == 1)) digitalWrite(clock, LOW);
|
41
|
+
if ((mode == 2)||(mode == 3)) digitalWrite(clock, LOW);
|
42
|
+
|
43
|
+
// Stream read bytes as if coming from select pin.
|
44
|
+
if (rLength > 0) {
|
45
|
+
stream->print(select);
|
46
|
+
stream->print(':');
|
47
|
+
}
|
48
|
+
|
49
|
+
// Pull select pin low, treating 255 as no select pin.
|
50
|
+
if (select != 255) {
|
51
|
+
pinMode(select, OUTPUT);
|
52
|
+
digitalWrite(select, LOW);
|
53
|
+
}
|
54
|
+
|
55
|
+
for (byte i = 0; (i < rLength || i < wLength); i++) {
|
56
|
+
byte b;
|
57
|
+
|
58
|
+
if (i < wLength) {
|
59
|
+
b = spiBBtransferByte(clock, input, output, select, mode, bitOrder, data[i]);
|
60
|
+
} else {
|
61
|
+
b = spiBBtransferByte(clock, input, output, select, mode, bitOrder, 0x00);
|
62
|
+
}
|
63
|
+
|
64
|
+
if (i < rLength) {
|
65
|
+
// Print read byte, then a comma or \n if it's the last read byte.
|
66
|
+
stream->print(b);
|
67
|
+
stream->print((i+1 == rLength) ? '\n' : ',');
|
68
|
+
}
|
69
|
+
}
|
70
|
+
|
71
|
+
// Leave select high, treating 255 as no select pin.
|
72
|
+
if (select != 255) digitalWrite(select, HIGH);
|
73
|
+
}
|
74
|
+
|
75
|
+
//
|
76
|
+
// Used by spiBBtransfer to transfer a single byte at a time.
|
77
|
+
//
|
78
|
+
byte Denko::spiBBtransferByte(uint8_t clock, uint8_t input, uint8_t output, uint8_t select, uint8_t mode, uint8_t bitOrder, byte data) {
|
79
|
+
// Byte to return
|
80
|
+
byte b = 0x00;
|
81
|
+
|
82
|
+
// Track which of the 8 bits we're on.
|
83
|
+
uint8_t bitPos;
|
84
|
+
|
85
|
+
// Read and write 8 bits.
|
86
|
+
for (int i=0; i<8; i++) {
|
87
|
+
// Set which bit index is being read and written based on i and bit orders.
|
88
|
+
if (bitOrder == 0) { bitPos = i; } else { bitPos = 7 - i; }
|
89
|
+
|
90
|
+
// SPI MODE 0
|
91
|
+
if (mode == 0){
|
92
|
+
if (output < 255) digitalWrite(output, bitRead(data, bitPos));
|
93
|
+
digitalWrite(clock, HIGH);
|
94
|
+
if (input < 255) bitWrite(b, bitPos, digitalRead(input));
|
95
|
+
digitalWrite(clock, LOW);
|
96
|
+
}
|
97
|
+
|
98
|
+
// SPI MODE 1
|
99
|
+
if (mode == 1){
|
100
|
+
digitalWrite(clock, HIGH);
|
101
|
+
if (output < 255) digitalWrite(output, bitRead(data, bitPos));
|
102
|
+
digitalWrite(clock, LOW);
|
103
|
+
if (input < 255) bitWrite(b, bitPos, digitalRead(input));
|
104
|
+
}
|
105
|
+
|
106
|
+
// SPI MODE 2
|
107
|
+
if (mode == 2){
|
108
|
+
if (output < 255) digitalWrite(output, bitRead(data, bitPos));
|
109
|
+
digitalWrite(clock, LOW);
|
110
|
+
if (input < 255) bitWrite(b, bitPos, digitalRead(input));
|
111
|
+
digitalWrite(clock, HIGH);
|
112
|
+
}
|
113
|
+
|
114
|
+
// SPI MODE 3
|
115
|
+
if (mode == 3){
|
116
|
+
digitalWrite(clock, LOW);
|
117
|
+
if (output < 255) digitalWrite(output, bitRead(data, bitPos));
|
118
|
+
digitalWrite(clock, HIGH);
|
119
|
+
if (input < 255) bitWrite(b, bitPos, digitalRead(input));
|
120
|
+
}
|
121
|
+
}
|
122
|
+
return b;
|
123
|
+
}
|
124
|
+
|
125
|
+
// CMD = 22
|
126
|
+
// Start listening to a register with bit bang SPI.
|
127
|
+
void Denko::spiBBaddListener() {
|
128
|
+
for (int i = 0; i < SPI_LISTENER_COUNT; i++) {
|
129
|
+
// Overwrite the first disabled listener in the struct array.
|
130
|
+
if (spiListeners[i].enabled == 0) {
|
131
|
+
spiListeners[i] = {
|
132
|
+
((uint32_t)(auxMsg[4] << 8) | auxMsg[3]), // Clock: [0..7], input: [8..15]
|
133
|
+
pin, // Select pin
|
134
|
+
auxMsg[0], // Settings mask
|
135
|
+
auxMsg[1], // Read length
|
136
|
+
2 // Enabled = 2 sets bit bang SPI listener
|
137
|
+
};
|
138
|
+
return;
|
139
|
+
} else {
|
140
|
+
// Should send some kind of error if all are in use.
|
141
|
+
}
|
142
|
+
}
|
143
|
+
}
|
144
|
+
|
145
|
+
// Called by spiUpdateListeners to read an individual bit bang SPI listener.
|
146
|
+
void Denko::spiBBreadListener(uint8_t i) {
|
147
|
+
spiBBtransfer((spiListeners[i].clock & 0xFF), // Clock pin is bits [0..7] of the uint32
|
148
|
+
((spiListeners[i].clock >> 8) & 0xFF), // Input pin is bits [8..15] of the uint32
|
149
|
+
255, // Disabled output pin
|
150
|
+
spiListeners[i].select, // Select pin
|
151
|
+
spiListeners[i].settings,
|
152
|
+
spiListeners[i].length, // Read length
|
153
|
+
0, // 0 bytes written to output
|
154
|
+
&auxMsg[0]); // Get "write" data from anywhere since not writing
|
155
|
+
}
|
156
|
+
#endif
|
@@ -0,0 +1,83 @@
|
|
1
|
+
//
|
2
|
+
// This file adds to the Denko class only if DENKO_SERVO is defined in Denko.h.
|
3
|
+
//
|
4
|
+
#include "Denko.h"
|
5
|
+
#ifdef DENKO_SERVO
|
6
|
+
|
7
|
+
#ifdef ESP32
|
8
|
+
#include <ESP32Servo.h>
|
9
|
+
#else
|
10
|
+
#include <Servo.h>
|
11
|
+
#endif
|
12
|
+
|
13
|
+
// 12 servos on most boards. 6 on the ATmega168.
|
14
|
+
// Could be up to 48 on Arduino Mega.
|
15
|
+
#if defined (__AVR_ATmega168__)
|
16
|
+
#define SERVO_COUNT 6
|
17
|
+
#elif defined(ESP32)
|
18
|
+
#define SERVO_COUNT 16
|
19
|
+
#else
|
20
|
+
#define SERVO_COUNT 12
|
21
|
+
#endif
|
22
|
+
|
23
|
+
// Create an array of wrapper structs that link pins to servo objects.
|
24
|
+
struct ServoWrapper{
|
25
|
+
byte pin;
|
26
|
+
boolean active;
|
27
|
+
Servo servo;
|
28
|
+
};
|
29
|
+
ServoWrapper servos[SERVO_COUNT];
|
30
|
+
|
31
|
+
// CMD = 08
|
32
|
+
// Attach a free servo object to the specified pin.
|
33
|
+
void Denko::servoToggle() {
|
34
|
+
// Search by pin for in use servo object, detatch and set inactive.
|
35
|
+
if (val == 0) {
|
36
|
+
for (int i = 0; i < SERVO_COUNT; i++) {
|
37
|
+
if (servos[i].pin == pin) {
|
38
|
+
servos[i].servo.detach();
|
39
|
+
servos[i].active = false;
|
40
|
+
}
|
41
|
+
}
|
42
|
+
}
|
43
|
+
// Search by pin for in use servo object, attach and set active.
|
44
|
+
else {
|
45
|
+
boolean found = false;
|
46
|
+
uint16_t min = (auxMsg[1] << 8) | auxMsg[0];
|
47
|
+
uint16_t max = (auxMsg[3] << 8) | auxMsg[2];
|
48
|
+
|
49
|
+
for (int i = 0; i < SERVO_COUNT; i++) {
|
50
|
+
if (servos[i].pin == pin) {
|
51
|
+
found = true;
|
52
|
+
servos[i].servo.attach(pin, min, max);
|
53
|
+
servos[i].active = true;
|
54
|
+
break;
|
55
|
+
}
|
56
|
+
}
|
57
|
+
// If it doesn't exist, use the first inactive object.
|
58
|
+
if (found == false) {
|
59
|
+
for (int i = 0; i < SERVO_COUNT; i++) {
|
60
|
+
if (servos[i].active == false) {
|
61
|
+
servos[i].servo.attach(pin, min, max);
|
62
|
+
servos[i].active = true;
|
63
|
+
servos[i].pin = pin;
|
64
|
+
break;
|
65
|
+
}
|
66
|
+
}
|
67
|
+
}
|
68
|
+
}
|
69
|
+
}
|
70
|
+
|
71
|
+
// CMD = 09
|
72
|
+
// Write a value to the servo object.
|
73
|
+
void Denko::servoWrite() {
|
74
|
+
// Find servo by pin and write value to it.
|
75
|
+
for (int i = 0; i < SERVO_COUNT; i++) {
|
76
|
+
if (servos[i].pin == pin) {
|
77
|
+
uint16_t us = (auxMsg[1] << 8) | auxMsg[0];
|
78
|
+
servos[i].servo.writeMicroseconds(us);
|
79
|
+
}
|
80
|
+
}
|
81
|
+
}
|
82
|
+
|
83
|
+
#endif
|