de053cf479
Added LUA module for the lm92 +-0.33C 12bit+sign temperature sensor. |
||
---|---|---|
.. | ||
README.md | ||
lm92.lua |
README.md
LM92 module
This module adds basic support for the LM92 +-0.33C 12bit+sign temperature sensor. More details in the datasheet. Works:
- getting the temperature
- entering the chip's to shutdown mode (350uA -> 5uA power consumption)
- waking up the chip from shutdown
##Require
LM92 = require("lm92")
Release
LM92 = nil
package.loaded["lm92"]=nil
##init() ####Description Setting the i2c pins and address for lm92.
####Syntax init(sda, scl, address)
####Parameters
sda: 1~12, IO index.
scl: 1~12, IO index.
address: 0x48~0x4b, i2c address (depends on tha A0~A1 pins)
####Returns
nil
####Example
LM92 = require("lm92")
gpio0 = 3
gpio2 = 4
sda = gpio0
scl = gpio2
addr = 0x48
LM92.init(sda, scl,addr)
##getTemperature() ####Description Returns the temperature register's content.
####Syntax getTemperature()
####Parameters
####Returns Temperature in degree Celsius.
####Example
t = LM92.getTemperature()
print("Got temperature: "..t.." C")
##wakeup() ####Description Makes the chip exit the low power shutdown mode.
####Syntax wakeup()
####Parameters
####Returns
####Example
LM92.wakeup()
tmr.delay( 1 * 1000 * 1000 )
##shutdown() ####Description Makes the chip enter the low power shutdown mode.
####Syntax shutdown()
####Parameters
####Returns
####Example
LM92.shutdown()
TODO:
- add full support of the features, including interrupt and critical alert support