|
Phil Mack <phil.m@wsg.org.uk> wrote:
> Before I start trying to do this, does anyone know why the LegOS function
> write_ir is a blocking function? I'm trying to write an IR detection
> system but am unable to do so in LegOS because every time I write a byte
> to the IR port the RCX locks up. Is this just a problem with LegOS or is
> it something more fundamental with the RCX. I willing to try and write a
> non-blocking one but I haven't used asm since I sold my old Atari ST..
Do you mean dir_write? This is a problem with LegOS only. If you want
non-blocking writes, comment out (in version 0.1.7 at least):
while(dir_tx_state==TX_ACTIVE)
; // FIXME: scheduler integration
if(dir_tx_state==TX_OK)
return len; // successful xmit
return -1; // default is error
And replace with:
return len;
Now you will not know if your transmission was okay or not, but you
probably don't care. Reliable transfer should be implemented with acks,
not checks of the echo, despite the fact that the echo check can yield
useful information (i.e. answer "was there a collision?").
Also, you might consider using a thread to send messages, but this
complicates things somewhat, and it is reasonable for you to want a
non-blocking write instead.
-Kekoa
|
|
Message has 1 Reply: | | Re: Blocking IR
|
| (...) I forgot to mention. At the top of dir_write, you probably want to add: if (dir_tx_state == TX_ACTIVE) return -1; Or something to that effect, so you don't transmit a second message while a first is still transmitting, and so you have a way of (...) (25 years ago, 10-Jun-99, to lugnet.robotics.rcx.legos)
|
Message is in Reply To:
| | Blocking IR
|
| Before I start trying to do this, does anyone know why the LegOS function write_ir is a blocking function? I'm trying to write an IR detection system but am unable to do so in LegOS because every time I write a byte to the IR port the RCX locks up. (...) (25 years ago, 10-Jun-99, to lugnet.robotics.rcx.legos)
|
12 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
This Message and its Replies on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|