File tree 3 files changed +9
-3
lines changed
3 files changed +9
-3
lines changed Original file line number Diff line number Diff line change 1
1
# AHT20
2
2
3
3
[ ![ Hex.pm] ( https://img.shields.io/hexpm/v/aht20.svg )] ( https://hex.pm/packages/aht20 )
4
- [ ![ API docs] ( https://img.shields.io/hexpm/v/aht20.svg?label=docs )] ( https://hexdocs.pm/aht20/AHT20.html )
4
+ [ ![ API docs] ( https://img.shields.io/hexpm/v/aht20.svg?label=docs )] ( https://hexdocs.pm/aht20 )
5
5
![ CI] ( https://github.com/mnishiguchi/AHT20/workflows/CI/badge.svg )
6
6
7
7
Use [ AHT20] ( http://www.aosong.com/en/products-32.html ) temperature & humidity sensor in Elixir.
Original file line number Diff line number Diff line change @@ -58,18 +58,24 @@ defmodule AHT20.Sensor do
58
58
Process . sleep ( 40 )
59
59
:ok = reset ( aht20 )
60
60
:ok = init ( aht20 )
61
+
61
62
{ :ok , aht20 }
62
63
rescue
63
64
e -> { :error , e }
64
65
end
65
66
66
67
@ doc """
67
68
Restarts the sensor system without having to turn off and turn on the power again.
69
+ Soft reset takes no longer than 20ms.
68
70
For more info. please refer to the data sheet (section 5.5).
69
71
"""
70
72
@ spec reset ( t ) :: :ok | { :error , any }
71
73
def reset ( % { i2c_ref: i2c_ref , i2c_address: i2c_address } ) do
72
- Circuits.I2C . write ( i2c_ref , i2c_address , [ @ aht20_cmd_soft_reset ] )
74
+ :ok = Circuits.I2C . write ( i2c_ref , i2c_address , [ @ aht20_cmd_soft_reset ] )
75
+ Process . sleep ( 20 )
76
+ :ok
77
+ rescue
78
+ e -> { :error , e }
73
79
end
74
80
75
81
# Initialize the sensor system.
Original file line number Diff line number Diff line change 1
1
defmodule AHT20.MixProject do
2
2
use Mix.Project
3
3
4
- @ version "0.1.0 "
4
+ @ version "0.1.1 "
5
5
@ source_url "https://github.com/mnishiguchi/aht20"
6
6
7
7
def project do
You can’t perform that action at this time.
0 commit comments