|
@@ -6,7 +6,7 @@ Works:
|
|
|
- entering the chip's to shutdown mode (350uA -> 5uA power consumption)
|
|
|
- waking up the chip from shutdown
|
|
|
|
|
|
-##Require
|
|
|
+## Require
|
|
|
```lua
|
|
|
LM92 = require("lm92")
|
|
|
```
|
|
@@ -16,19 +16,19 @@ LM92 = nil
|
|
|
package.loaded["lm92"]=nil
|
|
|
```
|
|
|
|
|
|
-##setup()
|
|
|
-####Description
|
|
|
+## setup()
|
|
|
+#### Description
|
|
|
Setting the address for lm92.
|
|
|
|
|
|
-####Syntax
|
|
|
+#### Syntax
|
|
|
setup(sda, scl, address)
|
|
|
|
|
|
-####Parameters
|
|
|
+#### Parameters
|
|
|
address: 0x48~0x4b, i2c address (depends on tha A0~A1 pins)
|
|
|
-####Returns
|
|
|
+#### Returns
|
|
|
nil
|
|
|
|
|
|
-####Example
|
|
|
+#### Example
|
|
|
```lua
|
|
|
LM92 = require("lm92")
|
|
|
gpio0 = 3
|
|
@@ -39,126 +39,126 @@ addr = 0x48
|
|
|
i2c.setup(0, sda, scl, i2c.SLOW) -- call i2c.setup() only once
|
|
|
LM92.setup(addr)
|
|
|
```
|
|
|
-##getTemperature()
|
|
|
-####Description
|
|
|
+## getTemperature()
|
|
|
+#### Description
|
|
|
Returns the temperature register's content.
|
|
|
|
|
|
-####Syntax
|
|
|
+#### Syntax
|
|
|
getTemperature()
|
|
|
|
|
|
-####Parameters
|
|
|
+#### Parameters
|
|
|
-
|
|
|
|
|
|
-####Returns
|
|
|
+#### Returns
|
|
|
Temperature in degree Celsius.
|
|
|
|
|
|
-####Example
|
|
|
+#### Example
|
|
|
```lua
|
|
|
t = LM92.getTemperature()
|
|
|
print("Got temperature: "..t.." C")
|
|
|
```
|
|
|
|
|
|
-##wakeup()
|
|
|
-####Description
|
|
|
+## wakeup()
|
|
|
+#### Description
|
|
|
Makes the chip exit the low power shutdown mode.
|
|
|
|
|
|
-####Syntax
|
|
|
+#### Syntax
|
|
|
wakeup()
|
|
|
|
|
|
-####Parameters
|
|
|
+#### Parameters
|
|
|
-
|
|
|
|
|
|
-####Returns
|
|
|
+#### Returns
|
|
|
-
|
|
|
|
|
|
-####Example
|
|
|
+#### Example
|
|
|
```lua
|
|
|
LM92.wakeup()
|
|
|
tmr.delay( 1 * 1000 * 1000 )
|
|
|
```
|
|
|
|
|
|
-##shutdown()
|
|
|
-####Description
|
|
|
+## shutdown()
|
|
|
+#### Description
|
|
|
Makes the chip enter the low power shutdown mode.
|
|
|
|
|
|
-####Syntax
|
|
|
+#### Syntax
|
|
|
shutdown()
|
|
|
|
|
|
-####Parameters
|
|
|
+#### Parameters
|
|
|
-
|
|
|
|
|
|
-####Returns
|
|
|
+#### Returns
|
|
|
-
|
|
|
|
|
|
-####Example
|
|
|
+#### Example
|
|
|
```lua
|
|
|
LM92.shutdown()
|
|
|
```
|
|
|
|
|
|
-##setThyst()
|
|
|
-####Description
|
|
|
+## setThyst()
|
|
|
+#### Description
|
|
|
Set hysteresis Temperature.
|
|
|
|
|
|
-####Syntax
|
|
|
+#### Syntax
|
|
|
setThyst(data_wr)
|
|
|
|
|
|
-####Parameters
|
|
|
+#### Parameters
|
|
|
data_wr: 130~-55 ºC, hysteresis Temperature
|
|
|
|
|
|
-####Returns
|
|
|
+#### Returns
|
|
|
nil
|
|
|
|
|
|
-####Example
|
|
|
+#### Example
|
|
|
```lua
|
|
|
LM92.setThyst(3)
|
|
|
```
|
|
|
|
|
|
-##setTcrit()
|
|
|
-####Description
|
|
|
+## setTcrit()
|
|
|
+#### Description
|
|
|
Set Critical Temperature.
|
|
|
|
|
|
-####Syntax
|
|
|
+#### Syntax
|
|
|
setTcrit(data_wr)
|
|
|
|
|
|
-####Parameters
|
|
|
+#### Parameters
|
|
|
data_wr: 130~-55 ºC, Critical Temperature
|
|
|
|
|
|
-####Returns
|
|
|
+#### Returns
|
|
|
nil
|
|
|
|
|
|
-####Example
|
|
|
+#### Example
|
|
|
```lua
|
|
|
LM92.setTcrit(100.625)
|
|
|
```
|
|
|
|
|
|
-##setTlow()
|
|
|
-####Description
|
|
|
+## setTlow()
|
|
|
+#### Description
|
|
|
Set Low Window Temperature.
|
|
|
|
|
|
-####Syntax
|
|
|
+#### Syntax
|
|
|
setTlow(data_wr)
|
|
|
|
|
|
####Parameters
|
|
|
data_wr: 130~-55 ºC, Low Window Temperature
|
|
|
|
|
|
-####Returns
|
|
|
+#### Returns
|
|
|
nil
|
|
|
|
|
|
-####Example
|
|
|
+#### Example
|
|
|
```lua
|
|
|
LM92.setTlow(32.25)
|
|
|
```
|
|
|
-##setThigh()
|
|
|
+## setThigh()
|
|
|
####Description
|
|
|
Set High Window Temperature.
|
|
|
|
|
|
-####Syntax
|
|
|
+#### Syntax
|
|
|
setThigh(data_wr)
|
|
|
|
|
|
-####Parameters
|
|
|
+#### Parameters
|
|
|
data_wr: 130~-55 ºC, High Window Temperature
|
|
|
|
|
|
-####Returns
|
|
|
+#### Returns
|
|
|
nil
|
|
|
|
|
|
####Example
|
|
@@ -166,83 +166,84 @@ nil
|
|
|
LM92.setThigh(27.5)
|
|
|
```
|
|
|
|
|
|
-##getThyst()
|
|
|
-####Description
|
|
|
+## getThyst()
|
|
|
+#### Description
|
|
|
Get hysteresis Temperature.
|
|
|
|
|
|
-####Syntax
|
|
|
+#### Syntax
|
|
|
getThyst()
|
|
|
|
|
|
-####Parameters
|
|
|
+#### Parameters
|
|
|
--
|
|
|
|
|
|
-####Returns
|
|
|
+#### Returns
|
|
|
Hysteresis Temperature in degree Celsius.
|
|
|
|
|
|
-####Example
|
|
|
+#### Example
|
|
|
```lua
|
|
|
t = LM92.getThyst()
|
|
|
print("Got hysteresis temperature: "..t.." C")
|
|
|
```
|
|
|
|
|
|
-##getTcrit()
|
|
|
-####Description
|
|
|
+## getTcrit()
|
|
|
+#### Description
|
|
|
Get Critical Temperature.
|
|
|
|
|
|
-####Syntax
|
|
|
+#### Syntax
|
|
|
getTcrit()
|
|
|
|
|
|
-####Parameters
|
|
|
+#### Parameters
|
|
|
--
|
|
|
|
|
|
-####Returns
|
|
|
+#### Returns
|
|
|
Critical Temperature in degree Celsius.
|
|
|
|
|
|
-####Example
|
|
|
+#### Example
|
|
|
```lua
|
|
|
t = LM92.getTcrit()
|
|
|
print("Got Critical temperature: "..t.." C")
|
|
|
```
|
|
|
|
|
|
-##getTlow()
|
|
|
-####Description
|
|
|
+## getTlow()
|
|
|
+#### Description
|
|
|
Get Low Window Temperature.
|
|
|
|
|
|
-####Syntax
|
|
|
+#### Syntax
|
|
|
getTlow()
|
|
|
|
|
|
-####Parameters
|
|
|
+#### Parameters
|
|
|
--
|
|
|
|
|
|
-####Returns
|
|
|
+#### Returns
|
|
|
Low Window Temperature in degree Celsius.
|
|
|
|
|
|
-####Example
|
|
|
+#### Example
|
|
|
```lua
|
|
|
t = LM92.getTlow()
|
|
|
print("Got Low Window temperature: "..t.." C")
|
|
|
```
|
|
|
|
|
|
-##getThigh()
|
|
|
-####Description
|
|
|
+## getThigh()
|
|
|
+#### Description
|
|
|
Get High Window Temperature.
|
|
|
|
|
|
-####Syntax
|
|
|
+#### Syntax
|
|
|
getThigh()
|
|
|
|
|
|
-####Parameters
|
|
|
+#### Parameters
|
|
|
--
|
|
|
|
|
|
-####Returns
|
|
|
+#### Returns
|
|
|
High Window Temperature in degree Celsius.
|
|
|
|
|
|
-####Example
|
|
|
+#### Example
|
|
|
```lua
|
|
|
t = LM92.getThigh()
|
|
|
print("Got High Window temperature: "..t.." C")
|
|
|
```
|
|
|
|
|
|
-##Full example
|
|
|
+## Full example
|
|
|
+```lua
|
|
|
--node.compile("lm92.lua")
|
|
|
LM92 = require("lm92")
|
|
|
gpio0 = 3
|
|
@@ -270,6 +271,7 @@ t = LM92.getTlow()
|
|
|
print("Got Low: "..t.." C")
|
|
|
t = LM92.getThigh()
|
|
|
print("Got High: "..t.." C")
|
|
|
+```
|
|
|
|
|
|
#### TODO:
|
|
|
- add full support of the features, including interrupt and critical alert support
|