Closed pdgilbert closed 7 months ago
as you've determined you need to poll on check_receive
to see whether something is received, all of this is just interacting with the internal radio state machine.
setting restart
lets the driver internally deal with any CRC or recoverable errors and re-enter receive mode (if it can, otherwise you'll still get an error), not setting this returns errors to the higher level for handling but requires another start_receive
call to return the radio to receive mode when an error occurs. you can see the code for this here
Ok, I think I understand. I guess there are not concepts of optional or default arguments in Rust, and restart
is bool
rather than Option(bool)
, so I suppose by "setting it" you mean setting intrue
and by "not setting it" you mean setting it false
. (I realize this is a bit pedantic but I have a differ background.)
yeah pretty much, it could be an object with more stuff but, that's also adding another associated type which as you've discovered proportionately increases the complexity of integrating traits... a documentation improvement would be welcome if you can think of a better way of presenting this
This issue is out-of-date and effectively resolved.
Following code in the tests/integration.rs file I have my
lora_sp_receive
example working on an stm32f411 but I am confused by the restart option, especial atrue
setting, and not sure if I correctly understand the comment (src/lora.rs line 336)Does that mean that
lora_check_receive(false)
passes the check result back to user code and returnsOk(true)
if a packet has been received andOk(false)
if nothing has been received or if there has been a timeout or CRC error.lora_check_receive(true)
always returnsOk(false)
. It handles timeouts and CRC errors without passing back to user code. It waits until something is received? So blocks?Why is the argument called "restart option"?
Which restart option do you suggest in what situations?
For reference, the example code is at https://github.com/pdgilbert/eg_stm_hal/blob/master/examples/lora_spi_receive.rs and currently the main part is