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
3694ffa9
Commit
3694ffa9
authored
Apr 01, 2017
by
devsaurus
Browse files
ow: update rmt handover when switching pins
parent
13cfd693
Changes
1
Hide whitespace changes
Inline
Side-by-side
components/platform/onewire.c
View file @
3694ffa9
...
...
@@ -180,17 +180,17 @@ static int onewire_rmt_attach_pin( uint8_t gpio_num )
return
PLATFORM_ERR
;
if
(
gpio_num
!=
ow_rmt
.
gpio
)
{
// attach RMT channels to new gpio pin
rmt_set_pin
(
ow_rmt
.
tx
,
RMT_MODE_TX
,
gpio_num
);
rmt_set_pin
(
ow_rmt
.
rx
,
RMT_MODE_RX
,
gpio_num
);
// attach GPIO to previous pin
gpio_matrix_out
(
ow_rmt
.
gpio
,
SIG_GPIO_OUT_IDX
,
0
,
0
);
if
(
gpio_num
<
32
)
{
GPIO
.
enable_w1ts
=
(
0x1
<<
gpio_num
);
GPIO
.
enable_w1ts
=
(
0x1
<<
gpio_num
);
}
else
{
GPIO
.
enable1_w1ts
.
data
=
(
0x1
<<
(
gpio_num
-
32
));
GPIO
.
enable1_w1ts
.
data
=
(
0x1
<<
(
gpio_num
-
32
));
}
gpio_matrix_out
(
ow_rmt
.
gpio
,
SIG_GPIO_OUT_IDX
,
0
,
0
);
// attach RMT channels to new gpio pin
rmt_set_pin
(
ow_rmt
.
tx
,
RMT_MODE_TX
,
gpio_num
);
rmt_set_pin
(
ow_rmt
.
rx
,
RMT_MODE_RX
,
gpio_num
);
ow_rmt
.
gpio
=
gpio_num
;
}
...
...
@@ -207,7 +207,9 @@ int platform_onewire_init( uint8_t gpio_num )
// enable open-drain mode on pin
OW_DEPOWER
(
gpio_num
);
// and prepare driving 1
// note: gpio module is *not necessarily* routed to the pin at this point
gpio_set_level
(
gpio_num
,
1
);
return
PLATFORM_OK
;
...
...
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