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
5a0f6a59
Commit
5a0f6a59
authored
Aug 21, 2015
by
Johny Mattsson
Browse files
Merge pull request #608 from DiUS/onewire-powerup
Unbreak 1-Wire after the consts-to-flash change.
parents
77297662
346251dc
Changes
1
Hide whitespace changes
Inline
Side-by-side
app/driver/onewire.c
View file @
5a0f6a59
...
@@ -64,6 +64,9 @@ sample code bearing this copyright.
...
@@ -64,6 +64,9 @@ sample code bearing this copyright.
#define interrupts os_intr_unlock
#define interrupts os_intr_unlock
#define delayMicroseconds os_delay_us
#define delayMicroseconds os_delay_us
// 1 for keeping the parasitic power on H
#define owDefaultPower 1
#if ONEWIRE_SEARCH
#if ONEWIRE_SEARCH
// global search state
// global search state
static
unsigned
char
ROM_NO
[
NUM_OW
][
8
];
static
unsigned
char
ROM_NO
[
NUM_OW
][
8
];
...
@@ -185,7 +188,7 @@ void onewire_write(uint8_t pin, uint8_t v, uint8_t power /* = 0 */) {
...
@@ -185,7 +188,7 @@ void onewire_write(uint8_t pin, uint8_t v, uint8_t power /* = 0 */) {
void
onewire_write_bytes
(
uint8_t
pin
,
const
uint8_t
*
buf
,
uint16_t
count
,
bool
power
/* = 0 */
)
{
void
onewire_write_bytes
(
uint8_t
pin
,
const
uint8_t
*
buf
,
uint16_t
count
,
bool
power
/* = 0 */
)
{
uint16_t
i
;
uint16_t
i
;
for
(
i
=
0
;
i
<
count
;
i
++
)
for
(
i
=
0
;
i
<
count
;
i
++
)
onewire_write
(
pin
,
buf
[
i
],
0
);
onewire_write
(
pin
,
buf
[
i
],
owDefaultPower
);
if
(
!
power
)
{
if
(
!
power
)
{
noInterrupts
();
noInterrupts
();
DIRECT_MODE_INPUT
(
pin
);
DIRECT_MODE_INPUT
(
pin
);
...
@@ -220,9 +223,9 @@ void onewire_select(uint8_t pin, const uint8_t rom[8])
...
@@ -220,9 +223,9 @@ void onewire_select(uint8_t pin, const uint8_t rom[8])
{
{
uint8_t
i
;
uint8_t
i
;
onewire_write
(
pin
,
0x55
,
0
);
// Choose ROM
onewire_write
(
pin
,
0x55
,
owDefaultPower
);
// Choose ROM
for
(
i
=
0
;
i
<
8
;
i
++
)
onewire_write
(
pin
,
rom
[
i
],
0
);
for
(
i
=
0
;
i
<
8
;
i
++
)
onewire_write
(
pin
,
rom
[
i
],
owDefaultPower
);
}
}
//
//
...
@@ -230,7 +233,7 @@ void onewire_select(uint8_t pin, const uint8_t rom[8])
...
@@ -230,7 +233,7 @@ void onewire_select(uint8_t pin, const uint8_t rom[8])
//
//
void
onewire_skip
(
uint8_t
pin
)
void
onewire_skip
(
uint8_t
pin
)
{
{
onewire_write
(
pin
,
0xCC
,
0
);
// Skip ROM
onewire_write
(
pin
,
0xCC
,
owDefaultPower
);
// Skip ROM
}
}
void
onewire_depower
(
uint8_t
pin
)
void
onewire_depower
(
uint8_t
pin
)
...
@@ -319,7 +322,7 @@ uint8_t onewire_search(uint8_t pin, uint8_t *newAddr)
...
@@ -319,7 +322,7 @@ uint8_t onewire_search(uint8_t pin, uint8_t *newAddr)
}
}
// issue the search command
// issue the search command
onewire_write
(
pin
,
0xF0
,
0
);
onewire_write
(
pin
,
0xF0
,
owDefaultPower
);
// loop to do the search
// loop to do the search
do
do
...
...
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