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
data/src/lib/Denko.cpp
ADDED
@@ -0,0 +1,330 @@
|
|
1
|
+
/*
|
2
|
+
Library for denko ruby gem.
|
3
|
+
*/
|
4
|
+
#include "Denko.h"
|
5
|
+
#include "BoardMap.h"
|
6
|
+
|
7
|
+
Denko::Denko(){
|
8
|
+
messageFragments[0] = cmdStr;
|
9
|
+
messageFragments[1] = pinStr;
|
10
|
+
messageFragments[2] = valStr;
|
11
|
+
messageFragments[3] = auxMsg;
|
12
|
+
resetState();
|
13
|
+
}
|
14
|
+
|
15
|
+
void Denko::rxNotify() {
|
16
|
+
stream->print("Rx:");
|
17
|
+
stream->print(rxBytes);
|
18
|
+
stream->print("\n");
|
19
|
+
rxBytes = 0;
|
20
|
+
}
|
21
|
+
|
22
|
+
void Denko::sendHalt() {
|
23
|
+
stream->print("Hlt");
|
24
|
+
stream->print("\n");
|
25
|
+
}
|
26
|
+
|
27
|
+
// CMD = 92
|
28
|
+
// Expose this for diagnostics and testing.
|
29
|
+
void Denko::sendReady() {
|
30
|
+
stream->print("Rdy");
|
31
|
+
stream->print("\n");
|
32
|
+
}
|
33
|
+
|
34
|
+
void Denko::run(){
|
35
|
+
while(stream->available()) {
|
36
|
+
parse(stream->read());
|
37
|
+
rxBytes ++;
|
38
|
+
// Acknowledge when we've received half as many bytes as the serial buffer.
|
39
|
+
if (rxBytes >= rxNotifyLimit) rxNotify();
|
40
|
+
}
|
41
|
+
|
42
|
+
#ifdef DENKO_UARTS
|
43
|
+
uartUpdateListeners();
|
44
|
+
#endif
|
45
|
+
|
46
|
+
#ifdef DENKO_UART_BB
|
47
|
+
uartBBUpdateListener();
|
48
|
+
#endif
|
49
|
+
|
50
|
+
// Run denko's listeners.
|
51
|
+
updateListeners();
|
52
|
+
}
|
53
|
+
|
54
|
+
void Denko::parse(byte c) {
|
55
|
+
if ((c == '\n') || (c == '\\')) {
|
56
|
+
// If last char was a \, this \ or \n is escaped.
|
57
|
+
if(escaping){
|
58
|
+
append(c);
|
59
|
+
escaping = false;
|
60
|
+
}
|
61
|
+
|
62
|
+
// If EOL, process and reset.
|
63
|
+
else if (c == '\n'){
|
64
|
+
append('\0');
|
65
|
+
if ((fragmentIndex > 0) || (charIndex > 1)) process();
|
66
|
+
fragmentIndex = 0;
|
67
|
+
charIndex = 0;
|
68
|
+
}
|
69
|
+
|
70
|
+
// Backslash is the escape character.
|
71
|
+
else if (c == '\\') escaping = true;
|
72
|
+
}
|
73
|
+
|
74
|
+
// If fragment delimiter, terminate current fragment and move to next.
|
75
|
+
// Unless we're in the auxillary message fragment, then just append.
|
76
|
+
else if (c == '.') {
|
77
|
+
if (fragmentIndex < 3) {
|
78
|
+
escaping = false;
|
79
|
+
append('\0');
|
80
|
+
fragmentIndex++;
|
81
|
+
charIndex = 0;
|
82
|
+
} else {
|
83
|
+
append(c);
|
84
|
+
}
|
85
|
+
}
|
86
|
+
|
87
|
+
// Else just append the character.
|
88
|
+
else {
|
89
|
+
escaping = false;
|
90
|
+
append(c);
|
91
|
+
}
|
92
|
+
}
|
93
|
+
|
94
|
+
void Denko::append(byte c) {
|
95
|
+
messageFragments[fragmentIndex][charIndex] = c;
|
96
|
+
charIndex++;
|
97
|
+
}
|
98
|
+
|
99
|
+
void Denko::process() {
|
100
|
+
cmd = atoi((char *)cmdStr);
|
101
|
+
pin = atoi((char *)pinStr);
|
102
|
+
val = atoi((char *)valStr);
|
103
|
+
|
104
|
+
// Call the command.
|
105
|
+
switch(cmd) {
|
106
|
+
// Implemented in DenkoCoreIO.cpp
|
107
|
+
case 0: setMode (pin, val); break;
|
108
|
+
case 1: dWrite (pin, val, false); break;
|
109
|
+
case 2: dRead (pin); break;
|
110
|
+
case 3: pwmWrite (pin, val, false); break;
|
111
|
+
case 4: dacWrite (pin, val, false); break;
|
112
|
+
case 5: aRead (pin); break;
|
113
|
+
case 6: setListener (pin, val, auxMsg[0], auxMsg[1], false); break;
|
114
|
+
|
115
|
+
// Implemented in DenkoEEPROM.cpp
|
116
|
+
#ifdef EEPROM_PRESENT
|
117
|
+
case 7: eepromRead (); break;
|
118
|
+
case 8: eepromWrite (); break;
|
119
|
+
#endif
|
120
|
+
|
121
|
+
// Implemented in DenkoPulseInput.cpp
|
122
|
+
case 9: pulseRead (); break;
|
123
|
+
|
124
|
+
// Implemented in DenkoServo.cpp
|
125
|
+
#ifdef DENKO_SERVO
|
126
|
+
case 10: servoToggle (); break;
|
127
|
+
case 11: servoWrite (); break;
|
128
|
+
#endif
|
129
|
+
|
130
|
+
// Implemented in DenkoSerialBB.cpp
|
131
|
+
#ifdef DENKO_UART_BB
|
132
|
+
case 12: uartBBSetup (); break;
|
133
|
+
case 13: uartBBWrite (); break;
|
134
|
+
#endif
|
135
|
+
|
136
|
+
// Implemented in DenkoUART.cpp
|
137
|
+
#ifdef DENKO_UARTS
|
138
|
+
case 14: uartSetup (); break;
|
139
|
+
case 15: uartWrite (); break;
|
140
|
+
#endif
|
141
|
+
|
142
|
+
// Implemented in DenkoIROut.cpp
|
143
|
+
#ifdef DENKO_IR_OUT
|
144
|
+
case 16: irSend (); break;
|
145
|
+
#endif
|
146
|
+
|
147
|
+
// Implemented in DenkoTone.cpp
|
148
|
+
#ifdef DENKO_TONE
|
149
|
+
case 17: tone (); break;
|
150
|
+
case 18: noTone (); break;
|
151
|
+
#endif
|
152
|
+
|
153
|
+
// Implemented in DenkoAddressableLED.cppp
|
154
|
+
#ifdef DENKO_LED_ARRAY
|
155
|
+
case 19: showLEDArray (); //cmd = 19
|
156
|
+
#endif
|
157
|
+
|
158
|
+
// Implemented in DenkoSPIBB.cpp
|
159
|
+
#ifdef DENKO_SPI_BB
|
160
|
+
case 21: spiBBtransfer (auxMsg[3], auxMsg[4], auxMsg[5], pin, auxMsg[0], auxMsg[1], auxMsg[2], &auxMsg[7]); break;
|
161
|
+
case 22: spiBBaddListener (); break;
|
162
|
+
#endif
|
163
|
+
|
164
|
+
// Implemented in DenkoSPI.cpp
|
165
|
+
#ifdef DENKO_SPI
|
166
|
+
case 26: {
|
167
|
+
// Do this since RP2040 crashes with reinterpet_cast of uint32_t.
|
168
|
+
uint32_t clockRate = (uint32_t)auxMsg[3];
|
169
|
+
clockRate |= (uint32_t)auxMsg[4] << 8;
|
170
|
+
clockRate |= (uint32_t)auxMsg[5] << 16;
|
171
|
+
clockRate |= (uint32_t)auxMsg[6] << 24;
|
172
|
+
spiTransfer(clockRate, pin, auxMsg[0], auxMsg[1], auxMsg[2], &auxMsg[7]); break;
|
173
|
+
}
|
174
|
+
case 27: spiAddListener (); break;
|
175
|
+
#endif
|
176
|
+
|
177
|
+
// Implemented in DenkoSPI.cpp
|
178
|
+
#if defined(DENKO_SPI) || defined(DENKO_SPI_BB)
|
179
|
+
case 28: spiRemoveListener(); break;
|
180
|
+
#endif
|
181
|
+
|
182
|
+
// Implemented in DenkoI2C.cpp
|
183
|
+
#ifdef DENKO_I2C
|
184
|
+
case 33: i2cSearch (); break;
|
185
|
+
case 34: i2cWrite (); break;
|
186
|
+
case 35: i2cRead (); break;
|
187
|
+
#endif
|
188
|
+
|
189
|
+
// Implemented in DenkoOneWire.cpp
|
190
|
+
#ifdef DENKO_ONE_WIRE
|
191
|
+
case 41: owReset (); break;
|
192
|
+
case 42: owSearch (); break;
|
193
|
+
case 43: owWrite (); break;
|
194
|
+
case 44: owRead (); break;
|
195
|
+
#endif
|
196
|
+
|
197
|
+
// Implemented in this file.
|
198
|
+
case 90: handshake (); break;
|
199
|
+
case 91: resetState (); break;
|
200
|
+
case 92: sendReady (); break;
|
201
|
+
case 95: setRegisterDivider (); break;
|
202
|
+
case 96: setAnalogWriteResolution (); break;
|
203
|
+
case 97: setAnalogReadResolution (); break;
|
204
|
+
case 99: microDelay(*reinterpret_cast<uint16_t*>(auxMsg)); break;
|
205
|
+
|
206
|
+
// Should send a "feature not implemented" message as default.
|
207
|
+
default: break;
|
208
|
+
}
|
209
|
+
}
|
210
|
+
|
211
|
+
//
|
212
|
+
// Every 1000 microseconds count a tick and call the listeners.
|
213
|
+
// Each core listener has its own divider, so it can read every
|
214
|
+
// 1, 2, 4, 8, 16, 32, 64 or 128 ticks, independent of the others.
|
215
|
+
//
|
216
|
+
// Register listeners are still on a global divider for now.
|
217
|
+
// Analog and register listeners always send values even if not changed.
|
218
|
+
// Digital listeners only send values on change.
|
219
|
+
//
|
220
|
+
void Denko::updateListeners() {
|
221
|
+
currentTime = micros();
|
222
|
+
timeDiff = currentTime - lastTime;
|
223
|
+
|
224
|
+
if (timeDiff > 999) {
|
225
|
+
// Add a tick for every 1000us passed.
|
226
|
+
tickCount = tickCount + (timeDiff / 1000);
|
227
|
+
|
228
|
+
// lastTime for next run is currentTime offset by remainder.
|
229
|
+
lastTime = currentTime - (timeDiff % 1000);
|
230
|
+
|
231
|
+
updateCoreListeners();
|
232
|
+
|
233
|
+
// SPI register Listeners
|
234
|
+
#if defined(DENKO_SPI) || defined(DENKO_SPI_BB)
|
235
|
+
if (tickCount % registerDivider == 0) spiUpdateListeners();
|
236
|
+
#endif
|
237
|
+
}
|
238
|
+
}
|
239
|
+
|
240
|
+
// CMD = 90
|
241
|
+
void Denko::handshake() {
|
242
|
+
// Reset the I2C interface.
|
243
|
+
// Some boards (like the ESP32-S2) behave badly without this.
|
244
|
+
#ifdef DENKO_I2C
|
245
|
+
i2cEnd();
|
246
|
+
#endif
|
247
|
+
|
248
|
+
// Reset all the state variables.
|
249
|
+
resetState();
|
250
|
+
|
251
|
+
// Reset this so we never send Rx along with ACK:
|
252
|
+
rxBytes = 0;
|
253
|
+
|
254
|
+
// First handshake value is BOARD_MAP if set.
|
255
|
+
stream->print("ACK:");
|
256
|
+
#ifdef BOARD_MAP
|
257
|
+
stream->print(BOARD_MAP);
|
258
|
+
#endif
|
259
|
+
|
260
|
+
// Second is DENKO_VERSION.
|
261
|
+
stream->print(',');
|
262
|
+
#ifdef DENKO_VERSION
|
263
|
+
stream->print(DENKO_VERSION);
|
264
|
+
#endif
|
265
|
+
|
266
|
+
// Third is AUX_SIZE.
|
267
|
+
stream->print(',');
|
268
|
+
stream->print(AUX_SIZE);
|
269
|
+
|
270
|
+
// Fourth is EEPROM size in bytes. None on Due or Zero.
|
271
|
+
stream->print(',');
|
272
|
+
#if defined(EEPROM_EMULATED)
|
273
|
+
stream->print(EMULATED_EEPROM_LENGTH);
|
274
|
+
#elif defined(EEPROM_PRESENT)
|
275
|
+
stream->print(EEPROM.length());
|
276
|
+
#else
|
277
|
+
stream->print('0');
|
278
|
+
#endif
|
279
|
+
|
280
|
+
// End
|
281
|
+
stream->print('\n');
|
282
|
+
}
|
283
|
+
|
284
|
+
// CMD = 91
|
285
|
+
void Denko::resetState() {
|
286
|
+
clearCoreListeners();
|
287
|
+
#if defined(DENKO_SPI) || defined(DENKO_SPI_BB)
|
288
|
+
spiClearListeners();
|
289
|
+
#endif
|
290
|
+
#ifdef ESP32
|
291
|
+
clearLedcChannels();
|
292
|
+
#endif
|
293
|
+
registerDivider = 8; // Update register listeners every ~8ms.
|
294
|
+
fragmentIndex = 0;
|
295
|
+
charIndex = 0;
|
296
|
+
tickCount = 0;
|
297
|
+
lastTime = micros();
|
298
|
+
}
|
299
|
+
|
300
|
+
// CMD = 95
|
301
|
+
// Set the register read divider. Powers of 2 up to 128 are valid.
|
302
|
+
void Denko::setRegisterDivider() {
|
303
|
+
registerDivider = val;
|
304
|
+
}
|
305
|
+
|
306
|
+
// CMD = 96
|
307
|
+
// Set the analog write resolution.
|
308
|
+
void Denko::setAnalogWriteResolution() {
|
309
|
+
#ifdef WRITE_RESOLUTION_SETTER
|
310
|
+
analogWriteResolution(val);
|
311
|
+
#endif
|
312
|
+
}
|
313
|
+
|
314
|
+
// CMD = 97
|
315
|
+
// Set the analog read resolution.
|
316
|
+
void Denko::setAnalogReadResolution() {
|
317
|
+
#ifdef READ_RESOLUTION_SETTER
|
318
|
+
analogReadResolution(val);
|
319
|
+
#endif
|
320
|
+
}
|
321
|
+
|
322
|
+
// CMD = 99
|
323
|
+
// Use a different blocking microsecond delay on different platforms.
|
324
|
+
void Denko::microDelay(uint32_t microseconds){
|
325
|
+
#if defined(ESP32)
|
326
|
+
ets_delay_us(microseconds);
|
327
|
+
#else
|
328
|
+
delayMicroseconds(microseconds);
|
329
|
+
#endif
|
330
|
+
}
|
data/src/lib/Denko.h
ADDED
@@ -0,0 +1,259 @@
|
|
1
|
+
/*
|
2
|
+
Library for denko ruby gem.
|
3
|
+
*/
|
4
|
+
#include <Arduino.h>
|
5
|
+
#include "DenkoDefines.h"
|
6
|
+
|
7
|
+
class Denko {
|
8
|
+
public:
|
9
|
+
Denko();
|
10
|
+
void run();
|
11
|
+
|
12
|
+
// Expect main sketch to pass a reference to a Stream-like object for IO.
|
13
|
+
// Store it and call ->print, ->write, ->available, ->read etc. on it.
|
14
|
+
Stream* stream;
|
15
|
+
|
16
|
+
// Callback hooks for local logic (defined in main sketch) based on listeners.
|
17
|
+
// These should be used if:
|
18
|
+
// 1) a round-trip to the remote client is too slow, or
|
19
|
+
// 2) something needs to happen regardless of remote client connection.
|
20
|
+
// Eg. Instant feedback from a smart light switch.
|
21
|
+
void (*digitalListenCallback)(byte p, byte v);
|
22
|
+
void (*analogListenCallback)(byte p, int v);
|
23
|
+
|
24
|
+
// Core IO API Functions
|
25
|
+
// Functions with a cmd value can be called through the remote API.
|
26
|
+
//
|
27
|
+
// This subset is made public to allow use by local listener callbacks.
|
28
|
+
// Reading and writing through the denko library can help maintain
|
29
|
+
// consistency and notify the remote client of local actions automatically.
|
30
|
+
//
|
31
|
+
void setMode (byte p, byte m); //cmd = 0
|
32
|
+
void dWrite (byte p, byte v, boolean echo=true); //cmd = 1
|
33
|
+
byte dRead (byte p); //cmd = 2
|
34
|
+
void pwmWrite (byte p, int v, boolean echo=true); //cmd = 3
|
35
|
+
void dacWrite (byte p, int v, boolean echo=true); //cmd = 4
|
36
|
+
int aRead (byte p); //cmd = 5
|
37
|
+
void setListener (byte p, boolean enabled, byte analog, byte exponent, boolean local=true); //cmd = 6
|
38
|
+
|
39
|
+
// Read value of micros() every loop.
|
40
|
+
unsigned long currentTime;
|
41
|
+
|
42
|
+
// Counts 1ms ticks based on currentTime. Rolls over every 256ms.
|
43
|
+
byte tickCount;
|
44
|
+
|
45
|
+
private:
|
46
|
+
//
|
47
|
+
// Main loop listen functions.
|
48
|
+
//
|
49
|
+
void updateListeners ();
|
50
|
+
void updateCoreListeners ();
|
51
|
+
void analogListenerUpdate (byte index);
|
52
|
+
void digitalListenerUpdate (byte index);
|
53
|
+
void clearCoreListeners ();
|
54
|
+
void findLastActiveListener();
|
55
|
+
|
56
|
+
//
|
57
|
+
// Tanslating aWrite to ledcWrite for PWM out on the ESP32.
|
58
|
+
//
|
59
|
+
// Track which pin is assigned to each LEDC channel.
|
60
|
+
// Byte 0 = enabled or disabled
|
61
|
+
// Byte 1 = pin number attached to that channel
|
62
|
+
//
|
63
|
+
#ifdef ESP32
|
64
|
+
byte ledcPins[LEDC_CHANNEL_COUNT][2];
|
65
|
+
byte ledcChannel(byte p);
|
66
|
+
byte assignLEDC(byte channel, byte pin);
|
67
|
+
void releaseLEDC(byte p);
|
68
|
+
void clearLedcChannels();
|
69
|
+
#endif
|
70
|
+
|
71
|
+
//
|
72
|
+
// Store listeners as a 2 dimensional array where each gets 2 bytes:
|
73
|
+
//
|
74
|
+
// byte 0, bit 7 : 1 = enabled, 0 = disabled
|
75
|
+
// byte 0, bit 6 : 1 = analog, 0 = digital
|
76
|
+
// byte 0, bit 5 : digital listener state storage
|
77
|
+
// byte 0, bit 4 : local flag (remote client cannot modify listener if set)
|
78
|
+
// byte 0, bit 3 : unused
|
79
|
+
// byte 0, bits 2-0: timing divider exponent (2^0 through 2^7)
|
80
|
+
//
|
81
|
+
// byte 1 : pin number
|
82
|
+
//
|
83
|
+
byte listeners [PIN_COUNT][2];
|
84
|
+
|
85
|
+
// Track the highest number listener that's active.
|
86
|
+
byte lastActiveListener;
|
87
|
+
// Map 2's exponents for dividers to save time.
|
88
|
+
const byte dividerMap[8] = {1, 2, 4, 8, 16, 32, 64, 128};
|
89
|
+
|
90
|
+
// Response func for features following the pin:value pattern.
|
91
|
+
void coreResponse(int p, int v);
|
92
|
+
|
93
|
+
// Functions with a cmd value can be called through the remote API.
|
94
|
+
// EEPROM Access
|
95
|
+
void eepromRead (); //cmd = 7
|
96
|
+
void eepromWrite (); //cmd = 8
|
97
|
+
|
98
|
+
// Included Libraries
|
99
|
+
void pulseRead (); //cmd = 9
|
100
|
+
void servoToggle (); //cmd = 10
|
101
|
+
void servoWrite (); //cmd = 11
|
102
|
+
void handleSerial (); //cmd = 12
|
103
|
+
|
104
|
+
// Single Bit Bang UART
|
105
|
+
#ifdef DENKO_UART_BB
|
106
|
+
SoftwareSerial uartBB = SoftwareSerial(10,11);
|
107
|
+
uint8_t uartBBTx;
|
108
|
+
uint8_t uartBBRx;
|
109
|
+
bool uartBBListen = false;
|
110
|
+
|
111
|
+
void uartBBBegin (uint32_t baud);
|
112
|
+
void uartBBEnd ();
|
113
|
+
void uartBBSetup (); //cmd = 12
|
114
|
+
void uartBBWrite (); //cmd = 13
|
115
|
+
void uartBBUpdateListener ();
|
116
|
+
#endif
|
117
|
+
|
118
|
+
// Up to 3 extra hardware UARTs
|
119
|
+
#ifdef DENKO_UARTS
|
120
|
+
HardwareSerial* uarts[DENKO_UARTS+1];
|
121
|
+
bool uartListenStates[DENKO_UARTS+1];
|
122
|
+
byte uartRxPins[DENKO_UARTS+1];
|
123
|
+
|
124
|
+
void uartBegin (uint8_t index, uint32_t baud);
|
125
|
+
void uartEnd (uint8_t index);
|
126
|
+
void uartSetup (); //cmd = 14
|
127
|
+
void uartWrite (); //cmd = 15
|
128
|
+
void uartUpdateListeners ();
|
129
|
+
#endif
|
130
|
+
|
131
|
+
void irSend (); //cmd = 16
|
132
|
+
void tone (); //cmd = 17
|
133
|
+
void noTone (); //cmd = 18
|
134
|
+
void showLEDArray (); //cmd = 19
|
135
|
+
|
136
|
+
// Bit Bang SPI
|
137
|
+
void spiBBtransfer (uint8_t clock, uint8_t input, uint8_t output, uint8_t select, uint8_t settings,
|
138
|
+
uint8_t rLength, uint8_t wLength, byte *data); //cmd = 21
|
139
|
+
byte spiBBtransferByte (uint8_t clock, uint8_t input, uint8_t output, uint8_t select,
|
140
|
+
uint8_t mode, uint8_t bitOrder, byte data);
|
141
|
+
void spiBBaddListener (); //cmd = 22
|
142
|
+
void spiBBreadListener (uint8_t i);
|
143
|
+
|
144
|
+
// Hardware SPI
|
145
|
+
void spiBegin (byte settings, uint32_t clockRate);
|
146
|
+
void spiEnd ();
|
147
|
+
void spiTransfer (uint32_t clockRate, uint8_t select, uint8_t settings, uint8_t rLength, uint8_t wLength, byte *data); //cmd = 26
|
148
|
+
void spiAddListener (); //cmd = 27
|
149
|
+
void spiReadListener (uint8_t i);
|
150
|
+
|
151
|
+
// SPI Listeners (both hardware and bit bang)
|
152
|
+
void spiRemoveListener (); //cmd = 28
|
153
|
+
void spiUpdateListeners ();
|
154
|
+
void spiClearListeners ();
|
155
|
+
|
156
|
+
// I2C
|
157
|
+
void i2cBegin ();
|
158
|
+
void i2cEnd ();
|
159
|
+
void i2cSetSpeed (uint8_t code);
|
160
|
+
void i2cSearch (); //cmd = 33
|
161
|
+
void i2cWrite (); //cmd = 34
|
162
|
+
void i2cRead (); //cmd = 35
|
163
|
+
void i2cTransfer (); //cmd = 36
|
164
|
+
|
165
|
+
// One Wire
|
166
|
+
void owReset (); //cmd = 41
|
167
|
+
void owSearch (); //cmd = 42
|
168
|
+
void owWrite (); //cmd = 43
|
169
|
+
void owRead (); //cmd = 44
|
170
|
+
void owWriteBit (byte b);
|
171
|
+
byte owReadBit ();
|
172
|
+
|
173
|
+
//
|
174
|
+
// Board level timings, resolutions and reset.
|
175
|
+
//
|
176
|
+
void handshake (); //cmd = 90
|
177
|
+
void resetState (); //cmd = 91
|
178
|
+
void setRegisterDivider (); //cmd = 97
|
179
|
+
void setAnalogWriteResolution (); //cmd = 96
|
180
|
+
void setAnalogReadResolution (); //cmd = 97
|
181
|
+
void microDelay(uint32_t microseconds); //cmd = 99, Platform specific microsecond delay
|
182
|
+
unsigned long lastTime;
|
183
|
+
unsigned long timeDiff;
|
184
|
+
byte registerDivider;
|
185
|
+
|
186
|
+
//
|
187
|
+
// Main loop input functions.
|
188
|
+
//
|
189
|
+
void parse(byte c);
|
190
|
+
void process();
|
191
|
+
|
192
|
+
// Parser state storage and utility functions.
|
193
|
+
byte *messageFragments[4];
|
194
|
+
byte fragmentIndex;
|
195
|
+
int charIndex;
|
196
|
+
boolean escaping;
|
197
|
+
void append(byte c);
|
198
|
+
|
199
|
+
// Parsed message storage.
|
200
|
+
byte cmdStr[4]; byte cmd;
|
201
|
+
byte pinStr[4]; byte pin;
|
202
|
+
byte valStr[4]; byte val;
|
203
|
+
byte auxMsg[AUX_SIZE];
|
204
|
+
|
205
|
+
//
|
206
|
+
// Flow control stuff.
|
207
|
+
//
|
208
|
+
// Notify the computer when the board has received half a serial buffer of bytes.
|
209
|
+
//
|
210
|
+
void rxNotify();
|
211
|
+
uint8_t rxBytes = 0;
|
212
|
+
//
|
213
|
+
// ESP32 uses a 128 byte FIFO buffer for UART Rx. Notify every 63 bytes instead of 32
|
214
|
+
// so serial over native USB performs better.
|
215
|
+
//
|
216
|
+
// Using 63 instead of 64 since the ATmega32u4 (Leonardo) is limited to 63.
|
217
|
+
//
|
218
|
+
#ifdef ESP32
|
219
|
+
uint8_t rxNotifyLimit = 63;
|
220
|
+
#else
|
221
|
+
uint8_t rxNotifyLimit = 32;
|
222
|
+
#endif
|
223
|
+
|
224
|
+
//
|
225
|
+
// Tell the computer to halt or resume sending data to the board.
|
226
|
+
//
|
227
|
+
// Only use these if running a function on the board that disables interrupts for
|
228
|
+
// longer than a single serial character (~85us at 115,200 baud).
|
229
|
+
//
|
230
|
+
// If the function was initiated by the computer (eg. writing to a WS2812 strip), do
|
231
|
+
// not call sendHalt(). The computer should have halted transmission itself after sending
|
232
|
+
// the WS2812 command. Only call sendReady() after data is written out to the strip.
|
233
|
+
//
|
234
|
+
// If the function was initiated on the board (eg. New IR input triggered by an interrupt),
|
235
|
+
// call sendHalt() as soon as possible, then call sendReady() when done.
|
236
|
+
//
|
237
|
+
// sendReady() is also exposed through the API for diagnostics and testing.
|
238
|
+
//
|
239
|
+
void sendHalt();
|
240
|
+
void sendReady(); // cmd = 92
|
241
|
+
|
242
|
+
//
|
243
|
+
// Shared SPI listeners that can be used by either hardware or bit bang SPI.
|
244
|
+
//
|
245
|
+
#if defined(DENKO_SPI) || defined(DENKO_SPI_BB)
|
246
|
+
// How many SPI lsiteners.
|
247
|
+
#define SPI_LISTENER_COUNT 4
|
248
|
+
|
249
|
+
// How to store a SPI listener.
|
250
|
+
struct SpiListener{
|
251
|
+
uint32_t clock; // Clock rate if hardware SPI. If bit bang: bits[0..7] = clock pin, bits [8..15] = input pin.
|
252
|
+
uint8_t select; // Select pin.
|
253
|
+
uint8_t settings; // Settings mask as given in request.
|
254
|
+
uint8_t length; // Read length as given in request.
|
255
|
+
uint8_t enabled; // 0 = disabled, 1 = hardware, 2 = bit bang.
|
256
|
+
};
|
257
|
+
SpiListener spiListeners[SPI_LISTENER_COUNT];
|
258
|
+
#endif
|
259
|
+
};
|