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
140bcee2
Commit
140bcee2
authored
Oct 08, 2015
by
chris
Browse files
comment cleanup
parent
c298a5cf
Changes
1
Show whitespace changes
Inline
Side-by-side
app/modules/hx711.c
View file @
140bcee2
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
static
uint8_t
data_pin
;
static
uint8_t
data_pin
;
static
uint8_t
clk_pin
;
static
uint8_t
clk_pin
;
/*Lua: init(clk_pin,data_pin)*/
/*Lua:
hx711.
init(clk_pin,data_pin)*/
static
int
hx711_init
(
lua_State
*
L
)
{
static
int
hx711_init
(
lua_State
*
L
)
{
clk_pin
=
luaL_checkinteger
(
L
,
1
);
clk_pin
=
luaL_checkinteger
(
L
,
1
);
data_pin
=
luaL_checkinteger
(
L
,
2
);
data_pin
=
luaL_checkinteger
(
L
,
2
);
...
@@ -36,8 +36,9 @@ static int ICACHE_FLASH_ATTR hx711_read(lua_State* L) {
...
@@ -36,8 +36,9 @@ static int ICACHE_FLASH_ATTR hx711_read(lua_State* L) {
//wait for data ready. or time out.
//wait for data ready. or time out.
//TODO: set pin inturrupt and come back to it. This may take up to 1/10 sec
//TODO: set pin inturrupt and come back to it. This may take up to 1/10 sec
// or maybe just make an async version too and have both available.
// or maybe just make an async version too and have both available.
WRITE_PERI_REG
(
0x60000914
,
0x73
);
//clear WDT... this may take a while.
for
(
i
=
0
;
i
<
HX711_MAX_WAIT
&&
platform_gpio_read
(
data_pin
)
==
1
;
i
++
){
for
(
i
=
0
;
i
<
HX711_MAX_WAIT
&&
platform_gpio_read
(
data_pin
)
==
1
;
i
++
){
asm
(
"nop"
);
//don't optimize away this loop.
asm
(
"nop"
);
}
}
//Handle timeout error
//Handle timeout error
...
@@ -69,7 +70,6 @@ const LUA_REG_TYPE hx711_map[] =
...
@@ -69,7 +70,6 @@ const LUA_REG_TYPE hx711_map[] =
{
{
{
LSTRKEY
(
"init"
),
LFUNCVAL
(
hx711_init
)},
{
LSTRKEY
(
"init"
),
LFUNCVAL
(
hx711_init
)},
{
LSTRKEY
(
"read"
),
LFUNCVAL
(
hx711_read
)},
{
LSTRKEY
(
"read"
),
LFUNCVAL
(
hx711_read
)},
//{ LSTRKEY( "write" ), LFUNCVAL( ws2812_writegrb )},
{
LNILKEY
,
LNILVAL
}
{
LNILKEY
,
LNILVAL
}
};
};
...
...
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