Skip to content

Commit 4dbc2e1

Browse files
committed
Add AHT20.read/1
1 parent d0e90bb commit 4dbc2e1

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ iex> {:ok, aht20} = AHT20.start_link(bus_name: "i2c-1", bus_address: 0x38)
2525
{:ok, #PID<0.1407.0>}
2626

2727
# Read the humidity and temperature from the sensor.
28-
iex> AHT20.read_data(aht20)
28+
iex> AHT20.read(aht20)
2929
{:ok,
3030
%AHT20.Measurement{
3131
humidity_rh: 15.079402923583984,

lib/aht20.ex

+3
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ defmodule AHT20 do
1313
AHT20.SensorWorker.start_link(config)
1414
end
1515

16+
@spec read(pid) :: {:ok, AHT20.Measurement.t()} | {:error, any}
17+
def read(pid), do: read_data(pid)
18+
1619
@spec read_data(pid) :: {:ok, AHT20.Measurement.t()} | {:error, any}
1720
def read_data(pid) when is_pid(pid) do
1821
AHT20.SensorWorker.read_data(pid)

0 commit comments

Comments
 (0)