From 965fa3ef10a3b8a28f2486bd19b0a7566b45bc06 Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Thu, 11 Nov 2021 14:43:07 +0100 Subject: [PATCH] drivers/dose: clarify timeout calculation --- drivers/dose/dose.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/dose/dose.c b/drivers/dose/dose.c index 3be9a0b942..38b0e4f290 100644 --- a/drivers/dose/dose.c +++ b/drivers/dose/dose.c @@ -680,7 +680,10 @@ void dose_setup(dose_t *ctx, const dose_params_t *params, uint8_t index) /* The timeout base is the minimal timeout base used for this driver. * We have to ensure it is above the XTIMER_BACKOFF. Otherwise state * transitions are triggered from another state transition setting up the - * timeout. */ + * timeout. + * To calculate how long it takes to transfer one byte we assume + * 8 data bits + 1 start bit + 1 stop bit per byte. + */ 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);