Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
Nodemcu Firmware
Commits
ddc770a6
Commit
ddc770a6
authored
Aug 29, 2022
by
Joo Aun Saw
Committed by
Johny Mattsson
Aug 29, 2022
Browse files
uart: do not use uninitialized uart pins config
parent
ca0a2b3f
Changes
1
Hide whitespace changes
Inline
Side-by-side
components/modules/uart.c
View file @
ddc770a6
...
@@ -135,7 +135,9 @@ static int uart_setup( lua_State* L )
...
@@ -135,7 +135,9 @@ static int uart_setup( lua_State* L )
unsigned
id
,
databits
,
parity
,
stopbits
,
echo
=
1
;
unsigned
id
,
databits
,
parity
,
stopbits
,
echo
=
1
;
uint32_t
baud
,
res
;
uint32_t
baud
,
res
;
uart_pins_t
pins
;
uart_pins_t
pins
;
uart_pins_t
*
pins_to_use
=
NULL
;
memset
(
&
pins
,
0
,
sizeof
(
pins
));
id
=
luaL_checkinteger
(
L
,
1
);
id
=
luaL_checkinteger
(
L
,
1
);
MOD_CHECK_ID
(
uart
,
id
);
MOD_CHECK_ID
(
uart
,
id
);
baud
=
luaL_checkinteger
(
L
,
2
);
baud
=
luaL_checkinteger
(
L
,
2
);
...
@@ -169,9 +171,11 @@ static int uart_setup( lua_State* L )
...
@@ -169,9 +171,11 @@ static int uart_setup( lua_State* L )
lua_getfield
(
L
,
6
,
"flow_control"
);
lua_getfield
(
L
,
6
,
"flow_control"
);
pins
.
flow_control
=
luaL_optint
(
L
,
-
1
,
PLATFORM_UART_FLOW_NONE
);
pins
.
flow_control
=
luaL_optint
(
L
,
-
1
,
PLATFORM_UART_FLOW_NONE
);
pins_to_use
=
&
pins
;
}
}
res
=
platform_uart_setup
(
id
,
baud
,
databits
,
parity
,
stopbits
,
&
pins
);
res
=
platform_uart_setup
(
id
,
baud
,
databits
,
parity
,
stopbits
,
pins
_to_use
);
lua_pushinteger
(
L
,
res
);
lua_pushinteger
(
L
,
res
);
return
1
;
return
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