diff --git a/src/main/drivers/light_led_stm32f10x.c b/src/main/drivers/light_led_stm32f10x.c index 45fc55d466..383818e3f5 100644 --- a/src/main/drivers/light_led_stm32f10x.c +++ b/src/main/drivers/light_led_stm32f10x.c @@ -21,6 +21,8 @@ #include "platform.h" +#include "common/utils.h" + #include "system.h" #include "gpio.h" @@ -56,7 +58,7 @@ void ledInit(void) #endif }; - uint8_t gpio_count = sizeof(gpio_setup) / sizeof(gpio_setup[0]); + uint8_t gpio_count = ARRAYLEN(gpio_setup); #ifdef LED0 RCC_APB2PeriphClockCmd(LED0_PERIPHERAL, ENABLE); diff --git a/src/main/drivers/light_led_stm32f30x.c b/src/main/drivers/light_led_stm32f30x.c index 90b4a56c9e..4b22beb382 100644 --- a/src/main/drivers/light_led_stm32f30x.c +++ b/src/main/drivers/light_led_stm32f30x.c @@ -47,7 +47,7 @@ void ledInit(void) #endif }; - uint8_t gpio_count = sizeof(gpio_setup) / sizeof(gpio_setup[0]); + uint8_t gpio_count = ARRAYLEN(gpio_setup); #ifdef LED0 RCC_AHBPeriphClockCmd(LED0_PERIPHERAL, ENABLE); diff --git a/src/main/io/gps.c b/src/main/io/gps.c index f34008a697..a1f66698ce 100644 --- a/src/main/io/gps.c +++ b/src/main/io/gps.c @@ -28,6 +28,7 @@ #include "common/maths.h" #include "common/axis.h" +#include "common/utils.h" #include "drivers/system.h" #include "drivers/serial.h" @@ -185,7 +186,7 @@ static void shiftPacketLog(void) { uint32_t i; - for (i = sizeof(gpsPacketLog) - 1; i > 0 ; i--) { + for (i = ARRAYLEN(gpsPacketLog) - 1; i > 0 ; i--) { gpsPacketLog[i] = gpsPacketLog[i-1]; } }