From bdf0671cb36daca741c4842a37a3fc71744a63a2 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Fri, 28 Jan 2022 14:15:42 -0800 Subject: [PATCH] altos/ao_freq: Use uint32_t for radio freq setting value These values are always unsigned; changing this resolves some -Wconversion messages. Signed-off-by: Keith Packard --- src/kernel/ao.h | 2 +- src/kernel/ao_freq.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/kernel/ao.h b/src/kernel/ao.h index 806b4946..bf4b1839 100644 --- a/src/kernel/ao.h +++ b/src/kernel/ao.h @@ -965,7 +965,7 @@ ao_sqrt(uint32_t op); * ao_freq.c */ -int32_t ao_freq_to_set(int32_t freq, int32_t cal); +uint32_t ao_freq_to_set(uint32_t freq, uint32_t cal); /* * ao_ms5607.c diff --git a/src/kernel/ao_freq.c b/src/kernel/ao_freq.c index 5a701b91..5443ea22 100644 --- a/src/kernel/ao_freq.c +++ b/src/kernel/ao_freq.c @@ -33,12 +33,12 @@ * cal_freq */ -int32_t ao_freq_to_set(int32_t target_freq, int32_t cal_value) +uint32_t ao_freq_to_set(uint32_t target_freq, uint32_t cal_value) { - int64_t prod = (int64_t) target_freq * (int64_t) cal_value; + uint64_t prod = (uint64_t) target_freq * (uint64_t) cal_value; /* Round to nearest */ - int32_t target_value = (prod + (434550 / 2)) / 434550; + uint32_t target_value = (uint32_t) ((prod + (434550U / 2U)) / 434550U); return target_value; } -- 2.30.2