denko 0.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.github/workflows/build_avr.yml +61 -0
- data/.github/workflows/build_esp32.yml +58 -0
- data/.github/workflows/build_esp8266.yml +57 -0
- data/.github/workflows/build_megaavr.yml +61 -0
- data/.github/workflows/build_rp2040.yml +61 -0
- data/.github/workflows/build_sam3x.yml +59 -0
- data/.github/workflows/build_samd.yml +61 -0
- data/.github/workflows/ruby.yml +47 -0
- data/.gitignore +24 -0
- data/.gitmodules +3 -0
- data/.vscode/settings.json +5 -0
- data/.vscode/tasks.json +20 -0
- data/CHANGELOG.md +466 -0
- data/DEPS_CLI.md +80 -0
- data/DEPS_IDE.md +120 -0
- data/Gemfile +4 -0
- data/HARDWARE.md +195 -0
- data/LICENSE +22 -0
- data/README.md +152 -0
- data/Rakefile +11 -0
- data/bin/denko +22 -0
- data/build +27 -0
- data/denko.gemspec +47 -0
- data/examples/advanced/rotary_encoder_mac_volume.rb +48 -0
- data/examples/advanced/ssd1306_time_temp_rh.rb +48 -0
- data/examples/analog_io/ads1118.rb +74 -0
- data/examples/analog_io/dac_loopback.rb +32 -0
- data/examples/analog_io/input.rb +52 -0
- data/examples/connection/tcp.rb +34 -0
- data/examples/digital_io/rotary_encoder.rb +26 -0
- data/examples/display/hd44780.png +0 -0
- data/examples/display/hd44780.rb +39 -0
- data/examples/display/ssd1306.rb +40 -0
- data/examples/display/ssd1306_s2_pico.rb +29 -0
- data/examples/eeprom/built_in.rb +32 -0
- data/examples/i2c/search.rb +53 -0
- data/examples/led/apa102_bounce.rb +33 -0
- data/examples/led/apa102_breathe.rb +45 -0
- data/examples/led/builtin_blink.rb +12 -0
- data/examples/led/seven_segment_char_echo.rb +15 -0
- data/examples/led/ws2812_bounce.rb +32 -0
- data/examples/led/ws2812_builtin_blink.rb +21 -0
- data/examples/motor/l298.rb +43 -0
- data/examples/motor/servo.rb +16 -0
- data/examples/motor/stepper.png +0 -0
- data/examples/motor/stepper.rb +43 -0
- data/examples/pulse_io/buzzer.rb +30 -0
- data/examples/pulse_io/ir_transmitter.rb +55 -0
- data/examples/rtc/ds3231.rb +48 -0
- data/examples/sensor/aht10.rb +15 -0
- data/examples/sensor/aht20.rb +15 -0
- data/examples/sensor/bme280.rb +75 -0
- data/examples/sensor/dht.rb +24 -0
- data/examples/sensor/ds18b20.rb +58 -0
- data/examples/sensor/htu21d.rb +54 -0
- data/examples/sensor/htu31d.rb +31 -0
- data/examples/spi/input_register.rb +50 -0
- data/examples/spi/output_register.rb +49 -0
- data/examples/spi/ssd_through_register.rb +40 -0
- data/examples/spi/two_registers.rb +46 -0
- data/examples/uart/bit_bang_read.rb +16 -0
- data/examples/uart/bit_bang_write.rb +16 -0
- data/examples/uart/board_passthrough.rb +34 -0
- data/examples/uart/hardware_loopback.rb +16 -0
- data/lib/denko/analog_io/ads1118.rb +182 -0
- data/lib/denko/analog_io/input.rb +79 -0
- data/lib/denko/analog_io/output.rb +20 -0
- data/lib/denko/analog_io/potentiometer.rb +15 -0
- data/lib/denko/analog_io/sensor.rb +6 -0
- data/lib/denko/analog_io.rb +9 -0
- data/lib/denko/behaviors/board_proxy.rb +23 -0
- data/lib/denko/behaviors/bus_controller.rb +11 -0
- data/lib/denko/behaviors/bus_controller_addressed.rb +15 -0
- data/lib/denko/behaviors/bus_peripheral.rb +21 -0
- data/lib/denko/behaviors/bus_peripheral_addressed.rb +15 -0
- data/lib/denko/behaviors/callbacks.rb +67 -0
- data/lib/denko/behaviors/component.rb +48 -0
- data/lib/denko/behaviors/input_pin.rb +24 -0
- data/lib/denko/behaviors/listener.rb +22 -0
- data/lib/denko/behaviors/multi_pin.rb +72 -0
- data/lib/denko/behaviors/output_pin.rb +13 -0
- data/lib/denko/behaviors/poller.rb +31 -0
- data/lib/denko/behaviors/reader.rb +49 -0
- data/lib/denko/behaviors/single_pin.rb +26 -0
- data/lib/denko/behaviors/state.rb +24 -0
- data/lib/denko/behaviors/subcomponents.rb +35 -0
- data/lib/denko/behaviors/threaded.rb +54 -0
- data/lib/denko/behaviors.rb +26 -0
- data/lib/denko/board/core.rb +151 -0
- data/lib/denko/board/eeprom.rb +20 -0
- data/lib/denko/board/i2c.rb +68 -0
- data/lib/denko/board/infrared.rb +18 -0
- data/lib/denko/board/led_array.rb +18 -0
- data/lib/denko/board/map.rb +46 -0
- data/lib/denko/board/message_pack.rb +7 -0
- data/lib/denko/board/one_wire.rb +34 -0
- data/lib/denko/board/pulse.rb +26 -0
- data/lib/denko/board/servo.rb +22 -0
- data/lib/denko/board/spi.rb +65 -0
- data/lib/denko/board/spi_bit_bang.rb +41 -0
- data/lib/denko/board/tone.rb +23 -0
- data/lib/denko/board/uart.rb +42 -0
- data/lib/denko/board/uart_bit_bang.rb +33 -0
- data/lib/denko/board.rb +104 -0
- data/lib/denko/connection/base.rb +75 -0
- data/lib/denko/connection/board_uart.rb +36 -0
- data/lib/denko/connection/flow_control.rb +153 -0
- data/lib/denko/connection/handshake.rb +60 -0
- data/lib/denko/connection/serial.rb +90 -0
- data/lib/denko/connection/tcp.rb +44 -0
- data/lib/denko/connection.rb +10 -0
- data/lib/denko/digital_io/button.rb +8 -0
- data/lib/denko/digital_io/input.rb +44 -0
- data/lib/denko/digital_io/output.rb +47 -0
- data/lib/denko/digital_io/relay.rb +6 -0
- data/lib/denko/digital_io/rotary_encoder.rb +107 -0
- data/lib/denko/digital_io.rb +9 -0
- data/lib/denko/display/canvas.rb +282 -0
- data/lib/denko/display/hd44780.rb +266 -0
- data/lib/denko/display/ssd1306.rb +179 -0
- data/lib/denko/display.rb +7 -0
- data/lib/denko/eeprom/built_in.rb +69 -0
- data/lib/denko/eeprom.rb +5 -0
- data/lib/denko/fonts.rb +106 -0
- data/lib/denko/i2c/bus.rb +52 -0
- data/lib/denko/i2c/peripheral.rb +38 -0
- data/lib/denko/i2c.rb +6 -0
- data/lib/denko/led/apa102.rb +87 -0
- data/lib/denko/led/base.rb +12 -0
- data/lib/denko/led/rgb.rb +38 -0
- data/lib/denko/led/seven_segment.rb +111 -0
- data/lib/denko/led/ws2812.rb +48 -0
- data/lib/denko/led.rb +13 -0
- data/lib/denko/message.rb +92 -0
- data/lib/denko/motor/l298.rb +49 -0
- data/lib/denko/motor/servo.rb +51 -0
- data/lib/denko/motor/stepper.rb +71 -0
- data/lib/denko/motor.rb +7 -0
- data/lib/denko/one_wire/bus.rb +61 -0
- data/lib/denko/one_wire/bus_enumeration.rb +88 -0
- data/lib/denko/one_wire/constants.rb +17 -0
- data/lib/denko/one_wire/helper.rb +33 -0
- data/lib/denko/one_wire/peripheral.rb +62 -0
- data/lib/denko/one_wire.rb +9 -0
- data/lib/denko/pulse_io/buzzer.rb +25 -0
- data/lib/denko/pulse_io/ir_transmitter.rb +22 -0
- data/lib/denko/pulse_io/pwm_output.rb +34 -0
- data/lib/denko/pulse_io.rb +7 -0
- data/lib/denko/rtc/ds3231.rb +48 -0
- data/lib/denko/rtc.rb +5 -0
- data/lib/denko/sensor/aht.rb +165 -0
- data/lib/denko/sensor/bme280.rb +366 -0
- data/lib/denko/sensor/dht.rb +43 -0
- data/lib/denko/sensor/ds18b20.rb +74 -0
- data/lib/denko/sensor/htu21d.rb +168 -0
- data/lib/denko/sensor/htu31d.rb +187 -0
- data/lib/denko/sensor/virtual.rb +42 -0
- data/lib/denko/sensor.rb +13 -0
- data/lib/denko/spi/base_register.rb +37 -0
- data/lib/denko/spi/bit_bang.rb +74 -0
- data/lib/denko/spi/bus.rb +44 -0
- data/lib/denko/spi/input_register.rb +130 -0
- data/lib/denko/spi/output_register.rb +67 -0
- data/lib/denko/spi/peripheral.rb +43 -0
- data/lib/denko/spi.rb +10 -0
- data/lib/denko/uart/bit_bang.rb +69 -0
- data/lib/denko/uart/hardware.rb +65 -0
- data/lib/denko/uart.rb +6 -0
- data/lib/denko/version.rb +3 -0
- data/lib/denko.rb +39 -0
- data/lib/denko_cli/generator.rb +171 -0
- data/lib/denko_cli/helper.rb +29 -0
- data/lib/denko_cli/missing_files.txt +20 -0
- data/lib/denko_cli/packages.rb +101 -0
- data/lib/denko_cli/parser.rb +73 -0
- data/lib/denko_cli/targets.rb +30 -0
- data/lib/denko_cli/targets.txt +113 -0
- data/lib/denko_cli/usage.txt +34 -0
- data/lib/denko_cli.rb +18 -0
- data/src/denko_ethernet.ino +78 -0
- data/src/denko_serial.ino +41 -0
- data/src/denko_wifi.ino +157 -0
- data/src/lib/Denko.cpp +330 -0
- data/src/lib/Denko.h +259 -0
- data/src/lib/DenkoCoreIO.cpp +322 -0
- data/src/lib/DenkoDefines.h +116 -0
- data/src/lib/DenkoEEPROM.cpp +64 -0
- data/src/lib/DenkoI2C.cpp +155 -0
- data/src/lib/DenkoIROut.cpp +33 -0
- data/src/lib/DenkoIROutESP.cpp +26 -0
- data/src/lib/DenkoLEDArray.cpp +49 -0
- data/src/lib/DenkoOneWire.cpp +156 -0
- data/src/lib/DenkoPulseInput.cpp +57 -0
- data/src/lib/DenkoSPI.cpp +165 -0
- data/src/lib/DenkoSPIBB.cpp +156 -0
- data/src/lib/DenkoServo.cpp +83 -0
- data/src/lib/DenkoTone.cpp +25 -0
- data/src/lib/DenkoUART.cpp +118 -0
- data/src/lib/DenkoUARTBB.cpp +62 -0
- data/target.yml +3 -0
- data/test/analog_io/input_test.rb +38 -0
- data/test/analog_io/output_test.rb +26 -0
- data/test/analog_io/potentiometer_test.rb +62 -0
- data/test/behaviors/board_proxy_test.rb +24 -0
- data/test/behaviors/bus_controller_addressed_test.rb +40 -0
- data/test/behaviors/bus_controller_test.rb +28 -0
- data/test/behaviors/bus_peripheral_addressed.rb +44 -0
- data/test/behaviors/bus_peripheral_test.rb +39 -0
- data/test/behaviors/callbacks_test.rb +118 -0
- data/test/behaviors/component_test.rb +56 -0
- data/test/behaviors/input_pin_test.rb +42 -0
- data/test/behaviors/listener_test.rb +60 -0
- data/test/behaviors/multi_pin_test.rb +70 -0
- data/test/behaviors/output_pin_test.rb +27 -0
- data/test/behaviors/poller_test.rb +64 -0
- data/test/behaviors/reader_test.rb +68 -0
- data/test/behaviors/single_pin_test.rb +41 -0
- data/test/behaviors/subcomponents_test.rb +75 -0
- data/test/behaviors/threaded_test.rb +98 -0
- data/test/board/board_test.rb +130 -0
- data/test/board/core_test.rb +182 -0
- data/test/board/eeprom_test.rb +34 -0
- data/test/board/helper_test.rb +38 -0
- data/test/board/i2c_test.rb +114 -0
- data/test/board/infrared_test.rb +37 -0
- data/test/board/message_test.rb +54 -0
- data/test/board/one_wire_test.rb +69 -0
- data/test/board/pulse_test.rb +51 -0
- data/test/board/servo_test.rb +47 -0
- data/test/board/spi_test.rb +97 -0
- data/test/board/tone_test.rb +42 -0
- data/test/connection/serial_test.rb +172 -0
- data/test/connection/tcp_test.rb +37 -0
- data/test/digital_io/input_test.rb +65 -0
- data/test/digital_io/output_test.rb +64 -0
- data/test/digital_io/rotary_encoder_test.rb +99 -0
- data/test/display/hd44780_test.rb +23 -0
- data/test/eeprom/built_in_test.rb +61 -0
- data/test/i2c/bus_test.rb +66 -0
- data/test/i2c/peripheral_test.rb +50 -0
- data/test/led/base_test.rb +24 -0
- data/test/led/rgb_test.rb +64 -0
- data/test/led/seven_segment_test.rb +86 -0
- data/test/motor/servo_test.rb +62 -0
- data/test/motor/stepper_test.rb +51 -0
- data/test/one_wire/bus_enumerator_test.rb +134 -0
- data/test/one_wire/bus_test.rb +142 -0
- data/test/one_wire/helper_test.rb +18 -0
- data/test/one_wire/peripheral_test.rb +158 -0
- data/test/pulse_io/buzzer_test.rb +48 -0
- data/test/pulse_io/ir_transmitter_test.rb +38 -0
- data/test/pulse_io/pwm_output_test.rb +72 -0
- data/test/rtc/ds3231_test.rb +55 -0
- data/test/sensor/dht_test.rb +64 -0
- data/test/sensor/ds18b20_test.rb +107 -0
- data/test/spi/base_register_test.rb +34 -0
- data/test/spi/bus_test.rb +76 -0
- data/test/spi/input_register_test.rb +140 -0
- data/test/spi/output_register_test.rb +93 -0
- data/test/test_helper.rb +223 -0
- data/test/uart/bitbang_test.rb +37 -0
- data/tutorial/01-led/led.fzz +0 -0
- data/tutorial/01-led/led.pdf +0 -0
- data/tutorial/01-led/led.rb +73 -0
- data/tutorial/02-button/button.fzz +0 -0
- data/tutorial/02-button/button.pdf +0 -0
- data/tutorial/02-button/button.rb +64 -0
- data/tutorial/03-potentiometer/potentiometer.fzz +0 -0
- data/tutorial/03-potentiometer/potentiometer.pdf +0 -0
- data/tutorial/03-potentiometer/potentiometer.rb +62 -0
- data/tutorial/04-pwm_led/pwm_led.fzz +0 -0
- data/tutorial/04-pwm_led/pwm_led.pdf +0 -0
- data/tutorial/04-pwm_led/pwm_led.rb +66 -0
- data/tutorial/05-rgb_led/rgb_led.fzz +0 -0
- data/tutorial/05-rgb_led/rgb_led.pdf +0 -0
- data/tutorial/05-rgb_led/rgb_led.rb +58 -0
- data/tutorial/05-rgb_led/rgb_mapping.rb +76 -0
- data/vendor/board-maps/.gitignore +56 -0
- data/vendor/board-maps/.gitmodules +21 -0
- data/vendor/board-maps/BoardMap.h +1364 -0
- data/vendor/board-maps/README.md +51 -0
- data/vendor/board-maps/lib/boards_parser.rb +66 -0
- data/vendor/board-maps/lib/header_parser.rb +164 -0
- data/vendor/board-maps/run.rb +47 -0
- data/vendor/board-maps/yaml/0XCB_HELIOS.yml +48 -0
- data/vendor/board-maps/yaml/ADAFRUIT_FEATHER_ESP32S2.yml +25 -0
- data/vendor/board-maps/yaml/ADAFRUIT_FEATHER_ESP32S2_REVTFT.yml +25 -0
- data/vendor/board-maps/yaml/ADAFRUIT_FEATHER_ESP32S2_TFT.yml +27 -0
- data/vendor/board-maps/yaml/ADAFRUIT_FEATHER_ESP32S3.yml +29 -0
- data/vendor/board-maps/yaml/ADAFRUIT_FEATHER_ESP32S3_NOPSRAM.yml +29 -0
- data/vendor/board-maps/yaml/ADAFRUIT_FEATHER_ESP32S3_REVTFT.yml +25 -0
- data/vendor/board-maps/yaml/ADAFRUIT_FEATHER_ESP32S3_TFT.yml +27 -0
- data/vendor/board-maps/yaml/ADAFRUIT_FEATHER_ESP32_V2.yml +30 -0
- data/vendor/board-maps/yaml/ADAFRUIT_FEATHER_RP2040.yml +48 -0
- data/vendor/board-maps/yaml/ADAFRUIT_FEATHER_RP2040_CAN.yml +48 -0
- data/vendor/board-maps/yaml/ADAFRUIT_FEATHER_RP2040_DVI.yml +48 -0
- data/vendor/board-maps/yaml/ADAFRUIT_FEATHER_RP2040_PROP_MAKER.yml +48 -0
- data/vendor/board-maps/yaml/ADAFRUIT_FEATHER_RP2040_RFM.yml +48 -0
- data/vendor/board-maps/yaml/ADAFRUIT_FEATHER_RP2040_SCORPIO.yml +48 -0
- data/vendor/board-maps/yaml/ADAFRUIT_FEATHER_RP2040_THINKINK.yml +48 -0
- data/vendor/board-maps/yaml/ADAFRUIT_FEATHER_RP2040_USB_HOST.yml +48 -0
- data/vendor/board-maps/yaml/ADAFRUIT_ITSYBITSY_ESP32.yml +24 -0
- data/vendor/board-maps/yaml/ADAFRUIT_ITSYBITSY_RP2040.yml +48 -0
- data/vendor/board-maps/yaml/ADAFRUIT_KB2040_RP2040.yml +48 -0
- data/vendor/board-maps/yaml/ADAFRUIT_MACROPAD_RP2040.yml +48 -0
- data/vendor/board-maps/yaml/ADAFRUIT_MATRIXPORTAL_ESP32S3.yml +16 -0
- data/vendor/board-maps/yaml/ADAFRUIT_QTPY_ESP32C3.yml +12 -0
- data/vendor/board-maps/yaml/ADAFRUIT_QTPY_ESP32S2.yml +22 -0
- data/vendor/board-maps/yaml/ADAFRUIT_QTPY_ESP32S3_NOPSRAM.yml +20 -0
- data/vendor/board-maps/yaml/ADAFRUIT_QTPY_ESP32_PICO.yml +27 -0
- data/vendor/board-maps/yaml/ADAFRUIT_QTPY_RP2040.yml +48 -0
- data/vendor/board-maps/yaml/ADAFRUIT_STEMMAFRIEND_RP2040.yml +48 -0
- data/vendor/board-maps/yaml/ADAFRUIT_TRINKEYQT_RP2040.yml +48 -0
- data/vendor/board-maps/yaml/ALKS.yml +34 -0
- data/vendor/board-maps/yaml/AMPERKA_WIFI_SLOT.yml +16 -0
- data/vendor/board-maps/yaml/AVR_ADK.yml +24 -0
- data/vendor/board-maps/yaml/AVR_BT.yml +16 -0
- data/vendor/board-maps/yaml/AVR_CIRCUITPLAY.yml +14 -0
- data/vendor/board-maps/yaml/AVR_DUEMILANOVE.yml +16 -0
- data/vendor/board-maps/yaml/AVR_ESPLORA.yml +20 -0
- data/vendor/board-maps/yaml/AVR_ETHERNET.yml +16 -0
- data/vendor/board-maps/yaml/AVR_FIO.yml +16 -0
- data/vendor/board-maps/yaml/AVR_GEMMA.yml +6 -0
- data/vendor/board-maps/yaml/AVR_INDUSTRIAL101.yml +20 -0
- data/vendor/board-maps/yaml/AVR_LEONARDO.yml +20 -0
- data/vendor/board-maps/yaml/AVR_LEONARDO_ETH.yml +20 -0
- data/vendor/board-maps/yaml/AVR_LILYPAD.yml +16 -0
- data/vendor/board-maps/yaml/AVR_LILYPAD_USB.yml +20 -0
- data/vendor/board-maps/yaml/AVR_LININO_ONE.yml +20 -0
- data/vendor/board-maps/yaml/AVR_MEGA.yml +24 -0
- data/vendor/board-maps/yaml/AVR_MEGA2560.yml +24 -0
- data/vendor/board-maps/yaml/AVR_MICRO.yml +20 -0
- data/vendor/board-maps/yaml/AVR_MINI.yml +16 -0
- data/vendor/board-maps/yaml/AVR_NANO.yml +16 -0
- data/vendor/board-maps/yaml/AVR_NANO_EVERY.yml +22 -0
- data/vendor/board-maps/yaml/AVR_NG.yml +16 -0
- data/vendor/board-maps/yaml/AVR_PRO.yml +16 -0
- data/vendor/board-maps/yaml/AVR_ROBOT_CONTROL.yml +22 -0
- data/vendor/board-maps/yaml/AVR_ROBOT_MOTOR.yml +19 -0
- data/vendor/board-maps/yaml/AVR_UNO.yml +16 -0
- data/vendor/board-maps/yaml/AVR_UNO_WIFI_DEV_ED.yml +16 -0
- data/vendor/board-maps/yaml/AVR_UNO_WIFI_REV2.yml +22 -0
- data/vendor/board-maps/yaml/AVR_YUN.yml +20 -0
- data/vendor/board-maps/yaml/AVR_YUNMINI.yml +20 -0
- data/vendor/board-maps/yaml/AirM2M_CORE_ESP32C3.yml +14 -0
- data/vendor/board-maps/yaml/BEE_DATA_LOGGER.yml +39 -0
- data/vendor/board-maps/yaml/BPI_BIT.yml +9 -0
- data/vendor/board-maps/yaml/BPI_LEAF_S3.yml +31 -0
- data/vendor/board-maps/yaml/BRIDGETEK_IDM2040-7A.yml +48 -0
- data/vendor/board-maps/yaml/BeeMotionS3.yml +40 -0
- data/vendor/board-maps/yaml/Bee_Motion.yml +27 -0
- data/vendor/board-maps/yaml/Bee_Motion_Mini.yml +1 -0
- data/vendor/board-maps/yaml/Bee_S3.yml +38 -0
- data/vendor/board-maps/yaml/CHALLENGER_2040_LORA_RP2040.yml +39 -0
- data/vendor/board-maps/yaml/CHALLENGER_2040_LTE_RP2040.yml +38 -0
- data/vendor/board-maps/yaml/CHALLENGER_2040_NFC_RP2040.yml +32 -0
- data/vendor/board-maps/yaml/CHALLENGER_2040_SDRTC_RP2040.yml +36 -0
- data/vendor/board-maps/yaml/CHALLENGER_2040_SUBGHZ_RP2040.yml +39 -0
- data/vendor/board-maps/yaml/CHALLENGER_2040_UWB_RP2040.yml +39 -0
- data/vendor/board-maps/yaml/CHALLENGER_2040_WIFI_BLE_RP2040.yml +42 -0
- data/vendor/board-maps/yaml/CHALLENGER_2040_WIFI_RP2040.yml +38 -0
- data/vendor/board-maps/yaml/CHALLENGER_NB_2040_WIFI_RP2040.yml +38 -0
- data/vendor/board-maps/yaml/CRABIK_SLOT_ESP32_S3.yml +19 -0
- data/vendor/board-maps/yaml/CYTRON_MAKER_FEATHER_AIOT_S3.yml +26 -0
- data/vendor/board-maps/yaml/CYTRON_MAKER_NANO_RP2040.yml +48 -0
- data/vendor/board-maps/yaml/CYTRON_MAKER_PI_RP2040.yml +48 -0
- data/vendor/board-maps/yaml/CoreESP32.yml +49 -0
- data/vendor/board-maps/yaml/D1_MINI32.yml +36 -0
- data/vendor/board-maps/yaml/D1_UNO32.yml +28 -0
- data/vendor/board-maps/yaml/DATANOISETV_PICOADK.yml +48 -0
- data/vendor/board-maps/yaml/DENKY.yml +26 -0
- data/vendor/board-maps/yaml/DENKY_PICOV3.yml +26 -0
- data/vendor/board-maps/yaml/DENKY_WROOM32.yml +26 -0
- data/vendor/board-maps/yaml/DEPARTMENT_OF_ALCHEMY_MINIMAIN_ESP32S2.yml +26 -0
- data/vendor/board-maps/yaml/DFROBOT_BEETLE_ESP32_C3.yml +14 -0
- data/vendor/board-maps/yaml/DFROBOT_BEETLE_RP2040.yml +48 -0
- data/vendor/board-maps/yaml/DFROBOT_FIREBEETLE_2_ESP32E.yml +44 -0
- data/vendor/board-maps/yaml/DFROBOT_FIREBEETLE_2_ESP32S3.yml +38 -0
- data/vendor/board-maps/yaml/DFROBOT_ROMEO_ESP32S3.yml +7 -0
- data/vendor/board-maps/yaml/DPU_ESP32.yml +26 -0
- data/vendor/board-maps/yaml/DYDK.yml +38 -0
- data/vendor/board-maps/yaml/DYDK1A.yml +37 -0
- data/vendor/board-maps/yaml/DYDK1Av2.yml +45 -0
- data/vendor/board-maps/yaml/DYG.yml +20 -0
- data/vendor/board-maps/yaml/DYM.yml +40 -0
- data/vendor/board-maps/yaml/DYMv2.yml +39 -0
- data/vendor/board-maps/yaml/D_Duino_32.yml +29 -0
- data/vendor/board-maps/yaml/ELECTRONICCATS_HUNTERCAT_NFC.yml +44 -0
- data/vendor/board-maps/yaml/ESP320.yml +8 -0
- data/vendor/board-maps/yaml/ESP32C3_DEV.yml +14 -0
- data/vendor/board-maps/yaml/ESP32C3_M1_I_KIT.yml +13 -0
- data/vendor/board-maps/yaml/ESP32S2_DEV.yml +33 -0
- data/vendor/board-maps/yaml/ESP32S2_THING_PLUS.yml +34 -0
- data/vendor/board-maps/yaml/ESP32S2_USB.yml +33 -0
- data/vendor/board-maps/yaml/ESP32S3_CAM_LCD.yml +7 -0
- data/vendor/board-maps/yaml/ESP32S3_DEV.yml +38 -0
- data/vendor/board-maps/yaml/ESP32_DEV.yml +26 -0
- data/vendor/board-maps/yaml/ESP32_DEVKIT_LIPO.yml +26 -0
- data/vendor/board-maps/yaml/ESP32_EVB.yml +7 -0
- data/vendor/board-maps/yaml/ESP32_GATEWAY.yml +13 -0
- data/vendor/board-maps/yaml/ESP32_GATEWAY_C.yml +13 -0
- data/vendor/board-maps/yaml/ESP32_GATEWAY_E.yml +13 -0
- data/vendor/board-maps/yaml/ESP32_GATEWAY_F.yml +13 -0
- data/vendor/board-maps/yaml/ESP32_IOT_REDBOARD.yml +27 -0
- data/vendor/board-maps/yaml/ESP32_MICROMOD.yml +24 -0
- data/vendor/board-maps/yaml/ESP32_PICO.yml +26 -0
- data/vendor/board-maps/yaml/ESP32_POE.yml +7 -0
- data/vendor/board-maps/yaml/ESP32_POE_ISO.yml +7 -0
- data/vendor/board-maps/yaml/ESP32_S3_BOX.yml +16 -0
- data/vendor/board-maps/yaml/ESP32_S3_USB_OTG.yml +11 -0
- data/vendor/board-maps/yaml/ESP32_THING.yml +27 -0
- data/vendor/board-maps/yaml/ESP32_THING_PLUS.yml +30 -0
- data/vendor/board-maps/yaml/ESP32_THING_PLUS_C.yml +30 -0
- data/vendor/board-maps/yaml/ESP32_WROOM_DA.yml +26 -0
- data/vendor/board-maps/yaml/ESP32_WROVER_KIT.yml +26 -0
- data/vendor/board-maps/yaml/ESP8266_ADAFRUIT_HUZZAH.yml +9 -0
- data/vendor/board-maps/yaml/ESP8266_AGRUMINO_LEMON_V4.yml +8 -0
- data/vendor/board-maps/yaml/ESP8266_ARDUINO_PRIMO.yml +7 -0
- data/vendor/board-maps/yaml/ESP8266_ARDUINO_STAR_OTTO.yml +7 -0
- data/vendor/board-maps/yaml/ESP8266_ARDUINO_UNOWIFI.yml +9 -0
- data/vendor/board-maps/yaml/ESP8266_ESP01.yml +9 -0
- data/vendor/board-maps/yaml/ESP8266_ESP07.yml +20 -0
- data/vendor/board-maps/yaml/ESP8266_ESP12.yml +20 -0
- data/vendor/board-maps/yaml/ESP8266_ESP13.yml +17 -0
- data/vendor/board-maps/yaml/ESP8266_ESP210.yml +9 -0
- data/vendor/board-maps/yaml/ESP8266_ESPECTRO_CORE.yml +9 -0
- data/vendor/board-maps/yaml/ESP8266_ESPINO_ESP12.yml +9 -0
- data/vendor/board-maps/yaml/ESP8266_ESPINO_ESP13.yml +9 -0
- data/vendor/board-maps/yaml/ESP8266_ESPRESSO_LITE_V1.yml +9 -0
- data/vendor/board-maps/yaml/ESP8266_ESPRESSO_LITE_V2.yml +9 -0
- data/vendor/board-maps/yaml/ESP8266_GENERIC.yml +9 -0
- data/vendor/board-maps/yaml/ESP8266_INVENT_ONE.yml +22 -0
- data/vendor/board-maps/yaml/ESP8266_NODEMCU_ESP12.yml +20 -0
- data/vendor/board-maps/yaml/ESP8266_NODEMCU_ESP12E.yml +20 -0
- data/vendor/board-maps/yaml/ESP8266_OAK.yml +9 -0
- data/vendor/board-maps/yaml/ESP8266_PHOENIX_V1.yml +9 -0
- data/vendor/board-maps/yaml/ESP8266_PHOENIX_V2.yml +9 -0
- data/vendor/board-maps/yaml/ESP8266_SCHIRMILABS_EDUINO_WIFI.yml +25 -0
- data/vendor/board-maps/yaml/ESP8266_SONOFF_BASIC.yml +9 -0
- data/vendor/board-maps/yaml/ESP8266_SONOFF_S20.yml +9 -0
- data/vendor/board-maps/yaml/ESP8266_SONOFF_SV.yml +9 -0
- data/vendor/board-maps/yaml/ESP8266_SONOFF_TH.yml +9 -0
- data/vendor/board-maps/yaml/ESP8266_THING.yml +9 -0
- data/vendor/board-maps/yaml/ESP8266_THING_DEV.yml +9 -0
- data/vendor/board-maps/yaml/ESP8266_WEMOS_D1MINI.yml +18 -0
- data/vendor/board-maps/yaml/ESP8266_WEMOS_D1MINILITE.yml +18 -0
- data/vendor/board-maps/yaml/ESP8266_WEMOS_D1MINIPRO.yml +18 -0
- data/vendor/board-maps/yaml/ESP8266_WEMOS_D1R1.yml +25 -0
- data/vendor/board-maps/yaml/ESP8266_WEMOS_D1WROOM02.yml +18 -0
- data/vendor/board-maps/yaml/ESP8266_WIO_LINK.yml +9 -0
- data/vendor/board-maps/yaml/ESP8266_XINABOX_CW01.yml +9 -0
- data/vendor/board-maps/yaml/ESPECTRO32.yml +27 -0
- data/vendor/board-maps/yaml/ESPea32.yml +27 -0
- data/vendor/board-maps/yaml/ESPino32.yml +27 -0
- data/vendor/board-maps/yaml/ET-Board.yml +26 -0
- data/vendor/board-maps/yaml/EXTREMEELEXTRONICS_RC2040.yml +46 -0
- data/vendor/board-maps/yaml/Edgebox-ESP-100.yml +7 -0
- data/vendor/board-maps/yaml/FEATHERS2.yml +33 -0
- data/vendor/board-maps/yaml/FEATHERS2NEO.yml +30 -0
- data/vendor/board-maps/yaml/FEATHERS3.yml +29 -0
- data/vendor/board-maps/yaml/FEATHER_ESP32.yml +28 -0
- data/vendor/board-maps/yaml/FLYBOARD2040_CORE.yml +48 -0
- data/vendor/board-maps/yaml/FRANZININHO_WIFI.yml +33 -0
- data/vendor/board-maps/yaml/FRANZININHO_WIFI_MSC.yml +33 -0
- data/vendor/board-maps/yaml/FROG_ESP32.yml +26 -0
- data/vendor/board-maps/yaml/FUNHOUSE_ESP32S2.yml +22 -0
- data/vendor/board-maps/yaml/GEN4_IOD.yml +9 -0
- data/vendor/board-maps/yaml/GENERIC_RP2040.yml +48 -0
- data/vendor/board-maps/yaml/HEALTHYPI_4.yml +27 -0
- data/vendor/board-maps/yaml/HONEYLEMON.yml +27 -0
- data/vendor/board-maps/yaml/HORNBILL_ESP32_DEV.yml +27 -0
- data/vendor/board-maps/yaml/HORNBILL_ESP32_MINIMA.yml +16 -0
- data/vendor/board-maps/yaml/ILABS_2040_RPICO32_RP2040.yml +47 -0
- data/vendor/board-maps/yaml/IMBRIOS_LOGSENS_V1P1.yml +19 -0
- data/vendor/board-maps/yaml/INTOROBOT_ESP32_DEV.yml +34 -0
- data/vendor/board-maps/yaml/LILYGO_T_DISPLAY_S3.yml +26 -0
- data/vendor/board-maps/yaml/LOLIN32.yml +27 -0
- data/vendor/board-maps/yaml/LOLIN32_LITE.yml +27 -0
- data/vendor/board-maps/yaml/LOLIN_C3_MINI.yml +14 -0
- data/vendor/board-maps/yaml/LOLIN_D32.yml +27 -0
- data/vendor/board-maps/yaml/LOLIN_D32_PRO.yml +27 -0
- data/vendor/board-maps/yaml/LOLIN_S2_MINI.yml +34 -0
- data/vendor/board-maps/yaml/LOLIN_S2_PICO.yml +34 -0
- data/vendor/board-maps/yaml/LOLIN_S3.yml +32 -0
- data/vendor/board-maps/yaml/LOLIN_S3_MINI.yml +32 -0
- data/vendor/board-maps/yaml/LOLIN_S3_PRO.yml +32 -0
- data/vendor/board-maps/yaml/Lion_Bit_Dev_Board.yml +18 -0
- data/vendor/board-maps/yaml/LoPy.yml +27 -0
- data/vendor/board-maps/yaml/LoPy4.yml +27 -0
- data/vendor/board-maps/yaml/M5STACK_CORES3.yml +8 -0
- data/vendor/board-maps/yaml/M5STACK_Core2.yml +9 -0
- data/vendor/board-maps/yaml/M5STACK_FIRE.yml +10 -0
- data/vendor/board-maps/yaml/M5Stack-Timer-CAM.yml +10 -0
- data/vendor/board-maps/yaml/M5Stack_ATOM.yml +10 -0
- data/vendor/board-maps/yaml/M5Stack_ATOMS3.yml +7 -0
- data/vendor/board-maps/yaml/M5Stack_CoreInk.yml +9 -0
- data/vendor/board-maps/yaml/M5Stack_Core_ESP32.yml +10 -0
- data/vendor/board-maps/yaml/M5Stack_Station.yml +10 -0
- data/vendor/board-maps/yaml/M5Stick_C.yml +10 -0
- data/vendor/board-maps/yaml/MAGTAG29_ESP32S2.yml +21 -0
- data/vendor/board-maps/yaml/MELOPERO_COOKIE_RP2040.yml +48 -0
- data/vendor/board-maps/yaml/MELOPERO_SHAKE_RP2040.yml +48 -0
- data/vendor/board-maps/yaml/METRO_ESP32S2.yml +34 -0
- data/vendor/board-maps/yaml/MGBOT_IOTIK32A.yml +27 -0
- data/vendor/board-maps/yaml/MGBOT_IOTIK32B.yml +27 -0
- data/vendor/board-maps/yaml/MH_ET_LIVE_ESP32DEVKIT.yml +27 -0
- data/vendor/board-maps/yaml/MH_ET_LIVE_ESP32MINIKIT.yml +27 -0
- data/vendor/board-maps/yaml/MICROS2.yml +34 -0
- data/vendor/board-maps/yaml/MOD_WIFI_ESP8266.yml +9 -0
- data/vendor/board-maps/yaml/Metro.yml +8 -0
- data/vendor/board-maps/yaml/NANO32.yml +27 -0
- data/vendor/board-maps/yaml/NANO_RP2040_CONNECT.yml +35 -0
- data/vendor/board-maps/yaml/NEBULAS3.yml +33 -0
- data/vendor/board-maps/yaml/NEKOSYSTEMS_BL2040_MINI.yml +48 -0
- data/vendor/board-maps/yaml/NULLBITS_BIT_C_PRO.yml +48 -0
- data/vendor/board-maps/yaml/Node32s.yml +27 -0
- data/vendor/board-maps/yaml/NodeMCU_32S.yml +27 -0
- data/vendor/board-maps/yaml/ODROID_ESP32.yml +10 -0
- data/vendor/board-maps/yaml/ONEHORSE_ESP32_DEV.yml +24 -0
- data/vendor/board-maps/yaml/OROCA_EDUBOT.yml +33 -0
- data/vendor/board-maps/yaml/PIMORONI_PGA2040.yml +48 -0
- data/vendor/board-maps/yaml/PROS3.yml +28 -0
- data/vendor/board-maps/yaml/PYCOM_GPY.yml +27 -0
- data/vendor/board-maps/yaml/Piranha.yml +16 -0
- data/vendor/board-maps/yaml/Pocket32.yml +27 -0
- data/vendor/board-maps/yaml/QUANTUM.yml +26 -0
- data/vendor/board-maps/yaml/RASPBERRY_PI_PICO.yml +48 -0
- data/vendor/board-maps/yaml/RASPBERRY_PI_PICO_W.yml +48 -0
- data/vendor/board-maps/yaml/REDPILL_ESP32S3.yml +32 -0
- data/vendor/board-maps/yaml/RMP.yml +33 -0
- data/vendor/board-maps/yaml/SAMD_CIRCUITPLAYGROUND_EXPRESS.yml +12 -0
- data/vendor/board-maps/yaml/SAMD_MKR1000.yml +20 -0
- data/vendor/board-maps/yaml/SAMD_MKRFox1200.yml +19 -0
- data/vendor/board-maps/yaml/SAMD_MKRGSM1400.yml +15 -0
- data/vendor/board-maps/yaml/SAMD_MKRNB1500.yml +15 -0
- data/vendor/board-maps/yaml/SAMD_MKRVIDOR4000.yml +19 -0
- data/vendor/board-maps/yaml/SAMD_MKRWAN1300.yml +18 -0
- data/vendor/board-maps/yaml/SAMD_MKRWAN1310.yml +18 -0
- data/vendor/board-maps/yaml/SAMD_MKRWIFI1010.yml +19 -0
- data/vendor/board-maps/yaml/SAMD_MKRZERO.yml +19 -0
- data/vendor/board-maps/yaml/SAMD_NANO_33_IOT.yml +13 -0
- data/vendor/board-maps/yaml/SAMD_TIAN.yml +15 -0
- data/vendor/board-maps/yaml/SAMD_ZERO.yml +14 -0
- data/vendor/board-maps/yaml/SAM_DUE.yml +26 -0
- data/vendor/board-maps/yaml/SAM_ZERO.yml +15 -0
- data/vendor/board-maps/yaml/SEEED_INDICATOR_RP2040.yml +47 -0
- data/vendor/board-maps/yaml/SEEED_XIAO_RP2040.yml +29 -0
- data/vendor/board-maps/yaml/SOLDERPARTY_RP2040_STAMP.yml +48 -0
- data/vendor/board-maps/yaml/SONOFF_DUALR3.yml +26 -0
- data/vendor/board-maps/yaml/SPARKFUN_PROMICRO_RP2040.yml +48 -0
- data/vendor/board-maps/yaml/SPARKFUN_THINGPLUS_RP2040.yml +48 -0
- data/vendor/board-maps/yaml/STAMP_S3.yml +4 -0
- data/vendor/board-maps/yaml/TAMC_TERMOD_S3.yml +31 -0
- data/vendor/board-maps/yaml/TBEAM_USE_RADIO_SX1262.yml +23 -0
- data/vendor/board-maps/yaml/TBEAM_USE_RADIO_SX1268.yml +23 -0
- data/vendor/board-maps/yaml/TBEAM_USE_RADIO_SX1276.yml +23 -0
- data/vendor/board-maps/yaml/TBEAM_USE_RADIO_SX1278.yml +23 -0
- data/vendor/board-maps/yaml/TBEAM_USE_RADIO_SX1280.yml +23 -0
- data/vendor/board-maps/yaml/TBeam.yml +23 -0
- data/vendor/board-maps/yaml/TINYPICO.yml +26 -0
- data/vendor/board-maps/yaml/TINYS2.yml +33 -0
- data/vendor/board-maps/yaml/TINYS3.yml +25 -0
- data/vendor/board-maps/yaml/TTGO-T-OI-PLUS_DEV.yml +11 -0
- data/vendor/board-maps/yaml/TTGO_LoRa32_V1.yml +28 -0
- data/vendor/board-maps/yaml/TTGO_LoRa32_V2.yml +28 -0
- data/vendor/board-maps/yaml/TTGO_LoRa32_v21new.yml +28 -0
- data/vendor/board-maps/yaml/TTGO_T1.yml +27 -0
- data/vendor/board-maps/yaml/TTGO_T7_V13_Mini32.yml +27 -0
- data/vendor/board-maps/yaml/TTGO_T7_V14_Mini32.yml +27 -0
- data/vendor/board-maps/yaml/TWATCH_2020_V1.yml +10 -0
- data/vendor/board-maps/yaml/TWATCH_2020_V2.yml +10 -0
- data/vendor/board-maps/yaml/TWATCH_2020_V3.yml +10 -0
- data/vendor/board-maps/yaml/TWATCH_BASE.yml +10 -0
- data/vendor/board-maps/yaml/TWatch.yml +10 -0
- data/vendor/board-maps/yaml/Trueverit_ESP32_Universal_IoT_Driver.yml +18 -0
- data/vendor/board-maps/yaml/Trueverit_ESP32_Universal_IoT_Driver_MK_II.yml +18 -0
- data/vendor/board-maps/yaml/UBLOX_NINA_W10.yml +48 -0
- data/vendor/board-maps/yaml/UBLOX_NORA_W10.yml +43 -0
- data/vendor/board-maps/yaml/UPESY_RP2040_DEVKIT.yml +48 -0
- data/vendor/board-maps/yaml/VALTRACK_V4_MFW_ESP32_C3.yml +23 -0
- data/vendor/board-maps/yaml/VALTRACK_V4_VTS_ESP32_C3.yml +23 -0
- data/vendor/board-maps/yaml/VIYALAB_MIZU_RP2040.yml +48 -0
- data/vendor/board-maps/yaml/WATCHY.yml +7 -0
- data/vendor/board-maps/yaml/WATCHY_V10.yml +7 -0
- data/vendor/board-maps/yaml/WATCHY_V15.yml +7 -0
- data/vendor/board-maps/yaml/WATCHY_V20.yml +7 -0
- data/vendor/board-maps/yaml/WAVESHARE_RP2040_LCD_0_96.yml +47 -0
- data/vendor/board-maps/yaml/WAVESHARE_RP2040_LCD_1_28.yml +47 -0
- data/vendor/board-maps/yaml/WAVESHARE_RP2040_ONE.yml +47 -0
- data/vendor/board-maps/yaml/WAVESHARE_RP2040_PLUS.yml +48 -0
- data/vendor/board-maps/yaml/WAVESHARE_RP2040_ZERO.yml +47 -0
- data/vendor/board-maps/yaml/WESP32.yml +17 -0
- data/vendor/board-maps/yaml/WIDORA_AIR.yml +34 -0
- data/vendor/board-maps/yaml/WIFIDUINO_ESP8266.yml +23 -0
- data/vendor/board-maps/yaml/WIFINFO.yml +20 -0
- data/vendor/board-maps/yaml/WIPY3.yml +27 -0
- data/vendor/board-maps/yaml/WIZNET_5100S_EVB_PICO.yml +48 -0
- data/vendor/board-maps/yaml/WIZNET_5500_EVB_PICO.yml +48 -0
- data/vendor/board-maps/yaml/WIZNET_WIZFI360_EVB_PICO.yml +48 -0
- data/vendor/board-maps/yaml/WT32_ETH01.yml +8 -0
- data/vendor/board-maps/yaml/WiFiduino32S3.yml +27 -0
- data/vendor/board-maps/yaml/WiFiduinoV2.yml +27 -0
- data/vendor/board-maps/yaml/Wifiduino32.yml +40 -0
- data/vendor/board-maps/yaml/XIAO_ESP32C3.yml +22 -0
- data/vendor/board-maps/yaml/XIAO_ESP32S3.yml +36 -0
- data/vendor/board-maps/yaml/YD_RP2040.yml +48 -0
- data/vendor/board-maps/yaml/atmegazero_esp32s2.yml +30 -0
- data/vendor/board-maps/yaml/connaxio_espoir.yml +18 -0
- data/vendor/board-maps/yaml/esp32vn_iot_uno.yml +22 -0
- data/vendor/board-maps/yaml/fm_devkit.yml +15 -0
- data/vendor/board-maps/yaml/heltec_wifi_32_lora_V3.yml +31 -0
- data/vendor/board-maps/yaml/heltec_wifi_kit_32.yml +28 -0
- data/vendor/board-maps/yaml/heltec_wifi_kit_32_V3.yml +32 -0
- data/vendor/board-maps/yaml/heltec_wifi_lora_32.yml +27 -0
- data/vendor/board-maps/yaml/heltec_wifi_lora_32_V2.yml +27 -0
- data/vendor/board-maps/yaml/heltec_wireless_stick.yml +27 -0
- data/vendor/board-maps/yaml/heltec_wireless_stick_LITE.yml +27 -0
- data/vendor/board-maps/yaml/openkb.yml +27 -0
- data/vendor/board-maps/yaml/roboheart_hercules.yml +17 -0
- data/vendor/board-maps/yaml/sensesiot_weizen.yml +26 -0
- data/vendor/board-maps/yaml/uPesy_WROOM.yml +27 -0
- data/vendor/board-maps/yaml/uPesy_WROVER.yml +27 -0
- data/vendor/board-maps/yaml/unphone8.yml +32 -0
- data/vendor/board-maps/yaml/unphone9.yml +32 -0
- data/vendor/board-maps/yaml/wifi_kit_8.yml +15 -0
- metadata +800 -0
@@ -0,0 +1,282 @@
|
|
1
|
+
module Denko
|
2
|
+
module Display
|
3
|
+
class Canvas
|
4
|
+
include Denko::Fonts
|
5
|
+
|
6
|
+
attr_reader :columns, :rows, :framebuffer
|
7
|
+
|
8
|
+
def initialize(columns, rows)
|
9
|
+
raise ArgumentError, "bitmap height must be divisible by 8" unless (rows % 8 == 0)
|
10
|
+
|
11
|
+
@columns = columns
|
12
|
+
@rows = rows
|
13
|
+
|
14
|
+
# Use a byte array for the framebuffer. Each byte is 8 pixels arranged vertically.
|
15
|
+
# Each slice @columns long represents an area @columns wide * 8 pixels tall.
|
16
|
+
@bytes = @columns * (@rows / 8)
|
17
|
+
@framebuffer = Array.new(@bytes) { 0x00 }
|
18
|
+
end
|
19
|
+
|
20
|
+
def fill
|
21
|
+
@framebuffer.fill(0xFF)
|
22
|
+
end
|
23
|
+
|
24
|
+
def clear
|
25
|
+
@framebuffer.fill(0x00)
|
26
|
+
end
|
27
|
+
|
28
|
+
def get_pixel(x, y)
|
29
|
+
byte = ((y / 8) * @columns) + x
|
30
|
+
bit = y % 8
|
31
|
+
(@framebuffer[byte] >> bit) & 0b00000001
|
32
|
+
end
|
33
|
+
|
34
|
+
def set_pixel(x, y)
|
35
|
+
byte = ((y / 8) * @columns) + x
|
36
|
+
bit = y % 8
|
37
|
+
@framebuffer[byte] |= (0b1 << bit)
|
38
|
+
end
|
39
|
+
|
40
|
+
def clear_pixel(x, y)
|
41
|
+
byte = ((y / 8) * @columns) + x
|
42
|
+
bit = y % 8
|
43
|
+
@framebuffer[byte] &= ~(0b1 << bit)
|
44
|
+
end
|
45
|
+
|
46
|
+
def pixel(x, y, state=0)
|
47
|
+
(state == 0) ? clear_pixel(x, y) : set_pixel(x, y)
|
48
|
+
end
|
49
|
+
|
50
|
+
# Draw a line based on Bresenham's line algorithm.
|
51
|
+
def line(x1, y1, x2, y2, color=1)
|
52
|
+
# Deltas in each axis.
|
53
|
+
dy = y2 - y1
|
54
|
+
dx = x2 - x1
|
55
|
+
|
56
|
+
# Catch vertical lines to avoid division by 0.
|
57
|
+
if (dx == 0)
|
58
|
+
# Ensure y1 < y2.
|
59
|
+
y1, y2 = y2, y1 if (y2 < y1)
|
60
|
+
(y1..y2).each do |y|
|
61
|
+
pixel(x1, y, color)
|
62
|
+
end
|
63
|
+
return
|
64
|
+
end
|
65
|
+
|
66
|
+
gradient = dy.to_f / dx
|
67
|
+
|
68
|
+
# Gradient magnitude <= 45 degrees: find y for each x.
|
69
|
+
if (gradient >= -1) && (gradient <= 1)
|
70
|
+
# Ensure x1 < x2.
|
71
|
+
x1, y1, x2, y2 = x2, y2, x1, y1 if (x2 < x1)
|
72
|
+
|
73
|
+
# When x increments, add gradient to y.
|
74
|
+
y = y1
|
75
|
+
y_step = gradient
|
76
|
+
(x1..x2).each do |x|
|
77
|
+
pixel(x, y.round, color)
|
78
|
+
y = y + y_step
|
79
|
+
end
|
80
|
+
|
81
|
+
# Gradient magnitude > 45 degrees: find x for each y.
|
82
|
+
else
|
83
|
+
# Ensure y1 < y2.
|
84
|
+
x1, y1, x2, y2 = x2, y2, x1, y1 if (y2 < y1)
|
85
|
+
|
86
|
+
# When y increments, add inverse of gradient to x.
|
87
|
+
x = x1
|
88
|
+
x_step = 1 / gradient
|
89
|
+
(y1..y2).each do |y|
|
90
|
+
pixel(x.round, y, color)
|
91
|
+
x = x + x_step
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
# Rectangles and squares as a combination of lines.
|
97
|
+
def rectangle(x, y, width, height, color=1)
|
98
|
+
line(x, y, x+width, y, color)
|
99
|
+
line(x+width, y, x+width, y+height, color)
|
100
|
+
line(x+width, y+height, x, y+height, color)
|
101
|
+
line(x, y+height, x, y, color)
|
102
|
+
end
|
103
|
+
|
104
|
+
# Draw a vertical line for every x value to get a filled rectangle.
|
105
|
+
def filled_rectangle(x, y_start, width, height, color=1)
|
106
|
+
y_end = y_start + height
|
107
|
+
y_start, y_end = y_end, y_start if (y_end < y_start)
|
108
|
+
(y_start..y_end).each do |y|
|
109
|
+
line(x, y, x+width, y, color)
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
# Open ended path
|
114
|
+
def path(points=[], color=1)
|
115
|
+
return unless points
|
116
|
+
start = points[0]
|
117
|
+
(1..points.length-1).each do |i|
|
118
|
+
finish = points[i]
|
119
|
+
line(start[0], start[1], finish[0], finish[1])
|
120
|
+
start = finish
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
# Close paths by repeating the start value at the end.
|
125
|
+
def polygon(points=[], color=1)
|
126
|
+
points << points[0]
|
127
|
+
path(points)
|
128
|
+
end
|
129
|
+
|
130
|
+
# Filled polygon using horizontal ray casting + stroked polygon.
|
131
|
+
def filled_polygon(points=[], color=1)
|
132
|
+
# Get all the X and Y coordinates from the points as floats.
|
133
|
+
coords_x = points.map { |point| point.first.to_f }
|
134
|
+
coords_y = points.map { |point| point.last.to_f }
|
135
|
+
|
136
|
+
# Get Y bounds of the polygon to limit rows.
|
137
|
+
y_min = coords_y.min.to_i
|
138
|
+
y_max = coords_y.max.to_i
|
139
|
+
|
140
|
+
# Cast horizontal ray on each row, storing nodes where it intersects polygon edges.
|
141
|
+
(y_min..y_max).each do |y|
|
142
|
+
nodes = []
|
143
|
+
i = 0
|
144
|
+
j = points.count - 1
|
145
|
+
|
146
|
+
while (i < points.count) do
|
147
|
+
if (coords_y[i] < y && coords_y[j] >= y || coords_y[j] < y && coords_y[i] >= y)
|
148
|
+
nodes << (coords_x[i] + (y - coords_y[i]) / (coords_y[j] - coords_y[i]) *(coords_x[j] - coords_x[i])).round
|
149
|
+
end
|
150
|
+
j = i
|
151
|
+
i += 1
|
152
|
+
end
|
153
|
+
nodes = nodes.sort
|
154
|
+
|
155
|
+
# Take pairs of nodes and fill between them. This automatically ignores the spaces
|
156
|
+
# between even then odd nodes, which are outside the polygon.
|
157
|
+
nodes.each_slice(2) do |pair|
|
158
|
+
next if pair.length < 2
|
159
|
+
line(pair.first, y, pair.last, y, color)
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
# Stroke the polygon anyway. Floating point math misses thin areas.
|
164
|
+
polygon(points, color)
|
165
|
+
end
|
166
|
+
|
167
|
+
# Triangle with 3 points as 6 flat args.
|
168
|
+
def triangle(x1, y1, x2, y2, x3, y3, color=1)
|
169
|
+
polygon([[x1,y1], [x2,y2], [x3,y3]], color)
|
170
|
+
end
|
171
|
+
|
172
|
+
# Filled triangle with 3 points as 6 flat args.
|
173
|
+
def filled_triangle(x1, y1, x2, y2, x3, y3, color=1)
|
174
|
+
filled_polygon([[x1,y1], [x2,y2], [x3,y3]], color)
|
175
|
+
end
|
176
|
+
|
177
|
+
# Midpoint ellipse / circle based on Bresenham's circle algorithm.
|
178
|
+
def ellipse(x_center, y_center, a, b, color=1, filled=false)
|
179
|
+
# Start position
|
180
|
+
x = -a
|
181
|
+
y = 0
|
182
|
+
|
183
|
+
# Precompute x and y increments for each step.
|
184
|
+
x_increment = 2 * b * b
|
185
|
+
y_increment = 2 * a * a
|
186
|
+
|
187
|
+
# Start errors
|
188
|
+
dx = (1 + (2 * x)) * b * b
|
189
|
+
dy = x * x
|
190
|
+
e1 = dx + dy
|
191
|
+
e2 = dx
|
192
|
+
|
193
|
+
# Since starting at max negative X, continue until x is 0.
|
194
|
+
while (x <= 0)
|
195
|
+
if filled
|
196
|
+
fill_quadrants(x_center, y_center, x, y, color)
|
197
|
+
else
|
198
|
+
stroke_quadrants(x_center, y_center, x, y, color)
|
199
|
+
end
|
200
|
+
|
201
|
+
e2 = 2 * e1
|
202
|
+
if (e2 >= dx)
|
203
|
+
x += 1
|
204
|
+
dx += x_increment
|
205
|
+
e1 += dx
|
206
|
+
end
|
207
|
+
if (e2 <= dy)
|
208
|
+
y += 1
|
209
|
+
dy += y_increment
|
210
|
+
e1 += dy
|
211
|
+
end
|
212
|
+
end
|
213
|
+
|
214
|
+
# Continue if y hasn't reached the vertical size.
|
215
|
+
while (y < b)
|
216
|
+
y += 1
|
217
|
+
pixel(x_center, y_center + y, color)
|
218
|
+
pixel(x_center, y_center - y, color)
|
219
|
+
end
|
220
|
+
end
|
221
|
+
|
222
|
+
def stroke_quadrants(x_center, y_center, x, y, color)
|
223
|
+
# Quadrants in order as if y-axis is reversed and going counter-clockwise from +ve X.
|
224
|
+
pixel(x_center - x, y_center - y, color)
|
225
|
+
pixel(x_center + x, y_center - y, color)
|
226
|
+
pixel(x_center + x, y_center + y, color)
|
227
|
+
pixel(x_center - x, y_center + y, color)
|
228
|
+
end
|
229
|
+
|
230
|
+
def fill_quadrants(x_center, y_center, x, y, color)
|
231
|
+
line(x_center - x, y_center + y, x_center + x, y_center + y, color)
|
232
|
+
line(x_center - x, y_center - y, x_center + x, y_center - y, color)
|
233
|
+
end
|
234
|
+
|
235
|
+
def circle(x_center, y_center, radius, color=1, filled=false)
|
236
|
+
ellipse(x_center, y_center, radius, radius, color, filled)
|
237
|
+
end
|
238
|
+
|
239
|
+
def filled_circle(x_center, y_center, radius, color=1)
|
240
|
+
ellipse(x_center, y_center, radius, radius, color, true)
|
241
|
+
end
|
242
|
+
|
243
|
+
def text_cursor=(array=[])
|
244
|
+
@text_cursor = array
|
245
|
+
end
|
246
|
+
|
247
|
+
def text_cursor
|
248
|
+
@text_cursor ||= [0, 7]
|
249
|
+
end
|
250
|
+
|
251
|
+
def print(str)
|
252
|
+
str.to_s.split("").each do |char|
|
253
|
+
print_char(char)
|
254
|
+
end
|
255
|
+
end
|
256
|
+
|
257
|
+
def print_char(char)
|
258
|
+
# 0th character in font is SPACE. Offset and limit to printable chars.
|
259
|
+
index = char.ord - 32
|
260
|
+
index = 0 if (index < 0 || index > 94)
|
261
|
+
char_map = FONT_6x8[index]
|
262
|
+
|
263
|
+
raw_char(char_map)
|
264
|
+
end
|
265
|
+
|
266
|
+
def raw_char(byte_array)
|
267
|
+
# Get the starting byte index.
|
268
|
+
page = text_cursor[1] / 8
|
269
|
+
byte_index = (@columns * page) + text_cursor[0]
|
270
|
+
|
271
|
+
# Replace those bytes in the framebuffer with the character.
|
272
|
+
byte_array.each do |byte|
|
273
|
+
@framebuffer[byte_index] = byte
|
274
|
+
byte_index += 1
|
275
|
+
end
|
276
|
+
|
277
|
+
# Increment the text cursor.
|
278
|
+
self.text_cursor[0] += byte_array.length
|
279
|
+
end
|
280
|
+
end
|
281
|
+
end
|
282
|
+
end
|
@@ -0,0 +1,266 @@
|
|
1
|
+
#
|
2
|
+
# Ruby implementation of Hitach HD44780 LCD support.
|
3
|
+
# Based on the Adafruit_LiquidCrystal library:
|
4
|
+
# https://github.com/adafruit/Adafruit_LiquidCrystal
|
5
|
+
#
|
6
|
+
module Denko
|
7
|
+
module Display
|
8
|
+
class HD44780
|
9
|
+
include Behaviors::MultiPin
|
10
|
+
|
11
|
+
# Commands
|
12
|
+
LCD_CLEARDISPLAY = 0x01
|
13
|
+
LCD_RETURNHOME = 0x02
|
14
|
+
LCD_ENTRYMODESET = 0x04
|
15
|
+
LCD_DISPLAYCONTROL = 0x08
|
16
|
+
LCD_CURSORSHIFT = 0x10
|
17
|
+
LCD_FUNCTIONSET = 0x20
|
18
|
+
LCD_SETCGRAMADDR = 0x40
|
19
|
+
LCD_SETDDRAMADDR = 0x80
|
20
|
+
|
21
|
+
# Flags for display entry mode
|
22
|
+
LCD_ENTRYRIGHT = 0x00
|
23
|
+
LCD_ENTRYLEFT = 0x02
|
24
|
+
LCD_ENTRYSHIFTINCREMENT = 0x01
|
25
|
+
LCD_ENTRYSHIFTDECREMENT = 0x00
|
26
|
+
|
27
|
+
# Flags for display on/off control
|
28
|
+
LCD_DISPLAYON = 0x04
|
29
|
+
LCD_DISPLAYOFF = 0x00
|
30
|
+
LCD_CURSORON = 0x02
|
31
|
+
LCD_CURSOROFF = 0x00
|
32
|
+
LCD_BLINKON = 0x01
|
33
|
+
LCD_BLINKOFF = 0x00
|
34
|
+
|
35
|
+
# Flags for display/cursor shift
|
36
|
+
LCD_DISPLAYMOVE = 0x08
|
37
|
+
LCD_CURSORMOVE = 0x00
|
38
|
+
LCD_MOVERIGHT = 0x04
|
39
|
+
LCD_MOVELEFT = 0x00
|
40
|
+
|
41
|
+
# Flags for function set
|
42
|
+
LCD_8BITMODE = 0x10
|
43
|
+
LCD_4BITMODE = 0x00
|
44
|
+
LCD_2LINE = 0x08
|
45
|
+
LCD_1LINE = 0x00
|
46
|
+
LCD_5x10DOTS = 0x04
|
47
|
+
LCD_5x8DOTS = 0x00
|
48
|
+
|
49
|
+
def initialize_pins(options={})
|
50
|
+
# All the required pins.
|
51
|
+
[:rs, :enable, :d4, :d5, :d6, :d7].each do |symbol|
|
52
|
+
proxy_pin(symbol, DigitalIO::Output)
|
53
|
+
end
|
54
|
+
|
55
|
+
# If any of d0-d3 was given, make them all non-optional.
|
56
|
+
lower_bits_optional = (self.pins.keys & [:d0, :d1, :d2, :d3]).empty?
|
57
|
+
[:d0, :d1, :d2, :d3].each do |symbol|
|
58
|
+
proxy_pin(symbol, DigitalIO::Output, optional: lower_bits_optional)
|
59
|
+
end
|
60
|
+
|
61
|
+
# RW pin is mostly hard-wired to ground, but can given.
|
62
|
+
proxy_pin(:rw, DigitalIO::Output, optional: true)
|
63
|
+
end
|
64
|
+
|
65
|
+
def after_initialize(options={})
|
66
|
+
super(options) if defined?(super)
|
67
|
+
|
68
|
+
# Default to 16x2 display if no options given.
|
69
|
+
@columns = options[:columns] || 16
|
70
|
+
@rows = options[:rows] || 2
|
71
|
+
|
72
|
+
# Create a fuction set byte to set up the LCD. These defaults equal 0x00.
|
73
|
+
@function = LCD_4BITMODE | LCD_1LINE | LCD_5x8DOTS
|
74
|
+
|
75
|
+
# Set 8-bit mode in the mask if d0-d3 are present.
|
76
|
+
if (d0 && d1 && d2 && d3)
|
77
|
+
@bits = 8
|
78
|
+
@function |= LCD_8BITMODE
|
79
|
+
else
|
80
|
+
@bits = 4
|
81
|
+
end
|
82
|
+
|
83
|
+
# Set 2 line (row) mode if needed.
|
84
|
+
@function |= LCD_2LINE if (@rows > 1)
|
85
|
+
|
86
|
+
# Some 1 line displays can use a 5x10 font.
|
87
|
+
@function |= LCD_5x10DOTS if options[:tall_font] && (@rows == 1)
|
88
|
+
|
89
|
+
# Offset memory address when moving cursor.
|
90
|
+
# Row 2 always starts at memory address 0x40.
|
91
|
+
# For 4 line LCDs:
|
92
|
+
# Row 3 is immediately after row 1, +16 or 20 bytes, depending on columns.
|
93
|
+
# Row 4 is immediately after row 2, +16 or 20 bytes, depending on columns.
|
94
|
+
@row_offsets = [0x00, 0x40, 0x00+@columns, 0x40+@columns]
|
95
|
+
|
96
|
+
# Wait 50ms for power to be > 2.7V, then pull everything low.
|
97
|
+
micro_delay(50000)
|
98
|
+
enable.low; rs.low; rw.low if rw
|
99
|
+
|
100
|
+
# Start in 4-bit mode.
|
101
|
+
if @bits == 4
|
102
|
+
# Keep setting 8-bit mode until ready.
|
103
|
+
command(0x03); micro_delay(4500)
|
104
|
+
command(0x03); micro_delay(4500)
|
105
|
+
command(0x03); micro_delay(150)
|
106
|
+
|
107
|
+
# Set 4-bit mode.
|
108
|
+
command(0x02)
|
109
|
+
|
110
|
+
# Or start in 8 bit mode.
|
111
|
+
else
|
112
|
+
command(LCD_FUNCTIONSET | @function)
|
113
|
+
micro_delay(4500)
|
114
|
+
command(LCD_FUNCTIONSET | @function)
|
115
|
+
micro_delay(150)
|
116
|
+
command(LCD_FUNCTIONSET | @function)
|
117
|
+
end
|
118
|
+
|
119
|
+
# Set functions (lines, font size, etc.).
|
120
|
+
command(LCD_FUNCTIONSET | @function)
|
121
|
+
|
122
|
+
# Start with cursor off and no cursor blink.
|
123
|
+
@control = LCD_DISPLAYON | LCD_CURSOROFF | LCD_BLINKOFF
|
124
|
+
display_on
|
125
|
+
clear
|
126
|
+
|
127
|
+
# Set entry mode defaults.
|
128
|
+
@mode = LCD_ENTRYLEFT | LCD_ENTRYSHIFTDECREMENT
|
129
|
+
command(LCD_ENTRYMODESET | @mode)
|
130
|
+
|
131
|
+
# Need this small delay to avoid garbage data on startup.
|
132
|
+
sleep 0.05
|
133
|
+
end
|
134
|
+
|
135
|
+
def clear
|
136
|
+
command(LCD_CLEARDISPLAY)
|
137
|
+
micro_delay(2000)
|
138
|
+
end
|
139
|
+
|
140
|
+
def home
|
141
|
+
command(LCD_RETURNHOME)
|
142
|
+
micro_delay(2000)
|
143
|
+
end
|
144
|
+
|
145
|
+
def set_cursor(col, row)
|
146
|
+
# Limit to the highest row, 0 indexed.
|
147
|
+
row = (@rows - 1) if row > (@rows - 1)
|
148
|
+
command(LCD_SETDDRAMADDR | (col + @row_offsets[row]))
|
149
|
+
end
|
150
|
+
alias :move_to :set_cursor
|
151
|
+
|
152
|
+
def print(text)
|
153
|
+
text.each_byte { |b| write b }
|
154
|
+
end
|
155
|
+
|
156
|
+
#
|
157
|
+
# Create a #key_on and #key_off method for each feature in this hash,
|
158
|
+
# using the constant in the value to send a control signal.
|
159
|
+
#
|
160
|
+
# Eg. #display_on and #display_off.
|
161
|
+
#
|
162
|
+
CONTROL_TOGGLES = {
|
163
|
+
display: LCD_DISPLAYON,
|
164
|
+
cursor: LCD_CURSORON,
|
165
|
+
blink: LCD_BLINKON,
|
166
|
+
}
|
167
|
+
CONTROL_TOGGLES.each_key do |key|
|
168
|
+
define_method (key.to_s << "_off").to_sym do
|
169
|
+
command LCD_DISPLAYCONTROL | (@control &= ~CONTROL_TOGGLES[key])
|
170
|
+
end
|
171
|
+
define_method (key.to_s << "_on") do
|
172
|
+
command LCD_DISPLAYCONTROL | (@control |= CONTROL_TOGGLES[key])
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
176
|
+
def left_to_right
|
177
|
+
@mode |= LCD_ENTRYLEFT
|
178
|
+
command(LCD_ENTRYMODESET | @mode)
|
179
|
+
end
|
180
|
+
|
181
|
+
def right_to_left
|
182
|
+
@mode &= ~LCD_ENTRYLEFT
|
183
|
+
command(LCD_ENTRYMODESET | @mode)
|
184
|
+
end
|
185
|
+
|
186
|
+
def scroll_left
|
187
|
+
command(LCD_CURSORSHIFT | LCD_DISPLAYMOVE | LCD_MOVELEFT)
|
188
|
+
end
|
189
|
+
|
190
|
+
def scroll_right
|
191
|
+
command(LCD_CURSORSHIFT | LCD_DISPLAYMOVE | LCD_MOVERIGHT)
|
192
|
+
end
|
193
|
+
|
194
|
+
def autoscroll_on
|
195
|
+
@mode |= LCD_ENTRYSHIFTINCREMENT;
|
196
|
+
command(LCD_ENTRYMODESET | @mode);
|
197
|
+
end
|
198
|
+
|
199
|
+
def autoscroll_off
|
200
|
+
@mode &= ~LCD_ENTRYSHIFTINCREMENT;
|
201
|
+
command(LCD_ENTRYMODESET | @mode);
|
202
|
+
end
|
203
|
+
|
204
|
+
# Define custom characters as bitmaps.
|
205
|
+
def create_char(location, bitmap)
|
206
|
+
location &= 0x7
|
207
|
+
command(LCD_SETCGRAMADDR | (location << 3))
|
208
|
+
bitmap.each { |byte| write byte }
|
209
|
+
end
|
210
|
+
|
211
|
+
def command(byte)
|
212
|
+
send(byte, board.low)
|
213
|
+
end
|
214
|
+
|
215
|
+
def write(byte);
|
216
|
+
send(byte, board.high)
|
217
|
+
end
|
218
|
+
|
219
|
+
def send(byte, rs_level)
|
220
|
+
# RS pin goes low to send commands, high to send data.
|
221
|
+
rs.write(rs_level) unless rs.state == rs_level
|
222
|
+
rw.low if rw
|
223
|
+
|
224
|
+
# Get the byte as a string of 0s and 1s, LSBFIRST.
|
225
|
+
bits_from_byte = byte.to_s(2).rjust(8, "0").reverse
|
226
|
+
|
227
|
+
# Write bits depending on connection.
|
228
|
+
@bits == 8 ? write8(bits_from_byte) : write4(bits_from_byte)
|
229
|
+
end
|
230
|
+
|
231
|
+
def write4(bits)
|
232
|
+
d4.write bits[4]
|
233
|
+
d5.write bits[5]
|
234
|
+
d6.write bits[6]
|
235
|
+
d7.write bits[7]
|
236
|
+
pulse_enable
|
237
|
+
d4.write bits[0]
|
238
|
+
d5.write bits[1]
|
239
|
+
d6.write bits[2]
|
240
|
+
d7.write bits[3]
|
241
|
+
pulse_enable
|
242
|
+
end
|
243
|
+
|
244
|
+
def write8(bits)
|
245
|
+
d0.write bits[0]
|
246
|
+
d1.write bits[1]
|
247
|
+
d2.write bits[2]
|
248
|
+
d3.write bits[3]
|
249
|
+
d4.write bits[4]
|
250
|
+
d5.write bits[5]
|
251
|
+
d6.write bits[6]
|
252
|
+
d7.write bits[7]
|
253
|
+
pulse_enable
|
254
|
+
end
|
255
|
+
|
256
|
+
def pulse_enable
|
257
|
+
enable.low
|
258
|
+
micro_delay 1
|
259
|
+
enable.high
|
260
|
+
micro_delay 1
|
261
|
+
enable.low
|
262
|
+
micro_delay 100
|
263
|
+
end
|
264
|
+
end
|
265
|
+
end
|
266
|
+
end
|