Commit 0f6a0c59 authored by aeprox's avatar aeprox
Browse files

Documentation update

parent fd93a09a
...@@ -13,8 +13,9 @@ ...@@ -13,8 +13,9 @@
static uint16_t ch0; static uint16_t ch0;
static uint16_t ch1; static uint16_t ch1;
/*
* Lua: error = tsl2561.init(sdapin, sclpin) /* Initialises the device on pins sdapin and sclpin
* Lua: status = tsl2561.init(sdapin, sclpin)
*/ */
static int ICACHE_FLASH_ATTR tsl2561_init(lua_State* L) { static int ICACHE_FLASH_ATTR tsl2561_init(lua_State* L) {
uint32_t sda; uint32_t sda;
...@@ -35,8 +36,8 @@ static int ICACHE_FLASH_ATTR tsl2561_init(lua_State* L) { ...@@ -35,8 +36,8 @@ static int ICACHE_FLASH_ATTR tsl2561_init(lua_State* L) {
lua_pushnumber(L, error); lua_pushnumber(L, error);
return 1; return 1;
} }
/* /* Sets the integration time and gain settings of the device
* Lua: error = tsl2561.settiming(integration, gain) * Lua: status = tsl2561.settiming(integration, gain)
*/ */
static int ICACHE_FLASH_ATTR tsl2561_lua_settiming(lua_State* L) { static int ICACHE_FLASH_ATTR tsl2561_lua_settiming(lua_State* L) {
// check variables // check variables
...@@ -55,8 +56,8 @@ static int ICACHE_FLASH_ATTR tsl2561_lua_settiming(lua_State* L) { ...@@ -55,8 +56,8 @@ static int ICACHE_FLASH_ATTR tsl2561_lua_settiming(lua_State* L) {
lua_pushnumber(L, tsl2561SetTiming(integration, gain)); lua_pushnumber(L, tsl2561SetTiming(integration, gain));
return 1; return 1;
} }
/* /* Reads sensor values from device and return calculated lux
* Lua: lux, error = tsl2561.getlux() * Lua: lux, status = tsl2561.getlux()
*/ */
static int ICACHE_FLASH_ATTR tsl2561_lua_calclux(lua_State* L) { static int ICACHE_FLASH_ATTR tsl2561_lua_calclux(lua_State* L) {
uint8_t error = tsl2561GetLuminosity(&ch0, &ch1); uint8_t error = tsl2561GetLuminosity(&ch0, &ch1);
...@@ -69,8 +70,8 @@ static int ICACHE_FLASH_ATTR tsl2561_lua_calclux(lua_State* L) { ...@@ -69,8 +70,8 @@ static int ICACHE_FLASH_ATTR tsl2561_lua_calclux(lua_State* L) {
} }
return 2; return 2;
} }
/* /* Reads sensor values from device and returns them
* Lua: tsl2561.getrawchannels() * Lua: ch0, ch1, status = tsl2561.getrawchannels()
*/ */
static int ICACHE_FLASH_ATTR tsl2561_lua_getchannels(lua_State* L) { static int ICACHE_FLASH_ATTR tsl2561_lua_getchannels(lua_State* L) {
uint8_t error = tsl2561GetLuminosity(&ch0, &ch1); uint8_t error = tsl2561GetLuminosity(&ch0, &ch1);
......
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
#define TSL2561_PACKAGE_CS // Lux calculations differ slightly for CS package #define TSL2561_PACKAGE_CS // Lux calculations differ slightly for CS package
// #define TSL2561_PACKAGE_T_FN_CL // #define TSL2561_PACKAGE_T_FN_CL
#define TSL2561_ADDRESS (0x39) // or 0x29, or 0x49 #define TSL2561_ADDRESS (0x39) // GND=>0x29, float=>0x39 or VDD=>0x49
#define TSL2561_READBIT (0x01) #define TSL2561_READBIT (0x01)
#define TSL2561_COMMAND_BIT (0x80) // Must be 1 #define TSL2561_COMMAND_BIT (0x80) // Must be 1
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment