From a46bb0e2031791f7474fafbab0a3b5cc0a24c3f4 Mon Sep 17 00:00:00 2001 From: smlng Date: Thu, 2 Feb 2017 16:33:45 +0100 Subject: [PATCH] drivers/kw2xrf: correct signed/unsigned warnings --- drivers/kw2xrf/kw2xrf_getset.c | 10 ++++++---- drivers/kw2xrf/kw2xrf_netdev.c | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/kw2xrf/kw2xrf_getset.c b/drivers/kw2xrf/kw2xrf_getset.c index 5fe93b7eb995..9ad419a75add 100644 --- a/drivers/kw2xrf/kw2xrf_getset.c +++ b/drivers/kw2xrf/kw2xrf_getset.c @@ -32,8 +32,10 @@ #define KW2XRF_LQI_HW_MAX 230 /**< LQI Saturation Level */ /* Modem_PA_PWR Register (PA Power Control) has a valid range from 3-31 */ -#define MKW2XDRF_PA_RANGE_MAX 31 /**< Maximum value of PA Power Control Register */ -#define MKW2XDRF_PA_RANGE_MIN 3 /**< Minimum value of PA Power Control Register */ +#define KW2XRF_PA_RANGE_MAX 31 /**< Maximum value of PA Power Control Register */ +#define KW2XRF_PA_RANGE_MIN 3 /**< Minimum value of PA Power Control Register */ + +#define KW2XRF_NUM_CHANNEL (KW2XRF_MAX_CHANNEL - KW2XRF_MIN_CHANNEL + 1) /* PLL integer and fractional lookup tables * @@ -98,7 +100,7 @@ uint8_t kw2xrf_get_channel(kw2xrf_t *dev) uint16_t pll_frac = kw2xrf_read_dreg(dev, MKW2XDM_PLL_FRAC0_LSB); pll_frac |= ((uint16_t)kw2xrf_read_dreg(dev, MKW2XDM_PLL_FRAC0_MSB) << 8); - for (int i = 0; i < 16; i++) { + for (unsigned i = 0; i < KW2XRF_NUM_CHANNEL; i++) { if ((pll_frac_lt[i] == pll_frac) && (pll_int_lt[i] == pll_int)) { return i + 11; } @@ -284,7 +286,7 @@ void kw2xrf_set_addr_long(kw2xrf_t *dev, uint64_t addr) uint64_t tmp; uint8_t *ap = (uint8_t *)(&tmp); - for (int i = 0; i < IEEE802154_LONG_ADDRESS_LEN; i++) { + for (unsigned i = 0; i < IEEE802154_LONG_ADDRESS_LEN; i++) { dev->netdev.long_addr[i] = (uint8_t)(addr >> (i * 8)); ap[i] = (addr >> ((IEEE802154_LONG_ADDRESS_LEN - 1 - i) * 8)); } diff --git a/drivers/kw2xrf/kw2xrf_netdev.c b/drivers/kw2xrf/kw2xrf_netdev.c index a2aeff29d6b8..a717eabb2543 100644 --- a/drivers/kw2xrf/kw2xrf_netdev.c +++ b/drivers/kw2xrf/kw2xrf_netdev.c @@ -74,7 +74,7 @@ static int _init(netdev2_t *netdev) static size_t kw2xrf_tx_load(uint8_t *pkt_buf, uint8_t *buf, size_t len, size_t offset) { - for (int i = 0; i < len; i++) { + for (unsigned i = 0; i < len; i++) { pkt_buf[i + offset] = buf[i]; } return offset + len;