mirror of
https://github.com/apache/nuttx.git
synced 2026-06-04 06:42:32 +08:00
nuttx: replace all ARRAY_SIZE()/ARRAYSIZE() to nitems()
Signed-off-by: chao an <anchao@xiaomi.com>
This commit is contained in:
@@ -27,6 +27,8 @@
|
||||
#include <stdbool.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <sys/param.h>
|
||||
|
||||
#include <nuttx/board.h>
|
||||
#include <arch/board/board.h>
|
||||
|
||||
@@ -34,12 +36,6 @@
|
||||
#include "gd32f450z_eval.h"
|
||||
#ifdef CONFIG_ARCH_LEDS
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#define ARRAYSIZE(x) (sizeof((x)) / sizeof((x)[0]))
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
@@ -87,7 +83,7 @@ void board_autoled_initialize(void)
|
||||
|
||||
/* Configure the LED GPIO for output. */
|
||||
|
||||
for (i = 0; i < ARRAYSIZE(g_led_map); i++)
|
||||
for (i = 0; i < nitems(g_led_map); i++)
|
||||
{
|
||||
gd32_gpio_config(g_led_map[i]);
|
||||
}
|
||||
|
||||
@@ -27,6 +27,8 @@
|
||||
#include <stdbool.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <sys/param.h>
|
||||
|
||||
#include <nuttx/board.h>
|
||||
#include <arch/board/board.h>
|
||||
|
||||
@@ -35,12 +37,6 @@
|
||||
|
||||
#ifndef CONFIG_ARCH_LEDS
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#define ARRAYSIZE(x) (sizeof((x)) / sizeof((x)[0]))
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
@@ -100,7 +96,7 @@ uint32_t board_userled_initialize(void)
|
||||
|
||||
/* Configure the LED GPIO for output. */
|
||||
|
||||
for (i = 0; i < ARRAYSIZE(g_led_map); i++)
|
||||
for (i = 0; i < nitems(g_led_map); i++)
|
||||
{
|
||||
gd32_gpio_config(g_led_map[i]);
|
||||
}
|
||||
@@ -120,7 +116,7 @@ uint32_t board_userled_initialize(void)
|
||||
|
||||
void board_userled(int led, bool ledon)
|
||||
{
|
||||
if ((unsigned)led < ARRAYSIZE(g_led_map))
|
||||
if ((unsigned)led < nitems(g_led_map))
|
||||
{
|
||||
gd32_gpio_write(g_led_map[led], ledon);
|
||||
}
|
||||
@@ -144,7 +140,7 @@ void board_userled_all(uint32_t ledset)
|
||||
|
||||
/* Configure LED1-3 GPIOs for output */
|
||||
|
||||
for (i = 0; i < ARRAYSIZE(g_led_map); i++)
|
||||
for (i = 0; i < nitems(g_led_map); i++)
|
||||
{
|
||||
gd32_gpio_write(g_led_map[i], (ledset & g_led_setmap[i]) != 0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user