[spi] soft_spi_pin_init loop variable is initialized to 0

The loop variable in the function 'drv_soft_spi:xx_pin_init()' is initialized to 0.
This commit is contained in:
LZerro 2024-04-30 05:49:20 +08:00 committed by GitHub
parent 2aa66b1b4e
commit a92f971267
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 7 additions and 7 deletions

View File

@ -185,7 +185,7 @@ static void lpc_pin_init(void)
{ {
rt_size_t obj_num = sizeof(spi_obj) / sizeof(struct lpc_soft_spi); rt_size_t obj_num = sizeof(spi_obj) / sizeof(struct lpc_soft_spi);
for(rt_size_t i; i < obj_num; i++) for(rt_size_t i = 0; i < obj_num; i++)
{ {
lpc_spi_gpio_init(&spi_obj[i]); lpc_spi_gpio_init(&spi_obj[i]);
} }

View File

@ -159,7 +159,7 @@ static void pico_pin_init(void)
{ {
rt_size_t obj_num = sizeof(spi_obj) / sizeof(struct pico_soft_spi); rt_size_t obj_num = sizeof(spi_obj) / sizeof(struct pico_soft_spi);
for(rt_size_t i; i < obj_num; i++) for(rt_size_t i = 0; i < obj_num; i++)
{ {
pico_spi_gpio_init(&spi_obj[i]); pico_spi_gpio_init(&spi_obj[i]);
} }

View File

@ -189,7 +189,7 @@ static void ra_pin_init(void)
{ {
rt_size_t obj_num = sizeof(spi_obj) / sizeof(struct ra_soft_spi); rt_size_t obj_num = sizeof(spi_obj) / sizeof(struct ra_soft_spi);
for(rt_size_t i; i < obj_num; i++) for(rt_size_t i = 0; i < obj_num; i++)
{ {
ra_spi_gpio_init(&spi_obj[i]); ra_spi_gpio_init(&spi_obj[i]);
} }

View File

@ -190,7 +190,7 @@ static void stm32_pin_init(void)
{ {
rt_size_t obj_num = sizeof(spi_obj) / sizeof(struct stm32_soft_spi); rt_size_t obj_num = sizeof(spi_obj) / sizeof(struct stm32_soft_spi);
for(rt_size_t i; i < obj_num; i++) for(rt_size_t i = 0; i < obj_num; i++)
{ {
stm32_spi_gpio_init(&spi_obj[i]); stm32_spi_gpio_init(&spi_obj[i]);
} }

View File

@ -44,8 +44,8 @@ const pin_map_t pin_map_table[]=
{D20, GET_PIN(G, 0)}, {D20, GET_PIN(G, 0)},
{D21, GET_PIN(A, 0)}, {D21, GET_PIN(A, 0)},
{D22, GET_PIN(G, 5), "sspi1"}, /* SOFT-SPI-SCK */ {D22, GET_PIN(G, 5), "sspi1"}, /* SOFT-SPI-SCK */
{D23, GET_PIN(G, 3), "sspi1"}, /* SOFT-SPI-SCK */ {D23, GET_PIN(G, 3), "sspi1"}, /* SOFT-SPI-MISO */
{D24, GET_PIN(G, 1), "sspi1"}, /* SOFT-SPI-SCK */ {D24, GET_PIN(G, 1), "sspi1"}, /* SOFT-SPI-MOSI */
{D25, GET_PIN(G, 7), "i2c4"}, /* I2C-SCL (Wire) */ {D25, GET_PIN(G, 7), "i2c4"}, /* I2C-SCL (Wire) */
{D26, GET_PIN(D, 7), "i2c4"}, /* I2C-SDA (Wire) */ {D26, GET_PIN(D, 7), "i2c4"}, /* I2C-SDA (Wire) */
{D27, GET_PIN(B, 6), "i2c5"}, /* I2C-SCL (Wire) */ {D27, GET_PIN(B, 6), "i2c5"}, /* I2C-SCL (Wire) */

View File

@ -193,7 +193,7 @@ static void ch32_pin_init(void)
{ {
rt_size_t obj_num = sizeof(spi_obj) / sizeof(struct ch32_soft_spi); rt_size_t obj_num = sizeof(spi_obj) / sizeof(struct ch32_soft_spi);
for(rt_size_t i; i < obj_num; i++) for(rt_size_t i = 0; i < obj_num; i++)
{ {
ch32_spi_gpio_init(&spi_obj[i]); ch32_spi_gpio_init(&spi_obj[i]);
} }