Skip to content

Commit e5e825a

Browse files
authored
Merge pull request #395 from machinekoder/fix-hal-net-signal
hal_signal: fix overwriting OUT dir pin value
2 parents ecf488a + 3728d8e commit e5e825a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/libraries/hal/src/hal_signal.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -274,10 +274,10 @@ int halg_link(const int use_hal_mutex,
274274
// good runtime assertion on 'halcmd show objects'.
275275
pin->data_ptr = SHMOFF(&sig->value);
276276

277-
if (( sig->readers == 0 ) && ( sig->writers == 0 ) &&
278-
( sig->bidirs == 0 )) {
277+
if (( pin->dir == HAL_OUT ) || ( sig->readers + sig->writers + sig->bidirs == 0 )) {
279278

280279
// this signal is not linked to any pins
280+
// or the newly linked pin is the first OUT pin
281281
// copy value from pin's "dummy" field,
282282
// making it 'inherit' the value of the first pin
283283
// data_addr = hal_shmem_base + sig->data_ptr;

0 commit comments

Comments
 (0)