Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
Nodemcu Firmware
Commits
0f6a0c59
Commit
0f6a0c59
authored
Aug 23, 2015
by
aeprox
Browse files
Documentation update
parent
fd93a09a
Changes
2
Hide whitespace changes
Inline
Side-by-side
app/modules/tsl2561.c
View file @
0f6a0c59
...
...
@@ -13,8 +13,9 @@
static
uint16_t
ch0
;
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
)
{
uint32_t
sda
;
...
...
@@ -35,8 +36,8 @@ static int ICACHE_FLASH_ATTR tsl2561_init(lua_State* L) {
lua_pushnumber
(
L
,
error
);
return
1
;
}
/*
* Lua:
error
= tsl2561.settiming(integration, gain)
/*
Sets the integration time and gain settings of the device
* Lua:
status
= tsl2561.settiming(integration, gain)
*/
static
int
ICACHE_FLASH_ATTR
tsl2561_lua_settiming
(
lua_State
*
L
)
{
// check variables
...
...
@@ -55,8 +56,8 @@ static int ICACHE_FLASH_ATTR tsl2561_lua_settiming(lua_State* L) {
lua_pushnumber
(
L
,
tsl2561SetTiming
(
integration
,
gain
));
return
1
;
}
/*
* Lua: lux,
error
= tsl2561.getlux()
/*
Reads sensor values from device and return calculated lux
* Lua: lux,
status
= tsl2561.getlux()
*/
static
int
ICACHE_FLASH_ATTR
tsl2561_lua_calclux
(
lua_State
*
L
)
{
uint8_t
error
=
tsl2561GetLuminosity
(
&
ch0
,
&
ch1
);
...
...
@@ -69,8 +70,8 @@ static int ICACHE_FLASH_ATTR tsl2561_lua_calclux(lua_State* L) {
}
return
2
;
}
/*
* Lua: tsl2561.getrawchannels()
/*
Reads sensor values from device and returns them
* Lua:
ch0, ch1, status =
tsl2561.getrawchannels()
*/
static
int
ICACHE_FLASH_ATTR
tsl2561_lua_getchannels
(
lua_State
*
L
)
{
uint8_t
error
=
tsl2561GetLuminosity
(
&
ch0
,
&
ch1
);
...
...
app/tsl2561/tsl2561.h
View file @
0f6a0c59
...
...
@@ -41,7 +41,7 @@
#define TSL2561_PACKAGE_CS // Lux calculations differ slightly for CS package
// #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_COMMAND_BIT (0x80) // Must be 1
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment