diff --git a/bsp/stm32/libraries/templates/stm32f10x/applications/main.c b/bsp/stm32/libraries/templates/stm32f10x/applications/main.c index 87a07a6246..7c40c1518d 100644 --- a/bsp/stm32/libraries/templates/stm32f10x/applications/main.c +++ b/bsp/stm32/libraries/templates/stm32f10x/applications/main.c @@ -11,14 +11,23 @@ #include #include #include +#include "drv_gpio.h" +/* defined the LED0 pin: PB1 */ +#define LED0_PIN GET_PIN(B, 1) int main(void) { int count = 1; + /* set LED0 pin mode to output */ + rt_pin_mode(LED0_PIN, PIN_MODE_OUTPUT); + while (count++) { - // rt_pin_write(LED0_PIN, !rt_pin_read(LED0_PIN)); + rt_pin_write(LED0_PIN, PIN_HIGH); + rt_thread_mdelay(500); + rt_pin_write(LED0_PIN, PIN_LOW); rt_thread_mdelay(500); } + return RT_EOK; } diff --git a/bsp/stm32/libraries/templates/stm32f10x/board/board.c b/bsp/stm32/libraries/templates/stm32f10x/board/board.c index ac55193461..36c127c5b7 100644 --- a/bsp/stm32/libraries/templates/stm32f10x/board/board.c +++ b/bsp/stm32/libraries/templates/stm32f10x/board/board.c @@ -51,12 +51,3 @@ void MX_GPIO_Init(void) __HAL_RCC_GPIOA_CLK_ENABLE(); } - -#ifdef RT_USING_PIN -// int board_pin_init(void) -// { -// rt_pin_mode(LED0_PIN, PIN_MODE_OUTPUT); -// return 0; -// } -// INIT_BOARD_EXPORT(board_pin_init); -#endif /* RT_USING_PIN */ diff --git a/bsp/stm32/libraries/templates/stm32f10x/board/board.h b/bsp/stm32/libraries/templates/stm32f10x/board/board.h index cc2079f0e7..1c00e71dca 100644 --- a/bsp/stm32/libraries/templates/stm32f10x/board/board.h +++ b/bsp/stm32/libraries/templates/stm32f10x/board/board.h @@ -15,12 +15,6 @@ #include #include "drv_common.h" -#ifdef BSP_USING_GPIO -#include "drv_gpio.h" -/* Board Pin definitions */ -// #define LED0_PIN GET_PIN(C, 0) -#endif - /* Internal SRAM memory size[Kbytes] <8-64>, Default: 64*/ #define STM32_SRAM_SIZE 20 #define STM32_SRAM_END (0x20000000 + STM32_SRAM_SIZE * 1024) diff --git a/bsp/stm32/libraries/templates/stm32f4xx/applications/main.c b/bsp/stm32/libraries/templates/stm32f4xx/applications/main.c index 87a07a6246..7c40c1518d 100644 --- a/bsp/stm32/libraries/templates/stm32f4xx/applications/main.c +++ b/bsp/stm32/libraries/templates/stm32f4xx/applications/main.c @@ -11,14 +11,23 @@ #include #include #include +#include "drv_gpio.h" +/* defined the LED0 pin: PB1 */ +#define LED0_PIN GET_PIN(B, 1) int main(void) { int count = 1; + /* set LED0 pin mode to output */ + rt_pin_mode(LED0_PIN, PIN_MODE_OUTPUT); + while (count++) { - // rt_pin_write(LED0_PIN, !rt_pin_read(LED0_PIN)); + rt_pin_write(LED0_PIN, PIN_HIGH); + rt_thread_mdelay(500); + rt_pin_write(LED0_PIN, PIN_LOW); rt_thread_mdelay(500); } + return RT_EOK; } diff --git a/bsp/stm32/libraries/templates/stm32f4xx/board/board.c b/bsp/stm32/libraries/templates/stm32f4xx/board/board.c index 928bbdbbde..b3cf3b0754 100644 --- a/bsp/stm32/libraries/templates/stm32f4xx/board/board.c +++ b/bsp/stm32/libraries/templates/stm32f4xx/board/board.c @@ -56,12 +56,3 @@ void MX_GPIO_Init(void) __HAL_RCC_GPIOA_CLK_ENABLE(); } - -#ifdef RT_USING_PIN -// int board_pin_init(void) -// { -// rt_pin_mode(LED0_PIN, PIN_MODE_OUTPUT); -// return 0; -// } -// INIT_BOARD_EXPORT(board_pin_init); -#endif /* RT_USING_PIN */ diff --git a/bsp/stm32/libraries/templates/stm32f4xx/board/board.h b/bsp/stm32/libraries/templates/stm32f4xx/board/board.h index 8cb36267f7..f7944b4ed7 100644 --- a/bsp/stm32/libraries/templates/stm32f4xx/board/board.h +++ b/bsp/stm32/libraries/templates/stm32f4xx/board/board.h @@ -15,12 +15,6 @@ #include #include "drv_common.h" -#ifdef BSP_USING_GPIO -#include "drv_gpio.h" -/* Board Pin definitions */ -// #define LED0_PIN GET_PIN(C, 0) -#endif - #define STM32_SRAM_SIZE 128 #define STM32_SRAM_END (0x20000000 + STM32_SRAM_SIZE * 1024) diff --git a/bsp/stm32/libraries/templates/stm32l4xx/applications/main.c b/bsp/stm32/libraries/templates/stm32l4xx/applications/main.c index 87a07a6246..7c40c1518d 100644 --- a/bsp/stm32/libraries/templates/stm32l4xx/applications/main.c +++ b/bsp/stm32/libraries/templates/stm32l4xx/applications/main.c @@ -11,14 +11,23 @@ #include #include #include +#include "drv_gpio.h" +/* defined the LED0 pin: PB1 */ +#define LED0_PIN GET_PIN(B, 1) int main(void) { int count = 1; + /* set LED0 pin mode to output */ + rt_pin_mode(LED0_PIN, PIN_MODE_OUTPUT); + while (count++) { - // rt_pin_write(LED0_PIN, !rt_pin_read(LED0_PIN)); + rt_pin_write(LED0_PIN, PIN_HIGH); + rt_thread_mdelay(500); + rt_pin_write(LED0_PIN, PIN_LOW); rt_thread_mdelay(500); } + return RT_EOK; } diff --git a/bsp/stm32/libraries/templates/stm32l4xx/board/board.c b/bsp/stm32/libraries/templates/stm32l4xx/board/board.c index d0e25eaf04..5f8113f4d7 100644 --- a/bsp/stm32/libraries/templates/stm32l4xx/board/board.c +++ b/bsp/stm32/libraries/templates/stm32l4xx/board/board.c @@ -66,12 +66,3 @@ void MX_GPIO_Init(void) __HAL_RCC_GPIOA_CLK_ENABLE(); } - -#ifdef RT_USING_PIN -// int board_pin_init(void) -// { -// rt_pin_mode(LED0_PIN, PIN_MODE_OUTPUT); -// return 0; -// } -// INIT_BOARD_EXPORT(board_pin_init); -#endif /* RT_USING_PIN */ diff --git a/bsp/stm32/libraries/templates/stm32l4xx/board/board.h b/bsp/stm32/libraries/templates/stm32l4xx/board/board.h index 2b3e8b6cb1..29e1ba4267 100644 --- a/bsp/stm32/libraries/templates/stm32l4xx/board/board.h +++ b/bsp/stm32/libraries/templates/stm32l4xx/board/board.h @@ -15,12 +15,6 @@ #include #include "drv_common.h" -#ifdef BSP_USING_GPIO -#include "drv_gpio.h" -/* Board Pin definitions */ -// #define LED0_PIN GET_PIN(C, 0) -#endif - #define STM32_SRAM_SIZE 96 #define STM32_SRAM_END (0x20000000 + STM32_SRAM_SIZE * 1024) diff --git a/bsp/stm32/stm32f103-atk-nano/applications/main.c b/bsp/stm32/stm32f103-atk-nano/applications/main.c index 61f0263ca2..e5b96d8280 100644 --- a/bsp/stm32/stm32f103-atk-nano/applications/main.c +++ b/bsp/stm32/stm32f103-atk-nano/applications/main.c @@ -11,14 +11,23 @@ #include #include #include +#include "drv_gpio.h" +/* defined the LED0 pin: PC0 */ +#define LED0_PIN GET_PIN(C, 0) int main(void) { int count = 1; + /* set LED0 pin mode to output */ + rt_pin_mode(LED0_PIN, PIN_MODE_OUTPUT); + while (count++) { - rt_pin_write(LED0_PIN, !rt_pin_read(LED0_PIN)); + rt_pin_write(LED0_PIN, PIN_HIGH); + rt_thread_mdelay(500); + rt_pin_write(LED0_PIN, PIN_LOW); rt_thread_mdelay(500); } + return RT_EOK; } diff --git a/bsp/stm32/stm32f103-atk-nano/board/board.c b/bsp/stm32/stm32f103-atk-nano/board/board.c index 28bb36889c..981fffc85e 100644 --- a/bsp/stm32/stm32f103-atk-nano/board/board.c +++ b/bsp/stm32/stm32f103-atk-nano/board/board.c @@ -62,11 +62,4 @@ void MX_GPIO_Init(void) __HAL_RCC_GPIOA_CLK_ENABLE(); } -#ifdef RT_USING_PIN -int board_pin_init(void) -{ - rt_pin_mode(LED0_PIN, PIN_MODE_OUTPUT); - return 0; -} -INIT_BOARD_EXPORT(board_pin_init); -#endif /* RT_USING_PIN */ + diff --git a/bsp/stm32/stm32f103-atk-nano/board/board.h b/bsp/stm32/stm32f103-atk-nano/board/board.h index 410414c202..a22d23632a 100644 --- a/bsp/stm32/stm32f103-atk-nano/board/board.h +++ b/bsp/stm32/stm32f103-atk-nano/board/board.h @@ -15,13 +15,6 @@ #include #include "drv_common.h" -#ifdef BSP_USING_GPIO -#include "drv_gpio.h" -/* Board Pin definitions */ -#define LED0_PIN GET_PIN(C, 0) -#define LED1_PIN GET_PIN(C, 1) -#endif - #define STM32_FLASH_START_ADRESS ((uint32_t)0x08000000) #define STM32_FLASH_SIZE (128 * 1024) #define STM32_FLASH_END_ADDRESS ((uint32_t)(STM32_FLASH_START_ADRESS + STM32_FLASH_SIZE)) diff --git a/bsp/stm32/stm32f103-fire-arbitrary/applications/main.c b/bsp/stm32/stm32f103-fire-arbitrary/applications/main.c index 2042a40378..4024c1ae3f 100644 --- a/bsp/stm32/stm32f103-fire-arbitrary/applications/main.c +++ b/bsp/stm32/stm32f103-fire-arbitrary/applications/main.c @@ -11,14 +11,23 @@ #include #include #include +#include "drv_gpio.h" +/* defined the LED0 pin: PF7 */ +#define LED0_PIN GET_PIN(F, 7) int main(void) { int count = 1; + /* set LED0 pin mode to output */ + rt_pin_mode(LED0_PIN, PIN_MODE_OUTPUT); + while (count++) { - rt_pin_write(LED0_PIN, !rt_pin_read(LED0_PIN)); + rt_pin_write(LED0_PIN, PIN_HIGH); + rt_thread_mdelay(500); + rt_pin_write(LED0_PIN, PIN_LOW); rt_thread_mdelay(500); } + return RT_EOK; } diff --git a/bsp/stm32/stm32f103-fire-arbitrary/board/board.c b/bsp/stm32/stm32f103-fire-arbitrary/board/board.c index 3188bdb616..829addae08 100644 --- a/bsp/stm32/stm32f103-fire-arbitrary/board/board.c +++ b/bsp/stm32/stm32f103-fire-arbitrary/board/board.c @@ -63,14 +63,3 @@ void MX_GPIO_Init(void) __HAL_RCC_GPIOC_CLK_ENABLE(); __HAL_RCC_GPIOD_CLK_ENABLE(); } - -#ifdef RT_USING_PIN -int board_pin_init(void) -{ - rt_pin_mode(LED0_PIN, PIN_MODE_OUTPUT); - rt_pin_mode(LED1_PIN, PIN_MODE_OUTPUT); - - return 0; -} -INIT_BOARD_EXPORT(board_pin_init); -#endif /* RT_USING_PIN */ diff --git a/bsp/stm32/stm32f103-fire-arbitrary/board/board.h b/bsp/stm32/stm32f103-fire-arbitrary/board/board.h index fc77f71a95..d0718d5525 100644 --- a/bsp/stm32/stm32f103-fire-arbitrary/board/board.h +++ b/bsp/stm32/stm32f103-fire-arbitrary/board/board.h @@ -15,13 +15,6 @@ #include #include "drv_common.h" -#ifdef BSP_USING_GPIO -#include "drv_gpio.h" -/* Board Pin definitions */ -#define LED0_PIN GET_PIN(F, 7) -#define LED1_PIN GET_PIN(F, 8) -#endif - /* Internal SRAM memory size[Kbytes] <8-64>, Default: 64*/ #define STM32_SRAM_SIZE 64 #define STM32_SRAM_END (0x20000000 + STM32_SRAM_SIZE * 1024) diff --git a/bsp/stm32/stm32f407-atk-explorer/applications/main.c b/bsp/stm32/stm32f407-atk-explorer/applications/main.c index 5d7f42bdab..b7bd6a1249 100644 --- a/bsp/stm32/stm32f407-atk-explorer/applications/main.c +++ b/bsp/stm32/stm32f407-atk-explorer/applications/main.c @@ -12,14 +12,23 @@ #include #include #include +#include "drv_gpio.h" +/* defined the LED0 pin: PF9 */ +#define LED0_PIN GET_PIN(F, 9) int main(void) { int count = 1; + /* set LED0 pin mode to output */ + rt_pin_mode(LED0_PIN, PIN_MODE_OUTPUT); + while (count++) { - rt_pin_write(LED1_PIN, !rt_pin_read(LED1_PIN)); + rt_pin_write(LED0_PIN, PIN_HIGH); + rt_thread_mdelay(500); + rt_pin_write(LED0_PIN, PIN_LOW); rt_thread_mdelay(500); } + return RT_EOK; } diff --git a/bsp/stm32/stm32f407-atk-explorer/board/board.c b/bsp/stm32/stm32f407-atk-explorer/board/board.c index 52145fe832..cea8c7fff9 100644 --- a/bsp/stm32/stm32f407-atk-explorer/board/board.c +++ b/bsp/stm32/stm32f407-atk-explorer/board/board.c @@ -67,14 +67,3 @@ void MX_GPIO_Init(void) __HAL_RCC_GPIOB_CLK_ENABLE(); } - -#ifdef RT_USING_PIN -int board_pin_init(void) -{ - rt_pin_mode(LED0_PIN, PIN_MODE_OUTPUT); - rt_pin_mode(LED1_PIN, PIN_MODE_OUTPUT); - - return 0; -} -INIT_BOARD_EXPORT(board_pin_init); -#endif /* RT_USING_PIN */ diff --git a/bsp/stm32/stm32f407-atk-explorer/board/board.h b/bsp/stm32/stm32f407-atk-explorer/board/board.h index 4dab0eddd3..77928f7f80 100644 --- a/bsp/stm32/stm32f407-atk-explorer/board/board.h +++ b/bsp/stm32/stm32f407-atk-explorer/board/board.h @@ -15,13 +15,6 @@ #include #include "drv_common.h" -#ifdef BSP_USING_GPIO -#include "drv_gpio.h" -/* Board Pin definitions */ -#define LED0_PIN GET_PIN(F, 9) -#define LED1_PIN GET_PIN(F, 10) -#endif - #define STM32_SRAM_SIZE (128) #define STM32_SRAM_END (0x20000000 + STM32_SRAM_SIZE * 1024) diff --git a/bsp/stm32/stm32f429-atk-apollo/applications/main.c b/bsp/stm32/stm32f429-atk-apollo/applications/main.c index 768cedfae7..7c40c1518d 100644 --- a/bsp/stm32/stm32f429-atk-apollo/applications/main.c +++ b/bsp/stm32/stm32f429-atk-apollo/applications/main.c @@ -11,14 +11,23 @@ #include #include #include +#include "drv_gpio.h" +/* defined the LED0 pin: PB1 */ +#define LED0_PIN GET_PIN(B, 1) int main(void) { int count = 1; + /* set LED0 pin mode to output */ + rt_pin_mode(LED0_PIN, PIN_MODE_OUTPUT); + while (count++) { - rt_pin_write(LED1_PIN, !rt_pin_read(LED1_PIN)); + rt_pin_write(LED0_PIN, PIN_HIGH); + rt_thread_mdelay(500); + rt_pin_write(LED0_PIN, PIN_LOW); rt_thread_mdelay(500); } + return RT_EOK; } diff --git a/bsp/stm32/stm32f429-atk-apollo/board/board.c b/bsp/stm32/stm32f429-atk-apollo/board/board.c index 91cde7a95d..a0d2cd17a5 100644 --- a/bsp/stm32/stm32f429-atk-apollo/board/board.c +++ b/bsp/stm32/stm32f429-atk-apollo/board/board.c @@ -77,14 +77,3 @@ void MX_GPIO_Init(void) __HAL_RCC_GPIOD_CLK_ENABLE(); __HAL_RCC_GPIOG_CLK_ENABLE(); } - -#ifdef RT_USING_PIN -int board_pin_init(void) -{ - rt_pin_mode(LED0_PIN, PIN_MODE_OUTPUT); - rt_pin_mode(LED1_PIN, PIN_MODE_OUTPUT); - - return 0; -} -INIT_BOARD_EXPORT(board_pin_init); -#endif /* RT_USING_PIN */ diff --git a/bsp/stm32/stm32f429-atk-apollo/board/board.h b/bsp/stm32/stm32f429-atk-apollo/board/board.h index 5d59b9bd77..8be558340c 100644 --- a/bsp/stm32/stm32f429-atk-apollo/board/board.h +++ b/bsp/stm32/stm32f429-atk-apollo/board/board.h @@ -15,10 +15,6 @@ #include #include "drv_common.h" -#ifdef BSP_USING_GPIO -#include "drv_gpio.h" -#endif - #define STM32_SRAM_SIZE (192) #define STM32_SRAM_END (0x20000000 + STM32_SRAM_SIZE * 1024) @@ -39,12 +35,7 @@ extern int __bss_end; #define HEAP_END STM32_SRAM_END -/* Board Pin definitions */ -#define LED0_PIN GET_PIN(B, 1) -#define LED1_PIN GET_PIN(B, 0) - void SystemClock_Config(void); void MX_GPIO_Init(void); #endif - diff --git a/bsp/stm32/stm32f429-fire-challenger/applications/main.c b/bsp/stm32/stm32f429-fire-challenger/applications/main.c index 582e5ed887..cee539b083 100644 --- a/bsp/stm32/stm32f429-fire-challenger/applications/main.c +++ b/bsp/stm32/stm32f429-fire-challenger/applications/main.c @@ -12,14 +12,23 @@ #include #include #include +#include "drv_gpio.h" +/* defined the LED0 pin: PH10 */ +#define LED0_PIN GET_PIN(H, 10) int main(void) { int count = 1; + /* set LED0 pin mode to output */ + rt_pin_mode(LED0_PIN, PIN_MODE_OUTPUT); + while (count++) { - rt_pin_write(LED1_PIN, !rt_pin_read(LED1_PIN)); + rt_pin_write(LED0_PIN, PIN_HIGH); + rt_thread_mdelay(500); + rt_pin_write(LED0_PIN, PIN_LOW); rt_thread_mdelay(500); } + return RT_EOK; } diff --git a/bsp/stm32/stm32f429-fire-challenger/board/board.c b/bsp/stm32/stm32f429-fire-challenger/board/board.c index 77961c793c..19559f4059 100644 --- a/bsp/stm32/stm32f429-fire-challenger/board/board.c +++ b/bsp/stm32/stm32f429-fire-challenger/board/board.c @@ -76,14 +76,3 @@ void MX_GPIO_Init(void) __HAL_RCC_GPIOG_CLK_ENABLE(); } - -#ifdef RT_USING_PIN -int board_pin_init(void) -{ - rt_pin_mode(LED0_PIN, PIN_MODE_OUTPUT); - rt_pin_mode(LED1_PIN, PIN_MODE_OUTPUT); - - return 0; -} -INIT_BOARD_EXPORT(board_pin_init); -#endif /* RT_USING_PIN */ diff --git a/bsp/stm32/stm32f429-fire-challenger/board/board.h b/bsp/stm32/stm32f429-fire-challenger/board/board.h index 4348bb5fb7..69a99bf672 100644 --- a/bsp/stm32/stm32f429-fire-challenger/board/board.h +++ b/bsp/stm32/stm32f429-fire-challenger/board/board.h @@ -15,10 +15,6 @@ #include #include "drv_common.h" -#ifdef BSP_USING_GPIO -#include "drv_gpio.h" -#endif - #define STM32_SRAM_SIZE (192) #define STM32_SRAM_END (0x20000000 + STM32_SRAM_SIZE * 1024) @@ -39,10 +35,6 @@ extern int __bss_end; #define HEAP_END STM32_SRAM_END -/* Board Pin definitions */ -#define LED0_PIN GET_PIN(H, 10) -#define LED1_PIN GET_PIN(H, 11) - void SystemClock_Config(void); void MX_GPIO_Init(void); diff --git a/bsp/stm32/stm32l475-atk-pandora/applications/main.c b/bsp/stm32/stm32l475-atk-pandora/applications/main.c index a802fd07e8..208dd4525f 100644 --- a/bsp/stm32/stm32l475-atk-pandora/applications/main.c +++ b/bsp/stm32/stm32l475-atk-pandora/applications/main.c @@ -11,14 +11,23 @@ #include #include #include +#include "drv_gpio.h" +/* defined the LED0 pin: PE7 */ +#define LED0_PIN GET_PIN(E, 7) int main(void) { int count = 1; + /* set LED0 pin mode to output */ + rt_pin_mode(LED0_PIN, PIN_MODE_OUTPUT); + while (count++) { - rt_pin_write(LED0_PIN, !rt_pin_read(LED0_PIN)); + rt_pin_write(LED0_PIN, PIN_HIGH); + rt_thread_mdelay(500); + rt_pin_write(LED0_PIN, PIN_LOW); rt_thread_mdelay(500); } + return RT_EOK; } diff --git a/bsp/stm32/stm32l475-atk-pandora/board/board.c b/bsp/stm32/stm32l475-atk-pandora/board/board.c index 4c6d7f61ea..78eb82025c 100644 --- a/bsp/stm32/stm32l475-atk-pandora/board/board.c +++ b/bsp/stm32/stm32l475-atk-pandora/board/board.c @@ -74,12 +74,3 @@ void MX_GPIO_Init(void) __HAL_RCC_GPIOB_CLK_ENABLE(); } - -#ifdef RT_USING_PIN -int board_pin_init(void) -{ - rt_pin_mode(LED0_PIN, PIN_MODE_OUTPUT); - return 0; -} -INIT_BOARD_EXPORT(board_pin_init); -#endif /* RT_USING_PIN */ diff --git a/bsp/stm32/stm32l475-atk-pandora/board/board.h b/bsp/stm32/stm32l475-atk-pandora/board/board.h index 43ea79b4e4..df4023b4bb 100644 --- a/bsp/stm32/stm32l475-atk-pandora/board/board.h +++ b/bsp/stm32/stm32l475-atk-pandora/board/board.h @@ -15,10 +15,6 @@ #include #include "drv_common.h" -#ifdef BSP_USING_GPIO -#include "drv_gpio.h" -#endif - #define STM32_SRAM1_SIZE (96) #define STM32_SRAM1_START (0x20000000) #define STM32_SRAM1_END (STM32_SRAM1_START + STM32_SRAM1_SIZE * 1024) @@ -30,10 +26,6 @@ #define HEAP_BEGIN STM32_SRAM1_START #define HEAP_END STM32_SRAM1_END -/* Board Pin definitions */ -#define LED0_PIN GET_PIN(E, 7) -#define LED1_PIN GET_PIN(E, 8) - void SystemClock_Config(void); void MX_GPIO_Init(void);