denko 0.13.1 → 0.13.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/build_avr.yml +2 -4
- data/.github/workflows/build_esp32.yml +2 -3
- data/.github/workflows/build_esp8266.yml +2 -3
- data/.github/workflows/build_megaavr.yml +3 -5
- data/.github/workflows/build_ra4m1.yml +57 -0
- data/.github/workflows/build_rp2040.yml +2 -4
- data/.github/workflows/build_sam3x.yml +1 -3
- data/.github/workflows/build_samd.yml +2 -4
- data/CHANGELOG.md +100 -0
- data/DEPS_CLI.md +13 -6
- data/DEPS_IDE.md +14 -7
- data/HARDWARE.md +104 -80
- data/README.md +19 -28
- data/benchmarks/i2c_ssd1306_refresh.rb +79 -0
- data/examples/analog_io/ads1115.rb +57 -0
- data/examples/analog_io/ads1118.rb +8 -9
- data/examples/analog_io/dac_loopback.rb +6 -4
- data/examples/analog_io/input.rb +39 -36
- data/examples/connection/tcp.rb +1 -1
- data/examples/display/hd44780.rb +3 -3
- data/examples/display/ssd1306.rb +1 -1
- data/lib/denko/analog_io/ads1115.rb +61 -0
- data/lib/denko/analog_io/ads1118.rb +10 -120
- data/lib/denko/analog_io/ads111x.rb +123 -0
- data/lib/denko/analog_io/output.rb +2 -1
- data/lib/denko/analog_io.rb +2 -0
- data/lib/denko/behaviors/reader.rb +14 -13
- data/lib/denko/behaviors/subcomponents.rb +2 -2
- data/lib/denko/board/core.rb +1 -1
- data/lib/denko/board/i2c.rb +1 -4
- data/lib/denko/board/led_array.rb +3 -6
- data/lib/denko/board/map.rb +9 -0
- data/lib/denko/board/servo.rb +2 -6
- data/lib/denko/board.rb +32 -20
- data/lib/denko/connection/board_uart.rb +3 -3
- data/lib/denko/connection/flow_control.rb +10 -2
- data/lib/denko/digital_io/output.rb +1 -1
- data/lib/denko/display/hd44780.rb +18 -18
- data/lib/denko/led/seven_segment.rb +18 -19
- data/lib/denko/message.rb +7 -15
- data/lib/denko/pulse_io/ir_transmitter.rb +1 -2
- data/lib/denko/version.rb +1 -1
- data/lib/denko_cli/packages.rb +7 -1
- data/lib/denko_cli/targets.rb +8 -5
- data/lib/denko_cli/usage.txt +8 -4
- data/src/denko_ethernet.ino +15 -23
- data/src/denko_serial.ino +3 -14
- data/src/denko_wifi.ino +72 -52
- data/src/lib/Denko.cpp +14 -6
- data/src/lib/Denko.h +6 -17
- data/src/lib/DenkoCoreIO.cpp +3 -3
- data/src/lib/DenkoDefines.h +73 -19
- data/src/lib/DenkoEEPROM.cpp +9 -1
- data/src/lib/DenkoI2C.cpp +11 -9
- data/src/lib/DenkoLEDArray.cpp +5 -11
- data/test/analog_io/input_test.rb +3 -3
- data/test/analog_io/output_test.rb +1 -1
- data/test/analog_io/potentiometer_test.rb +2 -2
- data/test/behaviors/bus_peripheral_addressed.rb +1 -1
- data/test/behaviors/bus_peripheral_test.rb +1 -1
- data/test/behaviors/callbacks_test.rb +4 -4
- data/test/behaviors/component_test.rb +2 -2
- data/test/behaviors/listener_test.rb +3 -3
- data/test/behaviors/poller_test.rb +3 -3
- data/test/behaviors/reader_test.rb +11 -4
- data/test/behaviors/subcomponents_test.rb +1 -1
- data/test/behaviors/threaded_test.rb +7 -7
- data/test/board/board_test.rb +8 -8
- data/test/board/core_test.rb +12 -12
- data/test/board/eeprom_test.rb +2 -2
- data/test/board/helper_test.rb +0 -4
- data/test/board/i2c_test.rb +5 -5
- data/test/board/infrared_test.rb +1 -1
- data/test/board/message_test.rb +1 -1
- data/test/board/one_wire_test.rb +4 -4
- data/test/board/pulse_test.rb +2 -2
- data/test/board/servo_test.rb +3 -3
- data/test/board/spi_test.rb +3 -3
- data/test/board/tone_test.rb +2 -2
- data/test/connection/serial_test.rb +13 -13
- data/test/digital_io/input_test.rb +7 -7
- data/test/digital_io/output_test.rb +5 -5
- data/test/digital_io/rotary_encoder_test.rb +4 -4
- data/test/display/hd44780_test.rb +11 -1
- data/test/eeprom/built_in_test.rb +1 -1
- data/test/i2c/bus_test.rb +5 -5
- data/test/i2c/peripheral_test.rb +4 -4
- data/test/led/base_test.rb +2 -2
- data/test/led/rgb_test.rb +6 -6
- data/test/led/seven_segment_test.rb +36 -14
- data/test/motor/servo_test.rb +6 -6
- data/test/motor/stepper_test.rb +5 -5
- data/test/one_wire/bus_test.rb +9 -9
- data/test/one_wire/peripheral_test.rb +17 -17
- data/test/pulse_io/buzzer_test.rb +4 -4
- data/test/pulse_io/ir_transmitter_test.rb +2 -2
- data/test/pulse_io/pwm_output_test.rb +4 -4
- data/test/rtc/ds3231_test.rb +4 -4
- data/test/sensor/dht_test.rb +3 -3
- data/test/sensor/ds18b20_test.rb +9 -9
- data/test/spi/bus_test.rb +4 -4
- data/test/spi/input_register_test.rb +8 -8
- data/test/spi/output_register_test.rb +4 -4
- data/test/test_helper.rb +17 -2
- data/test/uart/bitbang_test.rb +3 -3
- metadata +7 -350
- data/vendor/board-maps/.gitignore +0 -56
- data/vendor/board-maps/.gitmodules +0 -21
- data/vendor/board-maps/BoardMap.h +0 -1364
- data/vendor/board-maps/README.md +0 -51
- data/vendor/board-maps/lib/boards_parser.rb +0 -66
- data/vendor/board-maps/lib/header_parser.rb +0 -164
- data/vendor/board-maps/run.rb +0 -47
- data/vendor/board-maps/yaml/0XCB_HELIOS.yml +0 -48
- data/vendor/board-maps/yaml/ADAFRUIT_FEATHER_ESP32S2.yml +0 -25
- data/vendor/board-maps/yaml/ADAFRUIT_FEATHER_ESP32S2_REVTFT.yml +0 -25
- data/vendor/board-maps/yaml/ADAFRUIT_FEATHER_ESP32S2_TFT.yml +0 -27
- data/vendor/board-maps/yaml/ADAFRUIT_FEATHER_ESP32S3.yml +0 -29
- data/vendor/board-maps/yaml/ADAFRUIT_FEATHER_ESP32S3_NOPSRAM.yml +0 -29
- data/vendor/board-maps/yaml/ADAFRUIT_FEATHER_ESP32S3_REVTFT.yml +0 -25
- data/vendor/board-maps/yaml/ADAFRUIT_FEATHER_ESP32S3_TFT.yml +0 -27
- data/vendor/board-maps/yaml/ADAFRUIT_FEATHER_ESP32_V2.yml +0 -30
- data/vendor/board-maps/yaml/ADAFRUIT_FEATHER_RP2040.yml +0 -48
- data/vendor/board-maps/yaml/ADAFRUIT_FEATHER_RP2040_CAN.yml +0 -48
- data/vendor/board-maps/yaml/ADAFRUIT_FEATHER_RP2040_DVI.yml +0 -48
- data/vendor/board-maps/yaml/ADAFRUIT_FEATHER_RP2040_PROP_MAKER.yml +0 -48
- data/vendor/board-maps/yaml/ADAFRUIT_FEATHER_RP2040_RFM.yml +0 -48
- data/vendor/board-maps/yaml/ADAFRUIT_FEATHER_RP2040_SCORPIO.yml +0 -48
- data/vendor/board-maps/yaml/ADAFRUIT_FEATHER_RP2040_THINKINK.yml +0 -48
- data/vendor/board-maps/yaml/ADAFRUIT_FEATHER_RP2040_USB_HOST.yml +0 -48
- data/vendor/board-maps/yaml/ADAFRUIT_ITSYBITSY_ESP32.yml +0 -24
- data/vendor/board-maps/yaml/ADAFRUIT_ITSYBITSY_RP2040.yml +0 -48
- data/vendor/board-maps/yaml/ADAFRUIT_KB2040_RP2040.yml +0 -48
- data/vendor/board-maps/yaml/ADAFRUIT_MACROPAD_RP2040.yml +0 -48
- data/vendor/board-maps/yaml/ADAFRUIT_MATRIXPORTAL_ESP32S3.yml +0 -16
- data/vendor/board-maps/yaml/ADAFRUIT_QTPY_ESP32C3.yml +0 -12
- data/vendor/board-maps/yaml/ADAFRUIT_QTPY_ESP32S2.yml +0 -22
- data/vendor/board-maps/yaml/ADAFRUIT_QTPY_ESP32S3_NOPSRAM.yml +0 -20
- data/vendor/board-maps/yaml/ADAFRUIT_QTPY_ESP32_PICO.yml +0 -27
- data/vendor/board-maps/yaml/ADAFRUIT_QTPY_RP2040.yml +0 -48
- data/vendor/board-maps/yaml/ADAFRUIT_STEMMAFRIEND_RP2040.yml +0 -48
- data/vendor/board-maps/yaml/ADAFRUIT_TRINKEYQT_RP2040.yml +0 -48
- data/vendor/board-maps/yaml/ALKS.yml +0 -34
- data/vendor/board-maps/yaml/AMPERKA_WIFI_SLOT.yml +0 -16
- data/vendor/board-maps/yaml/AVR_ADK.yml +0 -24
- data/vendor/board-maps/yaml/AVR_BT.yml +0 -16
- data/vendor/board-maps/yaml/AVR_CIRCUITPLAY.yml +0 -14
- data/vendor/board-maps/yaml/AVR_DUEMILANOVE.yml +0 -16
- data/vendor/board-maps/yaml/AVR_ESPLORA.yml +0 -20
- data/vendor/board-maps/yaml/AVR_ETHERNET.yml +0 -16
- data/vendor/board-maps/yaml/AVR_FIO.yml +0 -16
- data/vendor/board-maps/yaml/AVR_GEMMA.yml +0 -6
- data/vendor/board-maps/yaml/AVR_INDUSTRIAL101.yml +0 -20
- data/vendor/board-maps/yaml/AVR_LEONARDO.yml +0 -20
- data/vendor/board-maps/yaml/AVR_LEONARDO_ETH.yml +0 -20
- data/vendor/board-maps/yaml/AVR_LILYPAD.yml +0 -16
- data/vendor/board-maps/yaml/AVR_LILYPAD_USB.yml +0 -20
- data/vendor/board-maps/yaml/AVR_LININO_ONE.yml +0 -20
- data/vendor/board-maps/yaml/AVR_MEGA.yml +0 -24
- data/vendor/board-maps/yaml/AVR_MEGA2560.yml +0 -24
- data/vendor/board-maps/yaml/AVR_MICRO.yml +0 -20
- data/vendor/board-maps/yaml/AVR_MINI.yml +0 -16
- data/vendor/board-maps/yaml/AVR_NANO.yml +0 -16
- data/vendor/board-maps/yaml/AVR_NANO_EVERY.yml +0 -22
- data/vendor/board-maps/yaml/AVR_NG.yml +0 -16
- data/vendor/board-maps/yaml/AVR_PRO.yml +0 -16
- data/vendor/board-maps/yaml/AVR_ROBOT_CONTROL.yml +0 -22
- data/vendor/board-maps/yaml/AVR_ROBOT_MOTOR.yml +0 -19
- data/vendor/board-maps/yaml/AVR_UNO.yml +0 -16
- data/vendor/board-maps/yaml/AVR_UNO_WIFI_DEV_ED.yml +0 -16
- data/vendor/board-maps/yaml/AVR_UNO_WIFI_REV2.yml +0 -22
- data/vendor/board-maps/yaml/AVR_YUN.yml +0 -20
- data/vendor/board-maps/yaml/AVR_YUNMINI.yml +0 -20
- data/vendor/board-maps/yaml/AirM2M_CORE_ESP32C3.yml +0 -14
- data/vendor/board-maps/yaml/BEE_DATA_LOGGER.yml +0 -39
- data/vendor/board-maps/yaml/BPI_BIT.yml +0 -9
- data/vendor/board-maps/yaml/BPI_LEAF_S3.yml +0 -31
- data/vendor/board-maps/yaml/BRIDGETEK_IDM2040-7A.yml +0 -48
- data/vendor/board-maps/yaml/BeeMotionS3.yml +0 -40
- data/vendor/board-maps/yaml/Bee_Motion.yml +0 -27
- data/vendor/board-maps/yaml/Bee_Motion_Mini.yml +0 -1
- data/vendor/board-maps/yaml/Bee_S3.yml +0 -38
- data/vendor/board-maps/yaml/CHALLENGER_2040_LORA_RP2040.yml +0 -39
- data/vendor/board-maps/yaml/CHALLENGER_2040_LTE_RP2040.yml +0 -38
- data/vendor/board-maps/yaml/CHALLENGER_2040_NFC_RP2040.yml +0 -32
- data/vendor/board-maps/yaml/CHALLENGER_2040_SDRTC_RP2040.yml +0 -36
- data/vendor/board-maps/yaml/CHALLENGER_2040_SUBGHZ_RP2040.yml +0 -39
- data/vendor/board-maps/yaml/CHALLENGER_2040_UWB_RP2040.yml +0 -39
- data/vendor/board-maps/yaml/CHALLENGER_2040_WIFI_BLE_RP2040.yml +0 -42
- data/vendor/board-maps/yaml/CHALLENGER_2040_WIFI_RP2040.yml +0 -38
- data/vendor/board-maps/yaml/CHALLENGER_NB_2040_WIFI_RP2040.yml +0 -38
- data/vendor/board-maps/yaml/CRABIK_SLOT_ESP32_S3.yml +0 -19
- data/vendor/board-maps/yaml/CYTRON_MAKER_FEATHER_AIOT_S3.yml +0 -26
- data/vendor/board-maps/yaml/CYTRON_MAKER_NANO_RP2040.yml +0 -48
- data/vendor/board-maps/yaml/CYTRON_MAKER_PI_RP2040.yml +0 -48
- data/vendor/board-maps/yaml/CoreESP32.yml +0 -49
- data/vendor/board-maps/yaml/D1_MINI32.yml +0 -36
- data/vendor/board-maps/yaml/D1_UNO32.yml +0 -28
- data/vendor/board-maps/yaml/DATANOISETV_PICOADK.yml +0 -48
- data/vendor/board-maps/yaml/DENKY.yml +0 -26
- data/vendor/board-maps/yaml/DENKY_PICOV3.yml +0 -26
- data/vendor/board-maps/yaml/DENKY_WROOM32.yml +0 -26
- data/vendor/board-maps/yaml/DEPARTMENT_OF_ALCHEMY_MINIMAIN_ESP32S2.yml +0 -26
- data/vendor/board-maps/yaml/DFROBOT_BEETLE_ESP32_C3.yml +0 -14
- data/vendor/board-maps/yaml/DFROBOT_BEETLE_RP2040.yml +0 -48
- data/vendor/board-maps/yaml/DFROBOT_FIREBEETLE_2_ESP32E.yml +0 -44
- data/vendor/board-maps/yaml/DFROBOT_FIREBEETLE_2_ESP32S3.yml +0 -38
- data/vendor/board-maps/yaml/DFROBOT_ROMEO_ESP32S3.yml +0 -7
- data/vendor/board-maps/yaml/DPU_ESP32.yml +0 -26
- data/vendor/board-maps/yaml/DYDK.yml +0 -38
- data/vendor/board-maps/yaml/DYDK1A.yml +0 -37
- data/vendor/board-maps/yaml/DYDK1Av2.yml +0 -45
- data/vendor/board-maps/yaml/DYG.yml +0 -20
- data/vendor/board-maps/yaml/DYM.yml +0 -40
- data/vendor/board-maps/yaml/DYMv2.yml +0 -39
- data/vendor/board-maps/yaml/D_Duino_32.yml +0 -29
- data/vendor/board-maps/yaml/ELECTRONICCATS_HUNTERCAT_NFC.yml +0 -44
- data/vendor/board-maps/yaml/ESP320.yml +0 -8
- data/vendor/board-maps/yaml/ESP32C3_DEV.yml +0 -14
- data/vendor/board-maps/yaml/ESP32C3_M1_I_KIT.yml +0 -13
- data/vendor/board-maps/yaml/ESP32S2_DEV.yml +0 -33
- data/vendor/board-maps/yaml/ESP32S2_THING_PLUS.yml +0 -34
- data/vendor/board-maps/yaml/ESP32S2_USB.yml +0 -33
- data/vendor/board-maps/yaml/ESP32S3_CAM_LCD.yml +0 -7
- data/vendor/board-maps/yaml/ESP32S3_DEV.yml +0 -38
- data/vendor/board-maps/yaml/ESP32_DEV.yml +0 -26
- data/vendor/board-maps/yaml/ESP32_DEVKIT_LIPO.yml +0 -26
- data/vendor/board-maps/yaml/ESP32_EVB.yml +0 -7
- data/vendor/board-maps/yaml/ESP32_GATEWAY.yml +0 -13
- data/vendor/board-maps/yaml/ESP32_GATEWAY_C.yml +0 -13
- data/vendor/board-maps/yaml/ESP32_GATEWAY_E.yml +0 -13
- data/vendor/board-maps/yaml/ESP32_GATEWAY_F.yml +0 -13
- data/vendor/board-maps/yaml/ESP32_IOT_REDBOARD.yml +0 -27
- data/vendor/board-maps/yaml/ESP32_MICROMOD.yml +0 -24
- data/vendor/board-maps/yaml/ESP32_PICO.yml +0 -26
- data/vendor/board-maps/yaml/ESP32_POE.yml +0 -7
- data/vendor/board-maps/yaml/ESP32_POE_ISO.yml +0 -7
- data/vendor/board-maps/yaml/ESP32_S3_BOX.yml +0 -16
- data/vendor/board-maps/yaml/ESP32_S3_USB_OTG.yml +0 -11
- data/vendor/board-maps/yaml/ESP32_THING.yml +0 -27
- data/vendor/board-maps/yaml/ESP32_THING_PLUS.yml +0 -30
- data/vendor/board-maps/yaml/ESP32_THING_PLUS_C.yml +0 -30
- data/vendor/board-maps/yaml/ESP32_WROOM_DA.yml +0 -26
- data/vendor/board-maps/yaml/ESP32_WROVER_KIT.yml +0 -26
- data/vendor/board-maps/yaml/ESP8266_ADAFRUIT_HUZZAH.yml +0 -9
- data/vendor/board-maps/yaml/ESP8266_AGRUMINO_LEMON_V4.yml +0 -8
- data/vendor/board-maps/yaml/ESP8266_ARDUINO_PRIMO.yml +0 -7
- data/vendor/board-maps/yaml/ESP8266_ARDUINO_STAR_OTTO.yml +0 -7
- data/vendor/board-maps/yaml/ESP8266_ARDUINO_UNOWIFI.yml +0 -9
- data/vendor/board-maps/yaml/ESP8266_ESP01.yml +0 -9
- data/vendor/board-maps/yaml/ESP8266_ESP07.yml +0 -20
- data/vendor/board-maps/yaml/ESP8266_ESP12.yml +0 -20
- data/vendor/board-maps/yaml/ESP8266_ESP13.yml +0 -17
- data/vendor/board-maps/yaml/ESP8266_ESP210.yml +0 -9
- data/vendor/board-maps/yaml/ESP8266_ESPECTRO_CORE.yml +0 -9
- data/vendor/board-maps/yaml/ESP8266_ESPINO_ESP12.yml +0 -9
- data/vendor/board-maps/yaml/ESP8266_ESPINO_ESP13.yml +0 -9
- data/vendor/board-maps/yaml/ESP8266_ESPRESSO_LITE_V1.yml +0 -9
- data/vendor/board-maps/yaml/ESP8266_ESPRESSO_LITE_V2.yml +0 -9
- data/vendor/board-maps/yaml/ESP8266_GENERIC.yml +0 -9
- data/vendor/board-maps/yaml/ESP8266_INVENT_ONE.yml +0 -22
- data/vendor/board-maps/yaml/ESP8266_NODEMCU_ESP12.yml +0 -20
- data/vendor/board-maps/yaml/ESP8266_NODEMCU_ESP12E.yml +0 -20
- data/vendor/board-maps/yaml/ESP8266_OAK.yml +0 -9
- data/vendor/board-maps/yaml/ESP8266_PHOENIX_V1.yml +0 -9
- data/vendor/board-maps/yaml/ESP8266_PHOENIX_V2.yml +0 -9
- data/vendor/board-maps/yaml/ESP8266_SCHIRMILABS_EDUINO_WIFI.yml +0 -25
- data/vendor/board-maps/yaml/ESP8266_SONOFF_BASIC.yml +0 -9
- data/vendor/board-maps/yaml/ESP8266_SONOFF_S20.yml +0 -9
- data/vendor/board-maps/yaml/ESP8266_SONOFF_SV.yml +0 -9
- data/vendor/board-maps/yaml/ESP8266_SONOFF_TH.yml +0 -9
- data/vendor/board-maps/yaml/ESP8266_THING.yml +0 -9
- data/vendor/board-maps/yaml/ESP8266_THING_DEV.yml +0 -9
- data/vendor/board-maps/yaml/ESP8266_WEMOS_D1MINI.yml +0 -18
- data/vendor/board-maps/yaml/ESP8266_WEMOS_D1MINILITE.yml +0 -18
- data/vendor/board-maps/yaml/ESP8266_WEMOS_D1MINIPRO.yml +0 -18
- data/vendor/board-maps/yaml/ESP8266_WEMOS_D1R1.yml +0 -25
- data/vendor/board-maps/yaml/ESP8266_WEMOS_D1WROOM02.yml +0 -18
- data/vendor/board-maps/yaml/ESP8266_WIO_LINK.yml +0 -9
- data/vendor/board-maps/yaml/ESP8266_XINABOX_CW01.yml +0 -9
- data/vendor/board-maps/yaml/ESPECTRO32.yml +0 -27
- data/vendor/board-maps/yaml/ESPea32.yml +0 -27
- data/vendor/board-maps/yaml/ESPino32.yml +0 -27
- data/vendor/board-maps/yaml/ET-Board.yml +0 -26
- data/vendor/board-maps/yaml/EXTREMEELEXTRONICS_RC2040.yml +0 -46
- data/vendor/board-maps/yaml/Edgebox-ESP-100.yml +0 -7
- data/vendor/board-maps/yaml/FEATHERS2.yml +0 -33
- data/vendor/board-maps/yaml/FEATHERS2NEO.yml +0 -30
- data/vendor/board-maps/yaml/FEATHERS3.yml +0 -29
- data/vendor/board-maps/yaml/FEATHER_ESP32.yml +0 -28
- data/vendor/board-maps/yaml/FLYBOARD2040_CORE.yml +0 -48
- data/vendor/board-maps/yaml/FRANZININHO_WIFI.yml +0 -33
- data/vendor/board-maps/yaml/FRANZININHO_WIFI_MSC.yml +0 -33
- data/vendor/board-maps/yaml/FROG_ESP32.yml +0 -26
- data/vendor/board-maps/yaml/FUNHOUSE_ESP32S2.yml +0 -22
- data/vendor/board-maps/yaml/GEN4_IOD.yml +0 -9
- data/vendor/board-maps/yaml/GENERIC_RP2040.yml +0 -48
- data/vendor/board-maps/yaml/HEALTHYPI_4.yml +0 -27
- data/vendor/board-maps/yaml/HONEYLEMON.yml +0 -27
- data/vendor/board-maps/yaml/HORNBILL_ESP32_DEV.yml +0 -27
- data/vendor/board-maps/yaml/HORNBILL_ESP32_MINIMA.yml +0 -16
- data/vendor/board-maps/yaml/ILABS_2040_RPICO32_RP2040.yml +0 -47
- data/vendor/board-maps/yaml/IMBRIOS_LOGSENS_V1P1.yml +0 -19
- data/vendor/board-maps/yaml/INTOROBOT_ESP32_DEV.yml +0 -34
- data/vendor/board-maps/yaml/LILYGO_T_DISPLAY_S3.yml +0 -26
- data/vendor/board-maps/yaml/LOLIN32.yml +0 -27
- data/vendor/board-maps/yaml/LOLIN32_LITE.yml +0 -27
- data/vendor/board-maps/yaml/LOLIN_C3_MINI.yml +0 -14
- data/vendor/board-maps/yaml/LOLIN_D32.yml +0 -27
- data/vendor/board-maps/yaml/LOLIN_D32_PRO.yml +0 -27
- data/vendor/board-maps/yaml/LOLIN_S2_MINI.yml +0 -34
- data/vendor/board-maps/yaml/LOLIN_S2_PICO.yml +0 -34
- data/vendor/board-maps/yaml/LOLIN_S3.yml +0 -32
- data/vendor/board-maps/yaml/LOLIN_S3_MINI.yml +0 -32
- data/vendor/board-maps/yaml/LOLIN_S3_PRO.yml +0 -32
- data/vendor/board-maps/yaml/Lion_Bit_Dev_Board.yml +0 -18
- data/vendor/board-maps/yaml/LoPy.yml +0 -27
- data/vendor/board-maps/yaml/LoPy4.yml +0 -27
- data/vendor/board-maps/yaml/M5STACK_CORES3.yml +0 -8
- data/vendor/board-maps/yaml/M5STACK_Core2.yml +0 -9
- data/vendor/board-maps/yaml/M5STACK_FIRE.yml +0 -10
- data/vendor/board-maps/yaml/M5Stack-Timer-CAM.yml +0 -10
- data/vendor/board-maps/yaml/M5Stack_ATOM.yml +0 -10
- data/vendor/board-maps/yaml/M5Stack_ATOMS3.yml +0 -7
- data/vendor/board-maps/yaml/M5Stack_CoreInk.yml +0 -9
- data/vendor/board-maps/yaml/M5Stack_Core_ESP32.yml +0 -10
- data/vendor/board-maps/yaml/M5Stack_Station.yml +0 -10
- data/vendor/board-maps/yaml/M5Stick_C.yml +0 -10
- data/vendor/board-maps/yaml/MAGTAG29_ESP32S2.yml +0 -21
- data/vendor/board-maps/yaml/MELOPERO_COOKIE_RP2040.yml +0 -48
- data/vendor/board-maps/yaml/MELOPERO_SHAKE_RP2040.yml +0 -48
- data/vendor/board-maps/yaml/METRO_ESP32S2.yml +0 -34
- data/vendor/board-maps/yaml/MGBOT_IOTIK32A.yml +0 -27
- data/vendor/board-maps/yaml/MGBOT_IOTIK32B.yml +0 -27
- data/vendor/board-maps/yaml/MH_ET_LIVE_ESP32DEVKIT.yml +0 -27
- data/vendor/board-maps/yaml/MH_ET_LIVE_ESP32MINIKIT.yml +0 -27
- data/vendor/board-maps/yaml/MICROS2.yml +0 -34
- data/vendor/board-maps/yaml/MOD_WIFI_ESP8266.yml +0 -9
- data/vendor/board-maps/yaml/Metro.yml +0 -8
- data/vendor/board-maps/yaml/NANO32.yml +0 -27
- data/vendor/board-maps/yaml/NANO_RP2040_CONNECT.yml +0 -35
- data/vendor/board-maps/yaml/NEBULAS3.yml +0 -33
- data/vendor/board-maps/yaml/NEKOSYSTEMS_BL2040_MINI.yml +0 -48
- data/vendor/board-maps/yaml/NULLBITS_BIT_C_PRO.yml +0 -48
- data/vendor/board-maps/yaml/Node32s.yml +0 -27
- data/vendor/board-maps/yaml/NodeMCU_32S.yml +0 -27
- data/vendor/board-maps/yaml/ODROID_ESP32.yml +0 -10
- data/vendor/board-maps/yaml/ONEHORSE_ESP32_DEV.yml +0 -24
- data/vendor/board-maps/yaml/OROCA_EDUBOT.yml +0 -33
- data/vendor/board-maps/yaml/PIMORONI_PGA2040.yml +0 -48
- data/vendor/board-maps/yaml/PROS3.yml +0 -28
- data/vendor/board-maps/yaml/PYCOM_GPY.yml +0 -27
- data/vendor/board-maps/yaml/Piranha.yml +0 -16
- data/vendor/board-maps/yaml/Pocket32.yml +0 -27
- data/vendor/board-maps/yaml/QUANTUM.yml +0 -26
- data/vendor/board-maps/yaml/RASPBERRY_PI_PICO.yml +0 -48
- data/vendor/board-maps/yaml/RASPBERRY_PI_PICO_W.yml +0 -48
- data/vendor/board-maps/yaml/REDPILL_ESP32S3.yml +0 -32
- data/vendor/board-maps/yaml/RMP.yml +0 -33
- data/vendor/board-maps/yaml/SAMD_CIRCUITPLAYGROUND_EXPRESS.yml +0 -12
- data/vendor/board-maps/yaml/SAMD_MKR1000.yml +0 -20
- data/vendor/board-maps/yaml/SAMD_MKRFox1200.yml +0 -19
- data/vendor/board-maps/yaml/SAMD_MKRGSM1400.yml +0 -15
- data/vendor/board-maps/yaml/SAMD_MKRNB1500.yml +0 -15
- data/vendor/board-maps/yaml/SAMD_MKRVIDOR4000.yml +0 -19
- data/vendor/board-maps/yaml/SAMD_MKRWAN1300.yml +0 -18
- data/vendor/board-maps/yaml/SAMD_MKRWAN1310.yml +0 -18
- data/vendor/board-maps/yaml/SAMD_MKRWIFI1010.yml +0 -19
- data/vendor/board-maps/yaml/SAMD_MKRZERO.yml +0 -19
- data/vendor/board-maps/yaml/SAMD_NANO_33_IOT.yml +0 -13
- data/vendor/board-maps/yaml/SAMD_TIAN.yml +0 -15
- data/vendor/board-maps/yaml/SAMD_ZERO.yml +0 -14
- data/vendor/board-maps/yaml/SAM_DUE.yml +0 -26
- data/vendor/board-maps/yaml/SAM_ZERO.yml +0 -15
- data/vendor/board-maps/yaml/SEEED_INDICATOR_RP2040.yml +0 -47
- data/vendor/board-maps/yaml/SEEED_XIAO_RP2040.yml +0 -29
- data/vendor/board-maps/yaml/SOLDERPARTY_RP2040_STAMP.yml +0 -48
- data/vendor/board-maps/yaml/SONOFF_DUALR3.yml +0 -26
- data/vendor/board-maps/yaml/SPARKFUN_PROMICRO_RP2040.yml +0 -48
- data/vendor/board-maps/yaml/SPARKFUN_THINGPLUS_RP2040.yml +0 -48
- data/vendor/board-maps/yaml/STAMP_S3.yml +0 -4
- data/vendor/board-maps/yaml/TAMC_TERMOD_S3.yml +0 -31
- data/vendor/board-maps/yaml/TBEAM_USE_RADIO_SX1262.yml +0 -23
- data/vendor/board-maps/yaml/TBEAM_USE_RADIO_SX1268.yml +0 -23
- data/vendor/board-maps/yaml/TBEAM_USE_RADIO_SX1276.yml +0 -23
- data/vendor/board-maps/yaml/TBEAM_USE_RADIO_SX1278.yml +0 -23
- data/vendor/board-maps/yaml/TBEAM_USE_RADIO_SX1280.yml +0 -23
- data/vendor/board-maps/yaml/TBeam.yml +0 -23
- data/vendor/board-maps/yaml/TINYPICO.yml +0 -26
- data/vendor/board-maps/yaml/TINYS2.yml +0 -33
- data/vendor/board-maps/yaml/TINYS3.yml +0 -25
- data/vendor/board-maps/yaml/TTGO-T-OI-PLUS_DEV.yml +0 -11
- data/vendor/board-maps/yaml/TTGO_LoRa32_V1.yml +0 -28
- data/vendor/board-maps/yaml/TTGO_LoRa32_V2.yml +0 -28
- data/vendor/board-maps/yaml/TTGO_LoRa32_v21new.yml +0 -28
- data/vendor/board-maps/yaml/TTGO_T1.yml +0 -27
- data/vendor/board-maps/yaml/TTGO_T7_V13_Mini32.yml +0 -27
- data/vendor/board-maps/yaml/TTGO_T7_V14_Mini32.yml +0 -27
- data/vendor/board-maps/yaml/TWATCH_2020_V1.yml +0 -10
- data/vendor/board-maps/yaml/TWATCH_2020_V2.yml +0 -10
- data/vendor/board-maps/yaml/TWATCH_2020_V3.yml +0 -10
- data/vendor/board-maps/yaml/TWATCH_BASE.yml +0 -10
- data/vendor/board-maps/yaml/TWatch.yml +0 -10
- data/vendor/board-maps/yaml/Trueverit_ESP32_Universal_IoT_Driver.yml +0 -18
- data/vendor/board-maps/yaml/Trueverit_ESP32_Universal_IoT_Driver_MK_II.yml +0 -18
- data/vendor/board-maps/yaml/UBLOX_NINA_W10.yml +0 -48
- data/vendor/board-maps/yaml/UBLOX_NORA_W10.yml +0 -43
- data/vendor/board-maps/yaml/UPESY_RP2040_DEVKIT.yml +0 -48
- data/vendor/board-maps/yaml/VALTRACK_V4_MFW_ESP32_C3.yml +0 -23
- data/vendor/board-maps/yaml/VALTRACK_V4_VTS_ESP32_C3.yml +0 -23
- data/vendor/board-maps/yaml/VIYALAB_MIZU_RP2040.yml +0 -48
- data/vendor/board-maps/yaml/WATCHY.yml +0 -7
- data/vendor/board-maps/yaml/WATCHY_V10.yml +0 -7
- data/vendor/board-maps/yaml/WATCHY_V15.yml +0 -7
- data/vendor/board-maps/yaml/WATCHY_V20.yml +0 -7
- data/vendor/board-maps/yaml/WAVESHARE_RP2040_LCD_0_96.yml +0 -47
- data/vendor/board-maps/yaml/WAVESHARE_RP2040_LCD_1_28.yml +0 -47
- data/vendor/board-maps/yaml/WAVESHARE_RP2040_ONE.yml +0 -47
- data/vendor/board-maps/yaml/WAVESHARE_RP2040_PLUS.yml +0 -48
- data/vendor/board-maps/yaml/WAVESHARE_RP2040_ZERO.yml +0 -47
- data/vendor/board-maps/yaml/WESP32.yml +0 -17
- data/vendor/board-maps/yaml/WIDORA_AIR.yml +0 -34
- data/vendor/board-maps/yaml/WIFIDUINO_ESP8266.yml +0 -23
- data/vendor/board-maps/yaml/WIFINFO.yml +0 -20
- data/vendor/board-maps/yaml/WIPY3.yml +0 -27
- data/vendor/board-maps/yaml/WIZNET_5100S_EVB_PICO.yml +0 -48
- data/vendor/board-maps/yaml/WIZNET_5500_EVB_PICO.yml +0 -48
- data/vendor/board-maps/yaml/WIZNET_WIZFI360_EVB_PICO.yml +0 -48
- data/vendor/board-maps/yaml/WT32_ETH01.yml +0 -8
- data/vendor/board-maps/yaml/WiFiduino32S3.yml +0 -27
- data/vendor/board-maps/yaml/WiFiduinoV2.yml +0 -27
- data/vendor/board-maps/yaml/Wifiduino32.yml +0 -40
- data/vendor/board-maps/yaml/XIAO_ESP32C3.yml +0 -22
- data/vendor/board-maps/yaml/XIAO_ESP32S3.yml +0 -36
- data/vendor/board-maps/yaml/YD_RP2040.yml +0 -48
- data/vendor/board-maps/yaml/atmegazero_esp32s2.yml +0 -30
- data/vendor/board-maps/yaml/connaxio_espoir.yml +0 -18
- data/vendor/board-maps/yaml/esp32vn_iot_uno.yml +0 -22
- data/vendor/board-maps/yaml/fm_devkit.yml +0 -15
- data/vendor/board-maps/yaml/heltec_wifi_32_lora_V3.yml +0 -31
- data/vendor/board-maps/yaml/heltec_wifi_kit_32.yml +0 -28
- data/vendor/board-maps/yaml/heltec_wifi_kit_32_V3.yml +0 -32
- data/vendor/board-maps/yaml/heltec_wifi_lora_32.yml +0 -27
- data/vendor/board-maps/yaml/heltec_wifi_lora_32_V2.yml +0 -27
- data/vendor/board-maps/yaml/heltec_wireless_stick.yml +0 -27
- data/vendor/board-maps/yaml/heltec_wireless_stick_LITE.yml +0 -27
- data/vendor/board-maps/yaml/openkb.yml +0 -27
- data/vendor/board-maps/yaml/roboheart_hercules.yml +0 -17
- data/vendor/board-maps/yaml/sensesiot_weizen.yml +0 -26
- data/vendor/board-maps/yaml/uPesy_WROOM.yml +0 -27
- data/vendor/board-maps/yaml/uPesy_WROVER.yml +0 -27
- data/vendor/board-maps/yaml/unphone8.yml +0 -32
- data/vendor/board-maps/yaml/unphone9.yml +0 -32
- data/vendor/board-maps/yaml/wifi_kit_8.yml +0 -15
data/src/denko_wifi.ino
CHANGED
@@ -1,3 +1,25 @@
|
|
1
|
+
// NOTE!!!
|
2
|
+
// For some boards the standard <WiFi.h> header file does not work.
|
3
|
+
//
|
4
|
+
// Make sure to define:
|
5
|
+
// WIFI_101 if using the WiFi Shield 101, or any board that uses the ATWINC1500 for Wi-Fi.
|
6
|
+
// WIFI_NINA if using any board with the NINA-W102 WiFi chip.
|
7
|
+
//
|
8
|
+
// Some known boards are handled automatically.
|
9
|
+
//
|
10
|
+
// #define WIFI_101
|
11
|
+
// #define WIFI_NINA
|
12
|
+
|
13
|
+
// WiFi101 Boards
|
14
|
+
#ifdef ARDUINO_SAMD_MKR1000
|
15
|
+
#define WIFI_101
|
16
|
+
#endif
|
17
|
+
|
18
|
+
// Nina WiFi Boards
|
19
|
+
#if defined(ARDUINO_SAMD_MKRWIFI1010) || defined(ARDUINO_AVR_UNO_WIFI_REV2) || defined(ARDUINO_SAMD_NANO_33_IOT)
|
20
|
+
#define WIFI_NINA
|
21
|
+
#endif
|
22
|
+
|
1
23
|
#include "Denko.h"
|
2
24
|
#if defined(ESP8266)
|
3
25
|
#include <ESP8266WiFi.h>
|
@@ -12,21 +34,17 @@
|
|
12
34
|
// #include <ArduinoOTA.h>
|
13
35
|
#define WIFI_STATUS_LED 2
|
14
36
|
#else
|
15
|
-
#include <SPI.h>
|
16
|
-
#include <WiFi.h>
|
17
37
|
#define WIFI_STATUS_LED 13
|
18
|
-
#
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
#
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
#else
|
29
|
-
#define serial Serial
|
38
|
+
#if defined(WIFI_101)
|
39
|
+
#include <WiFi101.h>
|
40
|
+
#elif defined(WIFI_NINA)
|
41
|
+
#include <WiFiNINA.h>
|
42
|
+
#elif defined(ARDUINO_UNOWIFIR4)
|
43
|
+
#include <WiFiS3.h>
|
44
|
+
#else
|
45
|
+
#include <SPI.h>
|
46
|
+
#include <WiFi.h>
|
47
|
+
#endif
|
30
48
|
#endif
|
31
49
|
|
32
50
|
// Configure your WiFi options here. IP address is not configurable. Uses DHCP.
|
@@ -50,16 +68,21 @@ void indicateWiFi(byte value) {
|
|
50
68
|
}
|
51
69
|
|
52
70
|
void printWifiStatus() {
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
71
|
+
DENKO_SERIAL_IF.println("WiFi Connected");
|
72
|
+
DENKO_SERIAL_IF.print("SSID: ");
|
73
|
+
DENKO_SERIAL_IF.println(WiFi.SSID());
|
74
|
+
DENKO_SERIAL_IF.print("Signal Strength (RSSI):");
|
75
|
+
DENKO_SERIAL_IF.print(WiFi.RSSI());
|
76
|
+
DENKO_SERIAL_IF.println(" dBm");
|
77
|
+
DENKO_SERIAL_IF.print("IP Address: ");
|
78
|
+
#ifdef WIFI_101
|
79
|
+
IPAddress ip = WiFi.localIP();
|
80
|
+
DENKO_SERIAL_IF.println(ip);
|
81
|
+
#else
|
82
|
+
DENKO_SERIAL_IF.println(WiFi.localIP());
|
83
|
+
#endif
|
84
|
+
DENKO_SERIAL_IF.print("Denko TCP Port: ");
|
85
|
+
DENKO_SERIAL_IF.println(port);
|
63
86
|
indicateWiFi(true);
|
64
87
|
}
|
65
88
|
|
@@ -70,37 +93,29 @@ void connect(){
|
|
70
93
|
#endif
|
71
94
|
|
72
95
|
// Try to connect.
|
73
|
-
|
96
|
+
DENKO_SERIAL_IF.print("Connecting to WiFi ");
|
74
97
|
WiFi.begin(ssid, pass);
|
75
98
|
|
76
99
|
// Delay until connected.
|
77
100
|
while (WiFi.status() != WL_CONNECTED) {
|
78
101
|
delay(500);
|
79
|
-
|
102
|
+
DENKO_SERIAL_IF.print(".");
|
80
103
|
}
|
81
104
|
connected = true;
|
105
|
+
printWifiStatus();
|
82
106
|
}
|
83
107
|
|
84
108
|
void maintainWiFi(){
|
85
|
-
if (
|
86
|
-
if (WiFi.status() == WL_CONNECTED) return;
|
109
|
+
if (WiFi.status() != WL_CONNECTED) {
|
87
110
|
connected = false;
|
88
111
|
connect();
|
89
112
|
}
|
90
|
-
if (connected == false){
|
91
|
-
if (WiFi.status() != WL_CONNECTED) {
|
92
|
-
connect();
|
93
|
-
return;
|
94
|
-
}
|
95
|
-
connected = true;
|
96
|
-
printWifiStatus();
|
97
|
-
}
|
98
113
|
}
|
99
114
|
|
100
115
|
void setup() {
|
101
116
|
// Wait for serial ready.
|
102
|
-
|
103
|
-
while(!
|
117
|
+
DENKO_SERIAL_IF.begin(115200);
|
118
|
+
while(!DENKO_SERIAL_IF);
|
104
119
|
|
105
120
|
// Enable over the air updates on the ESP8266.
|
106
121
|
#if defined(ESP8266)
|
@@ -117,33 +132,38 @@ void setup() {
|
|
117
132
|
denko.digitalListenCallback = onDigitalListen;
|
118
133
|
denko.analogListenCallback = onAnalogListen;
|
119
134
|
|
120
|
-
// Use
|
121
|
-
denko.stream = &
|
135
|
+
// Use DENKO_SERIAL_IF as the denko IO stream until we get a TCP connection.
|
136
|
+
denko.stream = &DENKO_SERIAL_IF;
|
122
137
|
}
|
123
138
|
|
124
139
|
void loop() {
|
125
140
|
// Reconnect if we've lost WiFi.
|
126
141
|
maintainWiFi();
|
127
142
|
|
143
|
+
// Handle OTA updates.
|
144
|
+
#if defined(ESP8266)
|
145
|
+
ArduinoOTA.handle();
|
146
|
+
#endif
|
147
|
+
|
148
|
+
// End connection if client disconnects.
|
149
|
+
if (client && !client.connected()) {
|
150
|
+
client.stop();
|
151
|
+
}
|
152
|
+
|
128
153
|
// Allow one client at a time to be connected. Set it as the denko IO stream.
|
129
154
|
if (!client){
|
130
155
|
client = server.available();
|
131
|
-
if (client)
|
156
|
+
if (client) {
|
157
|
+
// TCP Client
|
158
|
+
denko.stream = &client;
|
159
|
+
} else {
|
160
|
+
// Serial fallback
|
161
|
+
denko.stream = &DENKO_SERIAL_IF;
|
162
|
+
}
|
132
163
|
}
|
133
164
|
|
134
165
|
// Main loop of the denko library.
|
135
166
|
denko.run();
|
136
|
-
|
137
|
-
// End the connection when client disconnects and revert to serial IO.
|
138
|
-
if (client && !client.connected()){
|
139
|
-
client.stop();
|
140
|
-
denko.stream = &serial;
|
141
|
-
}
|
142
|
-
|
143
|
-
// Handle OTA updates.
|
144
|
-
#if defined(ESP8266)
|
145
|
-
ArduinoOTA.handle();
|
146
|
-
#endif
|
147
167
|
}
|
148
168
|
|
149
169
|
// This runs every time a digital pin that denko is listening to changes value.
|
data/src/lib/Denko.cpp
CHANGED
@@ -36,7 +36,7 @@ void Denko::run(){
|
|
36
36
|
parse(stream->read());
|
37
37
|
rxBytes ++;
|
38
38
|
// Acknowledge when we've received half as many bytes as the serial buffer.
|
39
|
-
if (rxBytes >=
|
39
|
+
if (rxBytes >= DENKO_RX_ACK_INTERVAL) rxNotify();
|
40
40
|
}
|
41
41
|
|
42
42
|
#ifdef DENKO_UARTS
|
@@ -113,7 +113,7 @@ void Denko::process() {
|
|
113
113
|
case 6: setListener (pin, val, auxMsg[0], auxMsg[1], false); break;
|
114
114
|
|
115
115
|
// Implemented in DenkoEEPROM.cpp
|
116
|
-
#ifdef
|
116
|
+
#ifdef DENKO_EEPROM
|
117
117
|
case 7: eepromRead (); break;
|
118
118
|
case 8: eepromWrite (); break;
|
119
119
|
#endif
|
@@ -262,19 +262,27 @@ void Denko::handshake() {
|
|
262
262
|
#ifdef DENKO_VERSION
|
263
263
|
stream->print(DENKO_VERSION);
|
264
264
|
#endif
|
265
|
+
|
266
|
+
// Third is serial buffer size.
|
267
|
+
stream->print(',');
|
268
|
+
stream->print(DENKO_SERIAL_BUFFER_SIZE);
|
265
269
|
|
266
|
-
//
|
270
|
+
// Fourth is AUX_SIZE.
|
267
271
|
stream->print(',');
|
268
272
|
stream->print(AUX_SIZE);
|
269
273
|
|
270
|
-
//
|
274
|
+
// Fifth is EEPROM size. None on Due or Zero.
|
271
275
|
stream->print(',');
|
272
276
|
#if defined(EEPROM_EMULATED)
|
273
277
|
stream->print(EMULATED_EEPROM_LENGTH);
|
274
278
|
#elif defined(EEPROM_PRESENT)
|
275
279
|
stream->print(EEPROM.length());
|
276
|
-
#
|
277
|
-
|
280
|
+
#endif
|
281
|
+
|
282
|
+
// Sixth is I2C buffer size.
|
283
|
+
stream->print(',');
|
284
|
+
#ifdef DENKO_I2C
|
285
|
+
stream->print(DENKO_I2C_BUFFER_SIZE);
|
278
286
|
#endif
|
279
287
|
|
280
288
|
// End
|
data/src/lib/Denko.h
CHANGED
@@ -154,6 +154,8 @@ class Denko {
|
|
154
154
|
void spiClearListeners ();
|
155
155
|
|
156
156
|
// I2C
|
157
|
+
bool i2cStarted = false;
|
158
|
+
byte i2cSpeed = 0;
|
157
159
|
void i2cBegin ();
|
158
160
|
void i2cEnd ();
|
159
161
|
void i2cSetSpeed (uint8_t code);
|
@@ -199,36 +201,23 @@ class Denko {
|
|
199
201
|
// Parsed message storage.
|
200
202
|
byte cmdStr[4]; byte cmd;
|
201
203
|
byte pinStr[4]; byte pin;
|
202
|
-
byte valStr[4];
|
204
|
+
byte valStr[4]; uint16_t val;
|
203
205
|
byte auxMsg[AUX_SIZE];
|
204
206
|
|
205
207
|
//
|
206
208
|
// Flow control stuff.
|
207
209
|
//
|
208
|
-
// Notify
|
209
|
-
//
|
210
|
+
// Notify computer that board has received bytes.
|
210
211
|
void rxNotify();
|
211
212
|
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
213
|
//
|
225
214
|
// Tell the computer to halt or resume sending data to the board.
|
226
215
|
//
|
227
|
-
//
|
216
|
+
// Use these if running a function on the board that disables interrupts for
|
228
217
|
// longer than a single serial character (~85us at 115,200 baud).
|
229
218
|
//
|
230
219
|
// If the function was initiated by the computer (eg. writing to a WS2812 strip), do
|
231
|
-
// not call sendHalt(). The computer should
|
220
|
+
// not call sendHalt(). The computer should halt transmission itself after sending
|
232
221
|
// the WS2812 command. Only call sendReady() after data is written out to the strip.
|
233
222
|
//
|
234
223
|
// If the function was initiated on the board (eg. New IR input triggered by an interrupt),
|
data/src/lib/DenkoCoreIO.cpp
CHANGED
@@ -27,8 +27,8 @@ void Denko::setMode(byte p, byte m) {
|
|
27
27
|
if (m != 0b100) dacDisable(p);
|
28
28
|
#endif
|
29
29
|
|
30
|
-
// On the SAMD21, mode needs to be INPUT when using the DAC.
|
31
|
-
#
|
30
|
+
// On the SAMD21 and RA4M1, mode needs to be INPUT when using the DAC.
|
31
|
+
#if defined(__SAMD21G18A__) || defined(_RENESAS_RA_)
|
32
32
|
if (m == 0b100){
|
33
33
|
pinMode(p, INPUT);
|
34
34
|
return;
|
@@ -196,7 +196,7 @@ void Denko::dacWrite(byte p, int v, boolean echo) {
|
|
196
196
|
::dacWrite(p, v);
|
197
197
|
#endif
|
198
198
|
|
199
|
-
#if defined(__SAM3X8E__) || defined(__SAMD21G18A__)
|
199
|
+
#if defined(__SAM3X8E__) || defined(__SAMD21G18A__) || defined(_RENESAS_RA_)
|
200
200
|
analogWrite(p, v);
|
201
201
|
#endif
|
202
202
|
}
|
data/src/lib/DenkoDefines.h
CHANGED
@@ -8,6 +8,7 @@
|
|
8
8
|
#define DENKO_VERSION __VERSION__
|
9
9
|
|
10
10
|
// Uncomment these to include features beyond core features.
|
11
|
+
// #define DENKO_EEPROM
|
11
12
|
// #define DENKO_ONE_WIRE
|
12
13
|
// #define DENKO_TONE
|
13
14
|
// #define DENKO_SPI_BB
|
@@ -39,30 +40,24 @@
|
|
39
40
|
#define PIN_COUNT 22
|
40
41
|
#endif
|
41
42
|
|
42
|
-
// No EEPROM on the Due or Zero.
|
43
|
-
#if !defined(__SAM3X8E__) && !defined(__SAMD21G18A__)
|
44
|
-
#define EEPROM_PRESENT
|
45
|
-
#include <EEPROM.h>
|
46
|
-
#endif
|
47
|
-
|
48
|
-
// Emulate 512 bytes of EEPROM on ESP chips and the RP2040.
|
49
|
-
#if defined(ESP8266) || defined(ESP32) || defined(ARDUINO_ARCH_RP2040)
|
50
|
-
# define EEPROM_EMULATED
|
51
|
-
# define EMULATED_EEPROM_LENGTH 512
|
52
|
-
#endif
|
53
|
-
|
54
43
|
// Figure out how many LEDC channels are available on ESP32 boards.
|
55
44
|
#ifdef ESP32
|
56
|
-
#
|
45
|
+
#if CONFIG_IDF_TARGET_ESP32
|
46
|
+
#define LEDC_CHANNEL_COUNT 16
|
47
|
+
#elif CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3
|
48
|
+
#define LEDC_CHANNEL_COUNT 8
|
49
|
+
#elif CONFIG_IDF_TARGET_ESP32C3
|
50
|
+
#define LEDC_CHANNEL_COUNT 6
|
51
|
+
#endif
|
57
52
|
#endif
|
58
53
|
|
59
54
|
// Filter for boards that can set their analog write resolution.
|
60
|
-
#if defined(__SAM3X8E__) || defined(__SAMD21G18A__) || defined(ESP32) || defined(ARDUINO_ARCH_RP2040) || defined(ESP8266)
|
55
|
+
#if defined(__SAM3X8E__) || defined(__SAMD21G18A__) || defined(_RENESAS_RA_) || defined(ESP32) || defined(ARDUINO_ARCH_RP2040) || defined(ESP8266)
|
61
56
|
#define WRITE_RESOLUTION_SETTER
|
62
57
|
#endif
|
63
58
|
|
64
59
|
// Filter for boards that can set their analog read resolution.
|
65
|
-
#if defined(__SAM3X8E__) || defined(__SAMD21G18A__) || defined(ESP32) || defined(ARDUINO_ARCH_RP2040)
|
60
|
+
#if defined(__SAM3X8E__) || defined(__SAMD21G18A__) || defined(_RENESAS_RA_) || defined(ESP32) || defined(ARDUINO_ARCH_RP2040)
|
66
61
|
#define READ_RESOLUTION_SETTER
|
67
62
|
#endif
|
68
63
|
|
@@ -70,7 +65,7 @@
|
|
70
65
|
#ifdef DENKO_UART
|
71
66
|
// Look for TX pin definitions on RP2040.
|
72
67
|
#if defined(RP2040)
|
73
|
-
#if
|
68
|
+
#if defined(PIN_SERIAL2_TX)
|
74
69
|
#define DENKO_UARTS 2
|
75
70
|
#elif defined(PIN_SERIAL_1_TX)
|
76
71
|
#define DENKO_UARTS 1
|
@@ -88,7 +83,15 @@
|
|
88
83
|
#elif defined(ESP8266) && defined(SERIAL_PORT_HARDWARE_OPEN)
|
89
84
|
#define DENKO_UARTS 1
|
90
85
|
|
91
|
-
//
|
86
|
+
// Define 1 UART for UNO R4 boards. Always use Serial1.
|
87
|
+
#elif defined(_RENESAS_RA_)
|
88
|
+
#define DENKO_UARTS 1
|
89
|
+
|
90
|
+
// Define 1 UART for ATmega4809.
|
91
|
+
#elif defined(__AVR_ATmega4809__) && defined(SERIAL_PORT_HARDWARE)
|
92
|
+
#define DENKO_UARTS 1
|
93
|
+
|
94
|
+
// This works for all the Atmel cores exept ATmega4809.
|
92
95
|
#else
|
93
96
|
#if defined(SERIAL_PORT_HARDWARE3)
|
94
97
|
#define DENKO_UARTS 3
|
@@ -107,10 +110,61 @@
|
|
107
110
|
// If no high usage features (core sketch), 32 + 16.
|
108
111
|
#if !defined(DENKO_SHIFT) && !defined (DENKO_I2C) && !defined(DENKO_SPI) && !defined(DENKO_UARTS) && !defined(DENKO_UART_BB) && !defined(DENKO_IR_OUT) && !defined(DENKO_LED_ARRAY)
|
109
112
|
#define AUX_SIZE 48
|
110
|
-
// If using IR_OUT or LED_ARRAY, and not on the ATmega168,
|
113
|
+
// If using IR_OUT or LED_ARRAY, and not on the ATmega168, 768 + 16.
|
111
114
|
#elif (defined(DENKO_IR_OUT) || defined(DENKO_LED_ARRAY)) && !defined(__AVR_ATmega168__)
|
112
|
-
#define AUX_SIZE
|
115
|
+
#define AUX_SIZE 784
|
113
116
|
// Default aux message size to 256 + 16 bytes.
|
114
117
|
#else
|
115
118
|
#define AUX_SIZE 272
|
116
119
|
#endif
|
120
|
+
|
121
|
+
// Define 'DENKO_SERIAL_IF' as the serial interface to use.
|
122
|
+
// Uses SerialUSB (left port), which is native USB, on Arduino Due & Zero, or Serial otherwise.
|
123
|
+
// On many boards, eg. Arduino Leonardo, RP2040, ESP32-S3, Serial is native USB regardless.
|
124
|
+
#if defined(__SAM3X8E__) || defined(__SAMD21G18A__)
|
125
|
+
#define DENKO_SERIAL_IF SerialUSB
|
126
|
+
#define DENKO_USB_CDC
|
127
|
+
// To use programming USB (right) on Due and Zero, comment 2 lines above, uncomment 1 line below.
|
128
|
+
// #define DENKO_SERIAL_IF Serial
|
129
|
+
#else
|
130
|
+
#define DENKO_SERIAL_IF Serial
|
131
|
+
#endif
|
132
|
+
|
133
|
+
// Figure out how much serial buffer we have, tell the computer, and set the ack interval.
|
134
|
+
// Best performance acknowledging at 64 bytes, or 32 if buffer is only 64.
|
135
|
+
//
|
136
|
+
// These are 256/64 regardless of whether native USB CDC or UART bridge.
|
137
|
+
#if defined(ARDUINO_ARCH_RP2040) || defined(ESP32) || defined(ESP8266) || defined(__SAM3X8E__)
|
138
|
+
#define DENKO_SERIAL_BUFFER_SIZE 256
|
139
|
+
#define DENKO_RX_ACK_INTERVAL 64
|
140
|
+
// RA4M1 has a 512 Serial buffer.
|
141
|
+
#elif defined(_RENESAS_RA_)
|
142
|
+
#define DENKO_SERIAL_BUFFER_SIZE 512
|
143
|
+
#define DENKO_RX_ACK_INTERVAL 64
|
144
|
+
// SAMD21 is 256/128 in native USB mode ONLY. Must use defaults on programming port to avoid data loss.
|
145
|
+
#elif defined(__SAMD21G18A__) && defined(DENKO_USB_CDC)
|
146
|
+
#define DENKO_SERIAL_BUFFER_SIZE 256
|
147
|
+
#define DENKO_RX_ACK_INTERVAL 128
|
148
|
+
// 32u4 is odd. Size is 63 instead of 64. Interval must be 31. 32 doesn't work at all. Off by 1 errors?
|
149
|
+
#elif defined(__AVR_ATmega32U4__)
|
150
|
+
#define DENKO_SERIAL_BUFFER_SIZE 63
|
151
|
+
#define DENKO_RX_ACK_INTERVAL 31
|
152
|
+
// Defaults
|
153
|
+
#else
|
154
|
+
#define DENKO_SERIAL_BUFFER_SIZE 64
|
155
|
+
#define DENKO_RX_ACK_INTERVAL 32
|
156
|
+
#endif
|
157
|
+
|
158
|
+
// Figure out how big the buffer is on the built-in Wire / I2C library.
|
159
|
+
#ifdef DENKO_I2C
|
160
|
+
// RP2040 and SAMD21 can do up to 256, but 255 since 1 byte for length.
|
161
|
+
#if defined(ARDUINO_ARCH_RP2040) || defined(__SAMD21G18A__)
|
162
|
+
#define DENKO_I2C_BUFFER_SIZE 255
|
163
|
+
// ESP32, ESP8266 and megaAVR can do up to 128.
|
164
|
+
#elif defined(ESP32) || defined(ESP8266) || defined(__AVR_ATmega4809__)
|
165
|
+
#define DENKO_I2C_BUFFER_SIZE 128
|
166
|
+
// Fall back to 32 bytes.
|
167
|
+
#else
|
168
|
+
#define DENKO_I2C_BUFFER_SIZE 32
|
169
|
+
#endif
|
170
|
+
#endif
|
data/src/lib/DenkoEEPROM.cpp
CHANGED
@@ -3,7 +3,15 @@
|
|
3
3
|
//
|
4
4
|
#include "Denko.h"
|
5
5
|
|
6
|
-
#ifdef
|
6
|
+
#ifdef DENKO_EEPROM
|
7
|
+
#include <EEPROM.h>
|
8
|
+
|
9
|
+
// Emulate 512 bytes of EEPROM on ESP chips and the RP2040.
|
10
|
+
#if defined(ESP8266) || defined(ESP32) || defined(ARDUINO_ARCH_RP2040)
|
11
|
+
#define EEPROM_EMULATED
|
12
|
+
#define EMULATED_EEPROM_LENGTH 512
|
13
|
+
#endif
|
14
|
+
|
7
15
|
// CMD = 6
|
8
16
|
// Read from the microcontroller's EEPROM.
|
9
17
|
//
|
data/src/lib/DenkoI2C.cpp
CHANGED
@@ -6,20 +6,20 @@
|
|
6
6
|
|
7
7
|
#include <Wire.h>
|
8
8
|
|
9
|
-
bool i2cStarted = false;
|
10
|
-
|
11
9
|
// Only start the I2C interface if not already started.
|
12
10
|
// Lazy initialization in case user wants to use I2C pins for something else.
|
13
11
|
void Denko::i2cBegin() {
|
14
12
|
if (!i2cStarted) {
|
15
13
|
Wire.begin();
|
16
14
|
i2cStarted = true;
|
15
|
+
i2cSetSpeed(0);
|
17
16
|
}
|
18
17
|
}
|
19
18
|
|
20
19
|
// End the I2C interface.
|
21
20
|
// This is mostly used as a Reset in Denko::handshake.
|
22
21
|
void Denko::i2cEnd(){
|
22
|
+
i2cSetSpeed(0);
|
23
23
|
// ESP8266 core does not define Wire.end()
|
24
24
|
#ifndef ESP8266
|
25
25
|
Wire.end();
|
@@ -36,6 +36,7 @@ void Denko::i2cSetSpeed(uint8_t code) {
|
|
36
36
|
case 3: Wire.setClock(3400000); break;
|
37
37
|
default: Wire.setClock(100000); break;
|
38
38
|
}
|
39
|
+
i2cSpeed = code;
|
39
40
|
}
|
40
41
|
|
41
42
|
// CMD = 33
|
@@ -43,7 +44,8 @@ void Denko::i2cSetSpeed(uint8_t code) {
|
|
43
44
|
void Denko::i2cSearch() {
|
44
45
|
byte error;
|
45
46
|
uint8_t addr;
|
46
|
-
i2cBegin();
|
47
|
+
if (!i2cStarted) i2cBegin();
|
48
|
+
i2cSetSpeed(0);
|
47
49
|
stream->print(SDA);
|
48
50
|
|
49
51
|
// Only addresses from 0x08 to 0x77 are usable (8 to 127).
|
@@ -77,10 +79,10 @@ void Denko::i2cWrite() {
|
|
77
79
|
uint8_t dataLength = (uint8_t)val;
|
78
80
|
|
79
81
|
// Limit to 32 bytes.
|
80
|
-
if (dataLength >
|
82
|
+
if (dataLength > DENKO_I2C_BUFFER_SIZE) dataLength = DENKO_I2C_BUFFER_SIZE;
|
81
83
|
|
82
|
-
i2cBegin();
|
83
|
-
i2cSetSpeed(auxMsg[0]);
|
84
|
+
if (!i2cStarted) i2cBegin();
|
85
|
+
if (i2cSpeed != auxMsg[0]) i2cSetSpeed(auxMsg[0]);
|
84
86
|
|
85
87
|
Wire.beginTransmission(address);
|
86
88
|
Wire.write(&auxMsg[1], dataLength);
|
@@ -116,10 +118,10 @@ void Denko::i2cRead() {
|
|
116
118
|
uint8_t dataLength = (uint8_t)val;
|
117
119
|
|
118
120
|
// Limit to 32 bytes.
|
119
|
-
if (dataLength >
|
121
|
+
if (dataLength > DENKO_I2C_BUFFER_SIZE) dataLength = DENKO_I2C_BUFFER_SIZE;
|
120
122
|
|
121
|
-
i2cBegin();
|
122
|
-
i2cSetSpeed(auxMsg[0]);
|
123
|
+
if (!i2cStarted) i2cBegin();
|
124
|
+
if (i2cSpeed != auxMsg[0]) i2cSetSpeed(auxMsg[0]);
|
123
125
|
|
124
126
|
// Optionally write up to a 4 byte register address before reading.
|
125
127
|
if ((auxMsg[1] > 0) && (auxMsg[1] < 5)) {
|
data/src/lib/DenkoLEDArray.cpp
CHANGED
@@ -8,7 +8,7 @@
|
|
8
8
|
// WS2812 / NeoPixel support using Adafruit library from:
|
9
9
|
// https://github.com/adafruit/Adafruit_NeoPixel
|
10
10
|
//
|
11
|
-
#
|
11
|
+
#ifdef DENKO_LED_WS2812
|
12
12
|
#include <Adafruit_NeoPixel.h>
|
13
13
|
#endif
|
14
14
|
|
@@ -17,7 +17,7 @@
|
|
17
17
|
// Write data to a WS2812 LED array. Will generalize to other types later.
|
18
18
|
//
|
19
19
|
// pin = Microcontroller pin connected to Data In pin of the LED array.
|
20
|
-
// val = Number of
|
20
|
+
// val = Number of raw pixel data bytes to expect. Max 9999.
|
21
21
|
// auxMsg[0..3] = Reserved for future settings.
|
22
22
|
// auxMsg[4+] = Raw pixel data, already in correct byte order (GRB, RGB, etc.).
|
23
23
|
//
|
@@ -27,18 +27,12 @@ void Denko::showLEDArray() {
|
|
27
27
|
ledArray.begin();
|
28
28
|
|
29
29
|
// Copy LED data into the pixel buffer.
|
30
|
-
|
31
|
-
memcpy(ledArray.getPixels(), &auxMsg[4], val * 3);
|
30
|
+
memcpy(ledArray.getPixels(), &auxMsg[4], val);
|
32
31
|
|
33
|
-
//
|
34
|
-
|
35
|
-
// AVR can get away with 32us, but others need 64.
|
36
|
-
#if defined(ESP8266) || defined(__SAMD21G18A__) || defined(__SAM3X8E__)
|
32
|
+
// ATmega4809 still needs this delay to avoid corrupt data. Not sure why.
|
33
|
+
#if defined(__AVR_ATmega4809__)
|
37
34
|
delayMicroseconds(64);
|
38
35
|
#endif
|
39
|
-
#ifdef __AVR__
|
40
|
-
delayMicroseconds(32);
|
41
|
-
#endif
|
42
36
|
|
43
37
|
// Write the pixel buffer to the array.
|
44
38
|
ledArray.show();
|
@@ -10,7 +10,7 @@ class AnalogIOInputTest < Minitest::Test
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def test__read
|
13
|
-
mock =
|
13
|
+
mock = Minitest::Mock.new.expect :call, nil, [14, nil, nil, nil]
|
14
14
|
board.stub(:analog_read, mock) do
|
15
15
|
part._read
|
16
16
|
end
|
@@ -18,7 +18,7 @@ class AnalogIOInputTest < Minitest::Test
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def test__listen
|
21
|
-
mock =
|
21
|
+
mock = Minitest::Mock.new
|
22
22
|
mock.expect :call, nil, [14, 16]
|
23
23
|
mock.expect :call, nil, [14, 32]
|
24
24
|
board.stub(:analog_listen, mock) do
|
@@ -29,7 +29,7 @@ class AnalogIOInputTest < Minitest::Test
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def test__stop_listen
|
32
|
-
mock =
|
32
|
+
mock = Minitest::Mock.new.expect :call, nil, [14]
|
33
33
|
board.stub(:stop_listener, mock) do
|
34
34
|
part._stop_listener
|
35
35
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require_relative '../test_helper'
|
2
2
|
|
3
|
-
class AnalogIOPotentiometerTest <
|
3
|
+
class AnalogIOPotentiometerTest < Minitest::Test
|
4
4
|
def board
|
5
5
|
@board ||= BoardMock.new
|
6
6
|
end
|
@@ -10,7 +10,7 @@ class AnalogIOPotentiometerTest < MiniTest::Test
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def test_setup
|
13
|
-
mock =
|
13
|
+
mock = Minitest::Mock.new.expect(:call, nil, [14,8])
|
14
14
|
board.stub(:analog_listen, mock) do
|
15
15
|
part
|
16
16
|
end
|
@@ -29,7 +29,7 @@ class CallbacksTest < Minitest::Test
|
|
29
29
|
|
30
30
|
def test_callback_mutex
|
31
31
|
callback = Proc.new{}
|
32
|
-
mock =
|
32
|
+
mock = Minitest::Mock.new
|
33
33
|
3.times {mock.expect(:call, nil)}
|
34
34
|
|
35
35
|
part.callback_mutex.stub(:synchronize, mock) do
|
@@ -73,8 +73,8 @@ class CallbacksTest < Minitest::Test
|
|
73
73
|
end
|
74
74
|
|
75
75
|
def test_update_runs_callbacks_and_removes_read_callbacks
|
76
|
-
cb1 =
|
77
|
-
cb2 =
|
76
|
+
cb1 = Minitest::Mock.new.expect :call, nil
|
77
|
+
cb2 = Minitest::Mock.new.expect :call, nil
|
78
78
|
part.add_callback { cb1.call }
|
79
79
|
part.add_callback(:read) { cb2.call }
|
80
80
|
part.update("data")
|
@@ -84,7 +84,7 @@ class CallbacksTest < Minitest::Test
|
|
84
84
|
end
|
85
85
|
|
86
86
|
def test_pre_callback_filter_modifies_data
|
87
|
-
cb =
|
87
|
+
cb = Minitest::Mock.new.expect :call, nil, ["denko: value"]
|
88
88
|
part.add_callback { |x| cb.call(x) }
|
89
89
|
part.update("value")
|
90
90
|
cb.verify
|