mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
Merge pull request #16768 from benpicco/drivers/dose-timeout_bytes
drivers/dose: calculate timeout based on symbol rate
This commit is contained in:
commit
026d6cfba1
@ -13,11 +13,11 @@ menuconfig KCONFIG_USEMODULE_DOSE
|
||||
|
||||
if KCONFIG_USEMODULE_DOSE
|
||||
|
||||
config DOSE_TIMEOUT_USEC
|
||||
int "Transaction timeout in microseconds [us]"
|
||||
default 5000
|
||||
config DOSE_TIMEOUT_BYTES
|
||||
int "Transaction timeout in bytes"
|
||||
default 50
|
||||
help
|
||||
Timeout, in microseconds, to bring the driver back into idle state if
|
||||
Timeout, in bytes at the set baudrate, to bring the driver back into idle state if
|
||||
the remote side died within a transaction.
|
||||
|
||||
endif # KCONFIG_USEMODULE_DOSE
|
||||
|
@ -662,10 +662,11 @@ void dose_setup(dose_t *ctx, const dose_params_t *params, uint8_t index)
|
||||
* We have to ensure it is above the XTIMER_BACKOFF. Otherwise state
|
||||
* transitions are triggered from another state transition setting up the
|
||||
* timeout. */
|
||||
ctx->timeout_base = CONFIG_DOSE_TIMEOUT_USEC;
|
||||
ctx->timeout_base = CONFIG_DOSE_TIMEOUT_BYTES * 10UL * US_PER_SEC / params->baudrate;
|
||||
if (ctx->timeout_base < xtimer_usec_from_ticks(min_timeout)) {
|
||||
ctx->timeout_base = xtimer_usec_from_ticks(min_timeout);
|
||||
}
|
||||
DEBUG("dose timeout set to %" PRIu32 " µs\n", ctx->timeout_base);
|
||||
ctx->timeout.callback = _isr_xtimer;
|
||||
ctx->timeout.arg = ctx;
|
||||
}
|
||||
|
@ -130,12 +130,12 @@ typedef enum {
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @brief Timeout that brings the driver back into idle state.
|
||||
* @brief Timeout that brings the driver back into idle state expressed as bytes.
|
||||
*
|
||||
* Fallback to idle if the remote side died within a transaction.
|
||||
*/
|
||||
#ifndef CONFIG_DOSE_TIMEOUT_USEC
|
||||
#define CONFIG_DOSE_TIMEOUT_USEC (5000)
|
||||
#ifndef CONFIG_DOSE_TIMEOUT_BYTES
|
||||
#define CONFIG_DOSE_TIMEOUT_BYTES (50)
|
||||
#endif
|
||||
/** @} */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user