Skip to content

Commit

Permalink
Forgot i2c search
Browse files Browse the repository at this point in the history
  • Loading branch information
vickash committed Sep 27, 2024
1 parent 7583940 commit 7ff144d
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/denko/board/i2c.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def i2c_convert_frequency(freq)
end

# CMD = 33
def i2c_search
def i2c_search(i2c_index)
write Message.encode command: 33
end

Expand Down
2 changes: 1 addition & 1 deletion lib/denko/i2c/bus.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def found_devices
attr_writer :found_devices

def search
addresses = read_using -> { board.i2c_search }
addresses = read_using -> { board.i2c_search(i2c_index) }
@found_devices = addresses.split(":").map(&:to_i) if addresses
end

Expand Down
2 changes: 1 addition & 1 deletion test/board/i2c_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def test_search

mock = Minitest::Mock.new.expect :call, nil, [message]
connection.stub(:write, mock) do
board.i2c_search
board.i2c_search(0)
end
mock.verify
end
Expand Down
2 changes: 1 addition & 1 deletion test/i2c/bus_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def test_initialize
def test_search
board.inject_read_for_i2c(0, "48:50")

mock = Minitest::Mock.new.expect :call, nil
mock = Minitest::Mock.new.expect :call, nil, [0]
board.stub(:i2c_search, mock) do
part.search
end
Expand Down

0 comments on commit 7ff144d

Please sign in to comment.