I'm looking at he following page, that describes functions from VirtualWire library and provides some examples.
https://www.pjrc.com/teensy/td_libs_VirtualWire.html
Some basic questions I have after reading it:
The description of
vw_get_messagefunction states.Read the last received message. This should be called only when a message is known to be received with any of the 3 functions above.
"3 functions above" refers to
vw_have_message,vw_wait_rxandvw_wait_rx_maxfunctions.However, in the example on that very same page
vw_get_messagefunction is called from receiver'sloop()without making any attempts to call any of those 3 functions first.Why? Is it legal to use
vw_get_messageby itself? And how does it work in this case, i.e. what is the semantics of the return value?The function is explicitly described as non-blocking, apparently implying that if this usage is legal, there's no way to tell "corrupted message" situation from "no message" situation.
Does the library preserve the granularity/separation of messages? I.e if the TX side sends 1-byte messages, does it guarantee that each call to
vw_get_messageon RX side will return 1-byte messages? It seems to be implied by the description of the protocol, but I'd like to ask just in case.If the answer to the second question is "yes", then does this API preserve zero-length messages? Or are they discarded immediately?