From: Robin Krens Date: Sun, 22 Jan 2023 15:03:11 +0000 (+0100) Subject: libsi24: small fixes for recv mode X-Git-Url: https://robinkrens.nl/gitweb/?a=commitdiff_plain;h=cbd0d28d466acecba11c23f3c9cfcdd408980218;p=libsi24 libsi24: small fixes for recv mode --- diff --git a/libsi24.c b/libsi24.c index 7427301..d435b5f 100644 --- a/libsi24.c +++ b/libsi24.c @@ -90,11 +90,15 @@ static int _config(si24_t * si) ret += _reg_write(si, SI24_REG_DYNPD, &dyn, 1); feature_reg |= (1 << EN_DPL); ret += _reg_write(si, SI24_REG_FEATURE, &feature_reg, 1); - setup_retr_reg = ARD(params->timeout) | ARC(params->retries); - ret += _reg_write(si, SI24_REG_SETUP_RETR, &setup_retr_reg, 1); + if (params->mode == SEND_MODE) { + setup_retr_reg = ARD(params->timeout) | ARC(params->retries); + ret += _reg_write(si, SI24_REG_SETUP_RETR, &setup_retr_reg, 1); + } } else { - feature_reg |= (1 << EN_DYN_ACK); - ret += _reg_write(si, SI24_REG_FEATURE, &feature_reg, 1); + if (params->mode == SEND_MODE) { + feature_reg |= (1 << EN_DYN_ACK); + ret += _reg_write(si, SI24_REG_FEATURE, &feature_reg, 1); + } } uint8_t aw; @@ -290,7 +294,7 @@ int main(void) }; const si24_opts_t opts = { - .mode = SEND_MODE, + .mode = RECV_MODE, .enable_ack = 1, .non_blocking = 0, .enable_crc = 1,