denko 0.13.0 → 0.13.2
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 +2 -4
- 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 +60 -0
- data/DEPS_CLI.md +8 -6
- data/DEPS_IDE.md +9 -7
- data/HARDWARE.md +98 -75
- data/README.md +48 -59
- data/benchmarks/i2c_ssd1306_refresh.rb +74 -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/examples/pulse_io/buzzer.rb +40 -0
- data/examples/sensor/aht20.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/bus_peripheral_addressed.rb +1 -1
- data/lib/denko/behaviors/component.rb +1 -1
- data/lib/denko/behaviors/input_pin.rb +3 -0
- data/lib/denko/behaviors/reader.rb +14 -13
- data/lib/denko/behaviors/single_pin.rb +1 -3
- data/lib/denko/behaviors/state.rb +1 -0
- 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/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 +6 -14
- data/lib/denko/one_wire/bus.rb +1 -1
- data/lib/denko/one_wire/{bus_enumeration.rb → bus_enumerator.rb} +16 -8
- data/lib/denko/one_wire/helper.rb +1 -1
- data/lib/denko/one_wire.rb +1 -1
- data/lib/denko/pulse_io/ir_transmitter.rb +1 -2
- data/lib/denko/sensor/ds18b20.rb +1 -1
- 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 +35 -50
- data/src/lib/Denko.cpp +23 -6
- data/src/lib/Denko.h +6 -16
- data/src/lib/DenkoCoreIO.cpp +3 -3
- data/src/lib/DenkoDefines.h +62 -16
- data/src/lib/DenkoEEPROM.cpp +9 -1
- data/src/lib/DenkoI2C.cpp +11 -9
- data/src/lib/DenkoLEDArray.cpp +1 -1
- data/target.yml +35 -1
- data/test/behaviors/reader_test.rb +8 -1
- data/test/board/helper_test.rb +0 -4
- data/test/display/hd44780_test.rb +10 -0
- data/test/led/seven_segment_test.rb +30 -8
- data/test/one_wire/bus_enumerator_test.rb +4 -0
- data/test/one_wire/helper_test.rb +5 -5
- data/test/sensor/ds18b20_test.rb +10 -0
- data/test/test_helper.rb +17 -2
- data/vendor/board-maps/.gitmodules +3 -0
- data/vendor/board-maps/BoardMap.h +40 -12
- data/vendor/board-maps/README.md +1 -0
- data/vendor/board-maps/lib/header_parser.rb +30 -5
- data/vendor/board-maps/run.rb +11 -1
- data/vendor/board-maps/yaml/ADAFRUIT_FEATHER_ESP32S3.yml +6 -1
- data/vendor/board-maps/yaml/ADAFRUIT_FEATHER_ESP32S3_NOPSRAM.yml +6 -1
- data/vendor/board-maps/yaml/ADAFRUIT_FEATHER_ESP32_V2.yml +5 -1
- data/vendor/board-maps/yaml/ADAFRUIT_QTPY_ESP32S3_N4R2.yml +20 -0
- data/vendor/board-maps/yaml/ADAFRUIT_QTPY_ESP32_PICO.yml +2 -1
- data/vendor/board-maps/yaml/ARTRONSHOP_RP2_NANO.yml +32 -0
- data/vendor/board-maps/yaml/AVR_CIRCUITPLAY.yml +1 -1
- data/vendor/board-maps/yaml/AVR_ESPLORA.yml +1 -1
- data/vendor/board-maps/yaml/AVR_INDUSTRIAL101.yml +1 -1
- data/vendor/board-maps/yaml/AVR_LEONARDO.yml +1 -1
- data/vendor/board-maps/yaml/AVR_LEONARDO_ETH.yml +1 -1
- data/vendor/board-maps/yaml/AVR_LILYPAD_USB.yml +1 -1
- data/vendor/board-maps/yaml/AVR_LININO_ONE.yml +1 -1
- data/vendor/board-maps/yaml/AVR_MICRO.yml +1 -1
- data/vendor/board-maps/yaml/AVR_ROBOT_CONTROL.yml +1 -1
- data/vendor/board-maps/yaml/AVR_ROBOT_MOTOR.yml +1 -1
- data/vendor/board-maps/yaml/AVR_YUN.yml +1 -1
- data/vendor/board-maps/yaml/AVR_YUNMINI.yml +1 -1
- data/vendor/board-maps/yaml/BPI_LEAF_S3.yml +11 -1
- data/vendor/board-maps/yaml/BeeMotionS3.yml +6 -1
- data/vendor/board-maps/yaml/Bee_Motion.yml +3 -0
- data/vendor/board-maps/yaml/Bee_S3.yml +1 -1
- data/vendor/board-maps/yaml/CHALLENGER_2040_WIFI6_BLE_RP2040.yml +42 -0
- data/vendor/board-maps/yaml/CYTRON_MAKER_FEATHER_AIOT_S3.yml +4 -1
- data/vendor/board-maps/yaml/CoreESP32.yml +5 -1
- data/vendor/board-maps/yaml/D1_MINI32.yml +10 -1
- data/vendor/board-maps/yaml/DENKY.yml +10 -1
- data/vendor/board-maps/yaml/DENKY_PICOV3.yml +10 -1
- data/vendor/board-maps/yaml/DENKY_WROOM32.yml +10 -1
- data/vendor/board-maps/yaml/DFROBOT_FIREBEETLE_2_ESP32E.yml +6 -1
- data/vendor/board-maps/yaml/DPU_ESP32.yml +10 -1
- data/vendor/board-maps/yaml/D_Duino_32.yml +9 -1
- data/vendor/board-maps/yaml/ESP32S2_DEV.yml +11 -1
- data/vendor/board-maps/yaml/ESP32S2_THING_PLUS.yml +11 -1
- data/vendor/board-maps/yaml/ESP32S2_USB.yml +11 -1
- data/vendor/board-maps/yaml/ESP32_DEV.yml +10 -1
- data/vendor/board-maps/yaml/ESP32_DEVKIT_LIPO.yml +10 -1
- data/vendor/board-maps/yaml/ESP32_IOT_REDBOARD.yml +10 -1
- data/vendor/board-maps/yaml/ESP32_PICO.yml +10 -1
- data/vendor/board-maps/yaml/ESP32_S3_BOX.yml +4 -1
- data/vendor/board-maps/yaml/ESP32_THING.yml +10 -1
- data/vendor/board-maps/yaml/ESP32_THING_PLUS.yml +4 -1
- data/vendor/board-maps/yaml/ESP32_THING_PLUS_C.yml +4 -1
- data/vendor/board-maps/yaml/ESP32_WROOM_DA.yml +10 -1
- data/vendor/board-maps/yaml/ESP32_WROVER_KIT.yml +10 -1
- data/vendor/board-maps/yaml/ESPECTRO32.yml +10 -1
- data/vendor/board-maps/yaml/ESPea32.yml +10 -1
- data/vendor/board-maps/yaml/ESPino32.yml +10 -1
- data/vendor/board-maps/yaml/FEATHERS2.yml +11 -1
- data/vendor/board-maps/yaml/FEATHERS2NEO.yml +2 -1
- data/vendor/board-maps/yaml/FEATHERS3.yml +3 -0
- data/vendor/board-maps/yaml/FEATHER_ESP32.yml +5 -1
- data/vendor/board-maps/yaml/FRANZININHO_WIFI.yml +11 -1
- data/vendor/board-maps/yaml/FRANZININHO_WIFI_MSC.yml +11 -1
- data/vendor/board-maps/yaml/FROG_ESP32.yml +10 -1
- data/vendor/board-maps/yaml/HEALTHYPI_4.yml +10 -1
- data/vendor/board-maps/yaml/HONEYLEMON.yml +10 -1
- data/vendor/board-maps/yaml/HORNBILL_ESP32_DEV.yml +10 -1
- data/vendor/board-maps/yaml/HORNBILL_ESP32_MINIMA.yml +4 -1
- data/vendor/board-maps/yaml/IMBRIOS_LOGSENS_V1P1.yml +5 -1
- data/vendor/board-maps/yaml/LILYGO_T_DISPLAY_S3.yml +7 -1
- data/vendor/board-maps/yaml/LOLIN32.yml +10 -1
- data/vendor/board-maps/yaml/LOLIN32_LITE.yml +10 -1
- data/vendor/board-maps/yaml/LOLIN_D32.yml +10 -1
- data/vendor/board-maps/yaml/LOLIN_D32_PRO.yml +10 -1
- data/vendor/board-maps/yaml/LOLIN_S2_MINI.yml +11 -1
- data/vendor/board-maps/yaml/LOLIN_S2_PICO.yml +11 -1
- data/vendor/board-maps/yaml/LOLIN_S3.yml +9 -1
- data/vendor/board-maps/yaml/LOLIN_S3_MINI.yml +9 -1
- data/vendor/board-maps/yaml/LOLIN_S3_PRO.yml +9 -1
- data/vendor/board-maps/yaml/LoPy.yml +11 -1
- data/vendor/board-maps/yaml/LoPy4.yml +11 -1
- data/vendor/board-maps/yaml/MAGTAG29_ESP32S2.yml +11 -1
- data/vendor/board-maps/yaml/METRO_ESP32S2.yml +11 -1
- data/vendor/board-maps/yaml/MGBOT_IOTIK32A.yml +10 -1
- data/vendor/board-maps/yaml/MGBOT_IOTIK32B.yml +10 -1
- data/vendor/board-maps/yaml/MH_ET_LIVE_ESP32DEVKIT.yml +10 -1
- data/vendor/board-maps/yaml/MH_ET_LIVE_ESP32MINIKIT.yml +10 -1
- data/vendor/board-maps/yaml/MICROS2.yml +11 -1
- data/vendor/board-maps/yaml/MINIMA.yml +15 -0
- data/vendor/board-maps/yaml/NANO32.yml +10 -1
- data/vendor/board-maps/yaml/Node32s.yml +10 -1
- data/vendor/board-maps/yaml/NodeMCU_32S.yml +10 -1
- data/vendor/board-maps/yaml/ONEHORSE_ESP32_DEV.yml +11 -1
- data/vendor/board-maps/yaml/PIMORONI_PLASMA2040.yml +29 -0
- data/vendor/board-maps/yaml/PORTENTA_C33.yml +28 -0
- data/vendor/board-maps/yaml/PROS3.yml +6 -1
- data/vendor/board-maps/yaml/PYCOM_GPY.yml +11 -1
- data/vendor/board-maps/yaml/Piranha.yml +7 -1
- data/vendor/board-maps/yaml/Pocket32.yml +10 -1
- data/vendor/board-maps/yaml/QUANTUM.yml +10 -1
- data/vendor/board-maps/yaml/REDPILL_ESP32S3.yml +11 -1
- data/vendor/board-maps/yaml/RMP.yml +11 -1
- data/vendor/board-maps/yaml/SAMD_CIRCUITPLAYGROUND_EXPRESS.yml +0 -1
- data/vendor/board-maps/yaml/SAM_DUE.yml +3 -1
- data/vendor/board-maps/yaml/SONOFF_DUALR3.yml +10 -1
- data/vendor/board-maps/yaml/TAMC_TERMOD_S3.yml +11 -1
- data/vendor/board-maps/yaml/TBEAM_USE_RADIO_SX1262.yml +6 -1
- data/vendor/board-maps/yaml/TBEAM_USE_RADIO_SX1268.yml +6 -1
- data/vendor/board-maps/yaml/TBEAM_USE_RADIO_SX1276.yml +6 -1
- data/vendor/board-maps/yaml/TBEAM_USE_RADIO_SX1278.yml +6 -1
- data/vendor/board-maps/yaml/TBEAM_USE_RADIO_SX1280.yml +6 -1
- data/vendor/board-maps/yaml/TBeam.yml +6 -1
- data/vendor/board-maps/yaml/TINYPICO.yml +10 -1
- data/vendor/board-maps/yaml/TINYS2.yml +11 -1
- data/vendor/board-maps/yaml/TTGO_LoRa32_V1.yml +11 -1
- data/vendor/board-maps/yaml/TTGO_LoRa32_V2.yml +11 -1
- data/vendor/board-maps/yaml/TTGO_LoRa32_v21new.yml +11 -1
- data/vendor/board-maps/yaml/TTGO_T1.yml +10 -1
- data/vendor/board-maps/yaml/TTGO_T7_V13_Mini32.yml +10 -1
- data/vendor/board-maps/yaml/TTGO_T7_V14_Mini32.yml +10 -1
- data/vendor/board-maps/yaml/TWATCH_2020_V1.yml +0 -1
- data/vendor/board-maps/yaml/TWATCH_2020_V2.yml +0 -1
- data/vendor/board-maps/yaml/TWATCH_2020_V3.yml +0 -1
- data/vendor/board-maps/yaml/TWATCH_BASE.yml +0 -1
- data/vendor/board-maps/yaml/TWatch.yml +0 -1
- data/vendor/board-maps/yaml/UBLOX_NINA_W10.yml +10 -1
- data/vendor/board-maps/yaml/UNOWIFIR4.yml +17 -0
- data/vendor/board-maps/yaml/WIPY3.yml +11 -1
- data/vendor/board-maps/yaml/XIAO_ESP32S3.yml +2 -1
- data/vendor/board-maps/yaml/connaxio_espoir.yml +7 -1
- data/vendor/board-maps/yaml/esp32vn_iot_uno.yml +10 -1
- data/vendor/board-maps/yaml/heltec_wifi_32_lora_V3.yml +11 -1
- data/vendor/board-maps/yaml/heltec_wifi_kit_32.yml +11 -1
- data/vendor/board-maps/yaml/heltec_wifi_kit_32_V3.yml +11 -1
- data/vendor/board-maps/yaml/heltec_wifi_lora_32.yml +10 -1
- data/vendor/board-maps/yaml/heltec_wifi_lora_32_V2.yml +10 -1
- data/vendor/board-maps/yaml/heltec_wireless_stick.yml +10 -1
- data/vendor/board-maps/yaml/heltec_wireless_stick_LITE.yml +10 -1
- data/vendor/board-maps/yaml/openkb.yml +11 -1
- data/vendor/board-maps/yaml/roboheart_hercules.yml +10 -1
- data/vendor/board-maps/yaml/sensesiot_weizen.yml +10 -1
- data/vendor/board-maps/yaml/uPesy_WROOM.yml +10 -1
- data/vendor/board-maps/yaml/uPesy_WROVER.yml +10 -1
- data/vendor/board-maps/yaml/unphone8.yml +11 -1
- data/vendor/board-maps/yaml/unphone9.yml +11 -1
- metadata +15 -3
@@ -51,13 +51,20 @@ class ReaderTest < Minitest::Test
|
|
51
51
|
assert_equal part.read, 42
|
52
52
|
end
|
53
53
|
|
54
|
-
def
|
54
|
+
def test_read_using_with_lambda
|
55
55
|
inject(1)
|
56
56
|
reader = MiniTest::Mock.new.expect :call, nil
|
57
57
|
part.read_using -> { reader.call }
|
58
58
|
reader.verify
|
59
59
|
end
|
60
60
|
|
61
|
+
def test_read_using_with_method_and_args
|
62
|
+
inject(1)
|
63
|
+
reader = MiniTest::Mock.new.expect :call, nil, [10, 20], test_arg: 2
|
64
|
+
part.read_using reader, 10, 20, test_arg: 2
|
65
|
+
reader.verify
|
66
|
+
end
|
67
|
+
|
61
68
|
def test_add_run_remove_callback
|
62
69
|
cb = MiniTest::Mock.new.expect :call, nil
|
63
70
|
inject(1)
|
data/test/board/helper_test.rb
CHANGED
@@ -20,10 +20,6 @@ class APIHelperTest < Minitest::Test
|
|
20
20
|
assert_equal pack(:uint8, [25,26]), "\x19\x1A"
|
21
21
|
end
|
22
22
|
|
23
|
-
def test_padding
|
24
|
-
assert_equal pack(:uint8, 25, pad: 2), "\x19\x00"
|
25
|
-
end
|
26
|
-
|
27
23
|
def test_min
|
28
24
|
assert_raises(ArgumentError) { pack(:uint8, 25, min: 2) }
|
29
25
|
end
|
@@ -20,4 +20,14 @@ class HD44780Test < MiniTest::Test
|
|
20
20
|
|
21
21
|
end
|
22
22
|
end
|
23
|
+
|
24
|
+
def test_write4
|
25
|
+
part.write4 "10100101"
|
26
|
+
|
27
|
+
# Pin states should match lower 4 bits, since they are sent last.
|
28
|
+
assert_equal 1, part.d4.state
|
29
|
+
assert_equal 0, part.d5.state
|
30
|
+
assert_equal 1, part.d6.state
|
31
|
+
assert_equal 0, part.d7.state
|
32
|
+
end
|
23
33
|
end
|
@@ -60,14 +60,17 @@ class SevenSegmentLEDTest < MiniTest::Test
|
|
60
60
|
end
|
61
61
|
|
62
62
|
def test_scroll
|
63
|
-
mock = MiniTest::Mock.new
|
64
|
-
|
65
|
-
|
63
|
+
mock = MiniTest::Mock.new
|
64
|
+
mock.expect :call, nil, ['H']
|
65
|
+
mock.expect :call, nil, ['I']
|
66
|
+
part.stub(:write, mock) do
|
67
|
+
part.display('hi')
|
66
68
|
end
|
67
69
|
mock.verify
|
68
70
|
end
|
69
71
|
|
70
72
|
def test_display_ensures_on
|
73
|
+
part.off
|
71
74
|
mock = MiniTest::Mock.new.expect :call, nil
|
72
75
|
part.stub(:on, mock) do
|
73
76
|
part.display(1)
|
@@ -75,12 +78,31 @@ class SevenSegmentLEDTest < MiniTest::Test
|
|
75
78
|
mock.verify
|
76
79
|
end
|
77
80
|
|
78
|
-
def
|
79
|
-
|
80
|
-
part.
|
81
|
-
|
81
|
+
def test_write_clears_if_unknown_char
|
82
|
+
# Turn all the segments on.
|
83
|
+
part.display('8')
|
84
|
+
|
85
|
+
# Expect every segment to get #write(1). Inverted logic because anode.
|
86
|
+
mocks = []
|
87
|
+
part.segments.each do
|
88
|
+
mocks << MiniTest::Mock.new.expect(:call, nil, [1])
|
82
89
|
end
|
83
|
-
|
90
|
+
part.segments[0].stub(:write, mocks[0]) do
|
91
|
+
part.segments[1].stub(:write, mocks[1]) do
|
92
|
+
part.segments[2].stub(:write, mocks[2]) do
|
93
|
+
part.segments[3].stub(:write, mocks[3]) do
|
94
|
+
part.segments[4].stub(:write, mocks[4]) do
|
95
|
+
part.segments[5].stub(:write, mocks[5]) do
|
96
|
+
part.segments[6].stub(:write, mocks[6]) do
|
97
|
+
part.display('+')
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
mocks.each { |mock| mock.verify}
|
84
106
|
end
|
85
107
|
# Test with cathode
|
86
108
|
end
|
@@ -131,4 +131,8 @@ class OneWireEnumeratorTest < Minitest::Test
|
|
131
131
|
found_addresses = bus.found_devices.map { |d| d[:address] }
|
132
132
|
assert_equal found_addresses.sort, bus_sim.addresses.sort
|
133
133
|
end
|
134
|
+
|
135
|
+
def test_includes_constants
|
136
|
+
assert Denko::OneWire::BusEnumerator.ancestors.include?(Denko::OneWire::Constants)
|
137
|
+
end
|
134
138
|
end
|
@@ -3,16 +3,16 @@ require_relative '../test_helper'
|
|
3
3
|
class OneWireHelper < Minitest::Test
|
4
4
|
|
5
5
|
def test_with_valid_crc
|
6
|
-
assert Denko::OneWire::Helper.
|
7
|
-
assert Denko::OneWire::Helper.
|
6
|
+
assert Denko::OneWire::Helper.crc(18086456125349333800)
|
7
|
+
assert Denko::OneWire::Helper.crc([121, 117, 144, 185, 6, 165, 43, 26])
|
8
8
|
end
|
9
9
|
|
10
10
|
def test_with_invalid_crc
|
11
|
-
refute Denko::OneWire::Helper.
|
11
|
+
refute Denko::OneWire::Helper.crc(18086456125349333801)
|
12
12
|
end
|
13
13
|
|
14
14
|
def test_arbitrary_length_read
|
15
|
-
assert Denko::OneWire::Helper.
|
16
|
-
refute Denko::OneWire::Helper.
|
15
|
+
assert Denko::OneWire::Helper.crc([181, 1, 75, 70, 127, 255, 11, 16, 163])
|
16
|
+
refute Denko::OneWire::Helper.crc([181, 1, 75, 70, 127, 255, 11, 16, 164])
|
17
17
|
end
|
18
18
|
end
|
data/test/sensor/ds18b20_test.rb
CHANGED
@@ -43,6 +43,16 @@ class DS18B20Test < MiniTest::Test
|
|
43
43
|
assert_equal 0.75, part.instance_variable_get(:@convert_time)
|
44
44
|
end
|
45
45
|
|
46
|
+
def test_pre_callback_filter_does_crc_and_returns_error_on_fail
|
47
|
+
raw_bytes = [239, 1, 75, 70, 127, 255, 1, 16, 245]
|
48
|
+
mock = MiniTest::Mock.new.expect(:call, false, [raw_bytes])
|
49
|
+
|
50
|
+
Denko::OneWire::Helper.stub(:crc, mock) do
|
51
|
+
assert_equal({crc_error: true}, part.pre_callback_filter(raw_bytes))
|
52
|
+
end
|
53
|
+
mock.verify
|
54
|
+
end
|
55
|
+
|
46
56
|
# test resolution=
|
47
57
|
|
48
58
|
def test_convert_is_atomic
|
data/test/test_helper.rb
CHANGED
@@ -100,7 +100,12 @@ module Constants
|
|
100
100
|
opts[:on].send(:remove_const, const) if self.class.const_defined?(const)
|
101
101
|
opts[:on].const_set(const, value)
|
102
102
|
end
|
103
|
-
|
103
|
+
# Imaginary handshake ack from the board. Not a real SAMD_ZERO device.
|
104
|
+
# Serial buffer = 256
|
105
|
+
# Aux size = 528
|
106
|
+
# EEPROM size = 1024
|
107
|
+
# I2C buffer = 32
|
108
|
+
ACK = "SAMD_ZERO,0.13.0,256,528,1024,32"
|
104
109
|
|
105
110
|
# Some test redefine RUBY_PLATFORM. Save the original to reset it.
|
106
111
|
ORIGINAL_RUBY_PLATFORM = RUBY_PLATFORM
|
@@ -137,6 +142,9 @@ class ConnectionMock
|
|
137
142
|
def handshake
|
138
143
|
Constants::ACK
|
139
144
|
end
|
145
|
+
def remote_buffer_size=(size)
|
146
|
+
@remote_buffer_size = size
|
147
|
+
end
|
140
148
|
end
|
141
149
|
|
142
150
|
class BoardMock < Denko::Board
|
@@ -211,7 +219,7 @@ module TestPacker
|
|
211
219
|
end
|
212
220
|
end
|
213
221
|
|
214
|
-
# Speed up
|
222
|
+
# Speed up tests which use long delays.
|
215
223
|
module Denko
|
216
224
|
module OneWire
|
217
225
|
class Bus
|
@@ -220,4 +228,11 @@ module Denko
|
|
220
228
|
end
|
221
229
|
end
|
222
230
|
end
|
231
|
+
module LED
|
232
|
+
class SevenSegment
|
233
|
+
def sleep(time)
|
234
|
+
super(0.001)
|
235
|
+
end
|
236
|
+
end
|
237
|
+
end
|
223
238
|
end
|
@@ -378,18 +378,6 @@
|
|
378
378
|
#define BOARD_MAP "ADAFRUIT_FEATHER_ESP32S2_REVTFT"
|
379
379
|
#endif
|
380
380
|
|
381
|
-
#ifdef ARDUINO_ADAFRUIT_QTPY_ESP32S2
|
382
|
-
#define BOARD_MAP "ADAFRUIT_QTPY_ESP32S2"
|
383
|
-
#endif
|
384
|
-
|
385
|
-
#ifdef ARDUINO_ADAFRUIT_QTPY_ESP32C3
|
386
|
-
#define BOARD_MAP "ADAFRUIT_QTPY_ESP32C3"
|
387
|
-
#endif
|
388
|
-
|
389
|
-
#ifdef ARDUINO_ADAFRUIT_QTPY_ESP32_PICO
|
390
|
-
#define BOARD_MAP "ADAFRUIT_QTPY_ESP32_PICO"
|
391
|
-
#endif
|
392
|
-
|
393
381
|
#ifdef ARDUINO_ADAFRUIT_FEATHER_ESP32_V2
|
394
382
|
#define BOARD_MAP "ADAFRUIT_FEATHER_ESP32_V2"
|
395
383
|
#endif
|
@@ -410,10 +398,26 @@
|
|
410
398
|
#define BOARD_MAP "ADAFRUIT_FEATHER_ESP32S3_REVTFT"
|
411
399
|
#endif
|
412
400
|
|
401
|
+
#ifdef ARDUINO_ADAFRUIT_QTPY_ESP32_PICO
|
402
|
+
#define BOARD_MAP "ADAFRUIT_QTPY_ESP32_PICO"
|
403
|
+
#endif
|
404
|
+
|
405
|
+
#ifdef ARDUINO_ADAFRUIT_QTPY_ESP32C3
|
406
|
+
#define BOARD_MAP "ADAFRUIT_QTPY_ESP32C3"
|
407
|
+
#endif
|
408
|
+
|
409
|
+
#ifdef ARDUINO_ADAFRUIT_QTPY_ESP32S2
|
410
|
+
#define BOARD_MAP "ADAFRUIT_QTPY_ESP32S2"
|
411
|
+
#endif
|
412
|
+
|
413
413
|
#ifdef ARDUINO_ADAFRUIT_QTPY_ESP32S3_NOPSRAM
|
414
414
|
#define BOARD_MAP "ADAFRUIT_QTPY_ESP32S3_NOPSRAM"
|
415
415
|
#endif
|
416
416
|
|
417
|
+
#ifdef ARDUINO_ADAFRUIT_QTPY_ESP32S3_N4R2
|
418
|
+
#define BOARD_MAP "ADAFRUIT_QTPY_ESP32S3_N4R2"
|
419
|
+
#endif
|
420
|
+
|
417
421
|
#ifdef ARDUINO_ADAFRUIT_ITSYBITSY_ESP32
|
418
422
|
#define BOARD_MAP "ADAFRUIT_ITSYBITSY_ESP32"
|
419
423
|
#endif
|
@@ -1142,6 +1146,10 @@
|
|
1142
1146
|
#define BOARD_MAP "NANO_RP2040_CONNECT"
|
1143
1147
|
#endif
|
1144
1148
|
|
1149
|
+
#ifdef ARDUINO_ARTRONSHOP_RP2_NANO
|
1150
|
+
#define BOARD_MAP "ARTRONSHOP_RP2_NANO"
|
1151
|
+
#endif
|
1152
|
+
|
1145
1153
|
#ifdef ARDUINO_BRIDGETEK_IDM2040-7A
|
1146
1154
|
#define BOARD_MAP "BRIDGETEK_IDM2040-7A"
|
1147
1155
|
#endif
|
@@ -1194,6 +1202,10 @@
|
|
1194
1202
|
#define BOARD_MAP "CHALLENGER_2040_WIFI_BLE_RP2040"
|
1195
1203
|
#endif
|
1196
1204
|
|
1205
|
+
#ifdef ARDUINO_CHALLENGER_2040_WIFI6_BLE_RP2040
|
1206
|
+
#define BOARD_MAP "CHALLENGER_2040_WIFI6_BLE_RP2040"
|
1207
|
+
#endif
|
1208
|
+
|
1197
1209
|
#ifdef ARDUINO_CHALLENGER_NB_2040_WIFI_RP2040
|
1198
1210
|
#define BOARD_MAP "CHALLENGER_NB_2040_WIFI_RP2040"
|
1199
1211
|
#endif
|
@@ -1234,6 +1246,10 @@
|
|
1234
1246
|
#define BOARD_MAP "PIMORONI_PGA2040"
|
1235
1247
|
#endif
|
1236
1248
|
|
1249
|
+
#ifdef ARDUINO_PIMORONI_PLASMA2040
|
1250
|
+
#define BOARD_MAP "PIMORONI_PLASMA2040"
|
1251
|
+
#endif
|
1252
|
+
|
1237
1253
|
#ifdef ARDUINO_SOLDERPARTY_RP2040_STAMP
|
1238
1254
|
#define BOARD_MAP "SOLDERPARTY_RP2040_STAMP"
|
1239
1255
|
#endif
|
@@ -1362,3 +1378,15 @@
|
|
1362
1378
|
#define BOARD_MAP "SAMD_TIAN"
|
1363
1379
|
#endif
|
1364
1380
|
|
1381
|
+
#ifdef ARDUINO_PORTENTA_C33
|
1382
|
+
#define BOARD_MAP "PORTENTA_C33"
|
1383
|
+
#endif
|
1384
|
+
|
1385
|
+
#ifdef ARDUINO_MINIMA
|
1386
|
+
#define BOARD_MAP "MINIMA"
|
1387
|
+
#endif
|
1388
|
+
|
1389
|
+
#ifdef ARDUINO_UNOWIFIR4
|
1390
|
+
#define BOARD_MAP "UNOWIFIR4"
|
1391
|
+
#endif
|
1392
|
+
|
data/vendor/board-maps/README.md
CHANGED
@@ -18,6 +18,7 @@ This is the exact use case this was deisgned for, in support of the [denko](http
|
|
18
18
|
- [megaavr](https://github.com/arduino/ArduinoCore-megaavr)
|
19
19
|
- [sam](https://github.com/arduino/ArduinoCore-sam)
|
20
20
|
- [samd](https://github.com/arduino/ArduinoCore-samd)
|
21
|
+
- [renesas](https://github.com/arduino/ArduinoCore-renesas)
|
21
22
|
- [esp8266](https://github.com/esp8266/Arduino)
|
22
23
|
- [esp32](https://github.com/espressif/arduino-esp32)
|
23
24
|
- [rp2040](https://github.com/earlephilhower/arduino-pico)
|
@@ -27,6 +27,9 @@ class HeaderParser
|
|
27
27
|
file.each_line do |line|
|
28
28
|
# Reject comments.
|
29
29
|
next if line.match /\A\/\//
|
30
|
+
|
31
|
+
# Reject anything to do with QSPI.
|
32
|
+
next if line.match /QSPI/
|
30
33
|
|
31
34
|
# Reject lines that end with pin-style identifiers, instead of numbers.
|
32
35
|
next if line.match /(PIN_)*(A|D|DAC|T)(\d+)\s*;*\s*\z/
|
@@ -41,22 +44,43 @@ class HeaderParser
|
|
41
44
|
|
42
45
|
# Match RP2040 analog overrides and store them with prefixed keys like :_A0
|
43
46
|
# Will substitute them later in #clean_map
|
44
|
-
rp2040_analog = line.match /__PIN(_A\d+)\s
|
47
|
+
rp2040_analog = line.match /__PIN(_A\d+)\s+\(?(\d+)\w*\)?/
|
45
48
|
if rp2040_analog
|
46
49
|
@map[rp2040_analog[1].to_sym] = rp2040_analog[2].to_i
|
47
50
|
next
|
48
51
|
end
|
49
52
|
|
50
53
|
#
|
51
|
-
# Match analog input
|
54
|
+
# Match analog input pins declared like:
|
52
55
|
# #define PIN_A0 (14ul)
|
53
|
-
# #define PIN_DAC0 (14)
|
54
56
|
# #define PIN_A0 14
|
55
57
|
# #define A0 14
|
56
58
|
#
|
57
|
-
pin = line.match /(PIN_)*(
|
59
|
+
pin = line.match /(PIN_)*(A\d+)\s+\(?(\d+)\w*\)?/
|
58
60
|
if pin
|
59
|
-
@map[pin[2].to_sym] = pin[
|
61
|
+
@map[pin[2].to_sym] = pin[3].to_i
|
62
|
+
next
|
63
|
+
end
|
64
|
+
|
65
|
+
#
|
66
|
+
# Strict matcher for DAC pins in Arduino SAMD core:
|
67
|
+
# #define DAC A0
|
68
|
+
# #define DAC1 14
|
69
|
+
#
|
70
|
+
pin = line.match /(PIN_)(DAC\d+)\s+\(?(\d+)\w*\)?/
|
71
|
+
if pin
|
72
|
+
@map[pin[2].to_sym] = pin[3].to_i
|
73
|
+
next
|
74
|
+
end
|
75
|
+
|
76
|
+
#
|
77
|
+
# Match I2C/SPI pins declared like: (first seen in UNO R4)
|
78
|
+
# #define WIRE_SDA_PIN 20
|
79
|
+
# #define WIRE_SCL1_PIN 20
|
80
|
+
#
|
81
|
+
pin = line.match /(WIRE(\d*)_(SCL_|SDA_)PIN)\s*\(?(\d+)\w*\)?/
|
82
|
+
if pin
|
83
|
+
@map[pin[1].gsub("_PIN", "").to_sym] = pin[4].to_i
|
60
84
|
next
|
61
85
|
end
|
62
86
|
|
@@ -73,6 +97,7 @@ class HeaderParser
|
|
73
97
|
next
|
74
98
|
end
|
75
99
|
|
100
|
+
# This mostly affectes SAM3X, ESP32 and ESP8266.
|
76
101
|
#
|
77
102
|
# Match custom labeled D* pins (eg. ESP8266) declared like:
|
78
103
|
# static const uint D4 = (2)
|
data/vendor/board-maps/run.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require_relative "lib/boards_parser"
|
2
2
|
require_relative "lib/header_parser"
|
3
3
|
|
4
|
-
CORES = ["avr", "esp32", "esp8266", "megaavr", "rp2040", "sam3x", "samd"]
|
4
|
+
CORES = ["avr", "esp32", "esp8266", "megaavr", "rp2040", "sam3x", "samd", "ra4m1"]
|
5
5
|
|
6
6
|
# This will end up containing a map for each board identified. Each key
|
7
7
|
# is a board's identifier and the value is its pin map as a hash.
|
@@ -15,11 +15,21 @@ CORES.each do |core|
|
|
15
15
|
|
16
16
|
# For each board, parse its header and add it to the hash of maps.
|
17
17
|
board_headers.each do |board, header_folder|
|
18
|
+
# No idea what this is, but doesn't seem to be a real board.
|
19
|
+
next if board.match /muxto/i
|
20
|
+
|
18
21
|
parser = HeaderParser.new(header_folder)
|
19
22
|
board_maps[board] = parser.map
|
20
23
|
end
|
21
24
|
end
|
22
25
|
|
26
|
+
# Manually set DAC pins for Arduino branded RA4M1 boards.
|
27
|
+
# Should handle with different matchers for each core, but this works for now.
|
28
|
+
board_maps["ARDUINO_MINIMA"][:DAC] = 14
|
29
|
+
board_maps["ARDUINO_UNOWIFIR4"][:DAC] = 14
|
30
|
+
board_maps["ARDUINO_PORTENTA_C33"][:DAC] = 21
|
31
|
+
board_maps["ARDUINO_PORTENTA_C33"][:DAC1] = 20
|
32
|
+
|
23
33
|
# Remove chars from board identifier that won't work in a filename.
|
24
34
|
def board_to_filename(board_identifier)
|
25
35
|
board_identifier.gsub(":", "_").gsub(",", "_").gsub(/\AARDUINO_/, "")
|
@@ -0,0 +1,32 @@
|
|
1
|
+
---
|
2
|
+
:LED_BUILTIN: 13
|
3
|
+
:D0: 0
|
4
|
+
:D1: 1
|
5
|
+
:D2: 2
|
6
|
+
:D3: 3
|
7
|
+
:D4: 4
|
8
|
+
:D5: 5
|
9
|
+
:D6: 6
|
10
|
+
:D7: 7
|
11
|
+
:D8: 8
|
12
|
+
:D9: 9
|
13
|
+
:D10: 10
|
14
|
+
:D11: 11
|
15
|
+
:D12: 12
|
16
|
+
:D13: 13
|
17
|
+
:A0: 26
|
18
|
+
:A1: 27
|
19
|
+
:A2: 28
|
20
|
+
:A3: 29
|
21
|
+
:MISO0: 4
|
22
|
+
:MOSI0: 3
|
23
|
+
:SCK0: 2
|
24
|
+
:SS0: 5
|
25
|
+
:MISO1: 12
|
26
|
+
:MOSI1: 11
|
27
|
+
:SCK1: 10
|
28
|
+
:SS1: 13
|
29
|
+
:SDA0: 16
|
30
|
+
:SCL0: 17
|
31
|
+
:SDA1: 18
|
32
|
+
:SCL1: 19
|