Flushing the neuron chip or smart transceiver, The flush( ) and flush_cancel( ) functions, Flush_completes event – Echelon Neuron C User Manual
Page 178: Putting the device to sleep

166 Additional
Features
Flushing the Neuron Chip or Smart Transceiver
You can use the flush( ) function to instruct the Neuron firmware to finish
processing all outgoing and incoming messages. When the flush is complete, the
flush_completes event becomes TRUE and the chip enters Quiet mode.
The flush( ) and flush_cancel( ) Functions
The flush( ) function causes the Neuron firmware to monitor the status of all
outgoing and incoming messages. Its syntax is as follows:
flush (boolean
comm-ignore
);
comm-ignore
Specify TRUE if the Neuron firmware is to ignore
communications channel activity while it is flushing. Specify FALSE
if the Neuron firmware is to accept incoming messages. This
parameter should be the same as the comm_ignore parameter used
with the sleep( ) function that follows the flush.
While the flush is occurring, the program continues to run. The origination of
new messages by the program while the flush is in progress delays the flush
completion.
If the comm_ignore option is set to TRUE, new packets that arrive during the
flush are discarded unless they are acknowledgments, responses, challenges, or
replies.
You can cancel a flush operation that is in progress by calling the flush_cancel( )
function.
flush_completes Event
The following predefined event becomes TRUE when the flush completes:
flush_completes
This event becomes TRUE when all outgoing network buffers and application
buffers are free, no more incoming messages are outstanding, and no network
variable updates are outstanding.
Note: The flush_wait( ) function should not be used in preparation for putting
the device to sleep. The flush_wait( ) function does not check for outstanding
network variable updates or incoming messages.
Putting the Device to Sleep
You can use the sleep( ) function to put a Neuron Chip or Smart Transceiver to
sleep when the flush_completes event becomes TRUE. Its syntax is shown below:
sleep (
flags
)
sleep (
flags
,
io-object-name
)
sleep (
flags
,
io-pin
)
flags
One or more of the following three flags, or 0 if no flag is to be
specified. If two or more flags are used, they are OR'd together. You
can specify any of the following flags: