From 201ba9c9599a4197b901ee6c1a1f7c07a4ab3217 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20St=C3=B6r?= Date: Sun, 30 Apr 2017 20:08:37 +0200 Subject: [PATCH] Put functions in alphabetical order --- docs/en/modules/si7021.md | 120 +++++++++++++++++++------------------- 1 file changed, 60 insertions(+), 60 deletions(-) diff --git a/docs/en/modules/si7021.md b/docs/en/modules/si7021.md index fc406bf6..9317d613 100644 --- a/docs/en/modules/si7021.md +++ b/docs/en/modules/si7021.md @@ -29,6 +29,66 @@ fwrev = si7021.firmware() print(string.format("FW: %X\r\n", fwrev)) ``` +## si7021.read() + +#### Syntax +`si7021.read()` + +#### Parameters +none + +#### Returns +- `hum` humidity (see note below) +- `temp` temperature (see note below) +- `hum_dec` humidity decimal +- `temp_dec` temperature decimal + +!!! note + + If using float firmware then `hum` and `temp` are floating point numbers. On an integer firmware, the final values have to be concatenated from `hum` and `hum_dec` / `temp` and `temp_dec`. + +#### Example +```lua +local sda, scl = 6, 5 +i2c.setup(0, sda, scl, i2c.SLOW) -- call i2c.setup() only once +si7021.setup() + +hum, temp, hum_dec, temp_dec = si7021.read() + +-- Integer firmware using this example +print(string.format("Humidity:\t\t%d.%03d\nTemperature:\t%d.%03d\n", hum, hum_dec, temp, temp_dec)) + +-- Float firmware using this example +print("Humidity: "..hum.."\n".."Temperature: "..temp) +``` + +## si7021.serial() +Read the individualized 64-bit electronic serial number of the Si7021 sensor. + +#### Syntax +`si7021.serial()` + +#### Parameters +none + +#### Returns +- `sna` 32-bit serial number part a +- `snb` 32-bit serial number part b, upper byte contains the device identification + * `0x00` or `0xFF` engineering samples + * `0x0D` `13` Si7013 + * `0x14` `20` Si7020 + * `0x15` `21` Si7021 + +#### Example +```lua +local sda, scl = 6, 5 +i2c.setup(0, sda, scl, i2c.SLOW) -- call i2c.setup() only once +si7021.setup() + +sna, snb = si7021.serial() +print(string.format("SN:\t\t%X%X\nDevice:\tSi70%d", sna, snb, bit.rshift(snb,24))) +``` + ## si7021.setting() Settings for the sensors configuration register to adjust measurement resolution, on-chip heater and read the supply voltage status. @@ -90,63 +150,3 @@ local sda, scl = 6, 5 i2c.setup(0, sda, scl, i2c.SLOW) -- call i2c.setup() only once si7021.setup() ``` - -## si7021.read() - -#### Syntax -`si7021.read()` - -#### Parameters -none - -#### Returns -- `hum` humidity (see note below) -- `temp` temperature (see note below) -- `hum_dec` humidity decimal -- `temp_dec` temperature decimal - -!!! note - - If using float firmware then `hum` and `temp` are floating point numbers. On an integer firmware, the final values have to be concatenated from `hum` and `hum_dec` / `temp` and `temp_dec`. - -#### Example -```lua -local sda, scl = 6, 5 -i2c.setup(0, sda, scl, i2c.SLOW) -- call i2c.setup() only once -si7021.setup() - -hum, temp, hum_dec, temp_dec = si7021.read() - --- Integer firmware using this example -print(string.format("Humidity:\t\t%d.%03d\nTemperature:\t%d.%03d\n", hum, hum_dec, temp, temp_dec)) - --- Float firmware using this example -print("Humidity: "..hum.."\n".."Temperature: "..temp) -``` - -## si7021.serial() -Read the individualized 64-bit electronic serial number of the Si7021 sensor. - -#### Syntax -`si7021.serial()` - -#### Parameters -none - -#### Returns -- `sna` 32-bit serial number part a -- `snb` 32-bit serial number part b, upper byte contains the device identification - * `0x00` or `0xFF` engineering samples - * `0x0D` `13` Si7013 - * `0x14` `20` Si7020 - * `0x15` `21` Si7021 - -#### Example -```lua -local sda, scl = 6, 5 -i2c.setup(0, sda, scl, i2c.SLOW) -- call i2c.setup() only once -si7021.setup() - -sna, snb = si7021.serial() -print(string.format("SN:\t\t%X%X\nDevice:\tSi70%d", sna, snb, bit.rshift(snb,24))) -```