1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/pkg/uwb-dw1000/patches/0007-uwb_dw1000-dw1000_mac-avoid-conflict-with-msp430-N.patch
2020-11-12 12:07:20 +01:00

48 lines
1.8 KiB
Diff

From cea55ec226b13c3c57c492af76d08573e834f164 Mon Sep 17 00:00:00 2001
From: Francisco Molina <femolina@uc.cl>
Date: Wed, 7 Oct 2020 16:14:22 +0200
Subject: [PATCH 7/7] uwb_dw1000/dw1000_mac: avoid conflict with msp430 #N
---
hw/drivers/uwb/uwb_dw1000/src/dw1000_mac.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/hw/drivers/uwb/uwb_dw1000/src/dw1000_mac.c b/hw/drivers/uwb/uwb_dw1000/src/dw1000_mac.c
index c4e5a3e..0d520b9 100644
--- a/hw/drivers/uwb/uwb_dw1000/src/dw1000_mac.c
+++ b/hw/drivers/uwb/uwb_dw1000/src/dw1000_mac.c
@@ -1841,25 +1841,25 @@ dpl_float32_t
dw1000_calc_fppl(struct _dw1000_dev_instance_t * inst,
struct _dw1000_dev_rxdiag_t * diag)
{
- dpl_float32_t A, N, v, fppl;
+ dpl_float32_t A, n, v, fppl;
if (diag->pacc_cnt == 0 ||
(!diag->fp_amp && !diag->fp_amp2 && !diag->fp_amp3)) {
return DPL_FLOAT32_NAN();
}
A = (inst->uwb_dev.config.prf == DWT_PRF_16M) ? DPL_FLOAT32_INIT(113.77f) : DPL_FLOAT32_INIT(121.74f);
#ifdef __KERNEL__
- N = ui32_to_f32(diag->pacc_cnt);
+ n = ui32_to_f32(diag->pacc_cnt);
v = f32_add(f32_add(ui32_to_f32(diag->fp_amp*diag->fp_amp),
ui32_to_f32(diag->fp_amp2*diag->fp_amp2)),
ui32_to_f32(diag->fp_amp3*diag->fp_amp3));
- v = f32_div(v, f32_mul(N, N));
+ v = f32_div(v, f32_mul(n, n));
fppl = f32_sub(f32_mul(DPL_FLOAT32_INIT(10.0), f64_to_f32(log10_soft(f32_to_f64(v)))), A);
#else
- N = (float)(diag->pacc_cnt);
+ n = (float)(diag->pacc_cnt);
v = (float)(diag->fp_amp*diag->fp_amp) +
(float)(diag->fp_amp2*diag->fp_amp2) +
(float)(diag->fp_amp3*diag->fp_amp3);
- v /= N * N;
+ v /= n * n;
fppl = 10.0f * log10f(v) - A;
#endif
return fppl;
--
2.28.0