From 787b854f271daaac842029b52c6a4bfcd1e070e7 Mon Sep 17 00:00:00 2001 From: Meco Man <920369182@qq.com> Date: Fri, 24 Dec 2021 02:18:07 -0500 Subject: [bsp][stm32l475] move arduino to application --- .../stm32l475-atk-pandora/applications/SConscript | 3 -- .../applications/arduino/SConscript | 12 ++++++ .../applications/arduino/arduino_main.cpp | 23 +++++++++++ .../applications/arduino/arduino_pinout.c | 48 ++++++++++++++++++++++ .../applications/arduino/arduino_pinout.h | 28 +++++++++++++ .../applications/arduino_main.cpp | 23 ----------- .../board/ports/arduino/SConscript | 9 ---- .../board/ports/arduino/arduino_pinout.c | 48 ---------------------- .../board/ports/arduino/arduino_pinout.h | 28 ------------- 9 files changed, 111 insertions(+), 111 deletions(-) create mode 100644 bsp/stm32/stm32l475-atk-pandora/applications/arduino/SConscript create mode 100644 bsp/stm32/stm32l475-atk-pandora/applications/arduino/arduino_main.cpp create mode 100644 bsp/stm32/stm32l475-atk-pandora/applications/arduino/arduino_pinout.c create mode 100644 bsp/stm32/stm32l475-atk-pandora/applications/arduino/arduino_pinout.h delete mode 100644 bsp/stm32/stm32l475-atk-pandora/applications/arduino_main.cpp delete mode 100644 bsp/stm32/stm32l475-atk-pandora/board/ports/arduino/SConscript delete mode 100644 bsp/stm32/stm32l475-atk-pandora/board/ports/arduino/arduino_pinout.c delete mode 100644 bsp/stm32/stm32l475-atk-pandora/board/ports/arduino/arduino_pinout.h (limited to 'bsp') diff --git a/bsp/stm32/stm32l475-atk-pandora/applications/SConscript b/bsp/stm32/stm32l475-atk-pandora/applications/SConscript index bfa9a40db9..2d88e1d248 100644 --- a/bsp/stm32/stm32l475-atk-pandora/applications/SConscript +++ b/bsp/stm32/stm32l475-atk-pandora/applications/SConscript @@ -8,9 +8,6 @@ src = ['main.c'] if GetDepend(['PKG_USING_NRF24L01']): src += ['nrf24l01_init.c'] -if GetDepend(['RT_USING_ARDUINO']): - src += ['arduino_main.cpp'] - CPPPATH = [cwd] group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH) diff --git a/bsp/stm32/stm32l475-atk-pandora/applications/arduino/SConscript b/bsp/stm32/stm32l475-atk-pandora/applications/arduino/SConscript new file mode 100644 index 0000000000..b3d32f3717 --- /dev/null +++ b/bsp/stm32/stm32l475-atk-pandora/applications/arduino/SConscript @@ -0,0 +1,12 @@ +from building import * + +cwd = GetCurrentDir() +src = ['arduino_pinout.c'] +inc = [cwd] + +group = DefineGroup('Arduino', src, depend = ['RT_USING_ARDUINO'], CPPPATH = inc) + +src = ['arduino_main.cpp'] +group = DefineGroup('Applications', src, depend = ['RT_USING_ARDUINO']) + +Return('group') diff --git a/bsp/stm32/stm32l475-atk-pandora/applications/arduino/arduino_main.cpp b/bsp/stm32/stm32l475-atk-pandora/applications/arduino/arduino_main.cpp new file mode 100644 index 0000000000..455e8b8492 --- /dev/null +++ b/bsp/stm32/stm32l475-atk-pandora/applications/arduino/arduino_main.cpp @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2006-2021, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2021-12-10 Meco Man first version + */ +#include + +void setup(void) +{ + // put your setup code here, to run once: + pinMode(LED_BUILTIN, OUTPUT); +} + +void loop(void) +{ + // put your main code here, to run repeatedly: + digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN)); + delay(200); +} diff --git a/bsp/stm32/stm32l475-atk-pandora/applications/arduino/arduino_pinout.c b/bsp/stm32/stm32l475-atk-pandora/applications/arduino/arduino_pinout.c new file mode 100644 index 0000000000..bf9eb45c84 --- /dev/null +++ b/bsp/stm32/stm32l475-atk-pandora/applications/arduino/arduino_pinout.c @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2006-2021, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2021-12-10 Meco Man first version + */ +#include +#include +#include "arduino_pinout.h" + +const pin_map_t pin_map_table[ARDUINO_PINOUT_PIN_MAX]= +{ + /* + {Arduino Pin, RT-Thread Pin [, Device Name(PWM or ADC), Channel]} + [] means optional + Digital pins must NOT give the device name and channel. + Analog pins MUST give the device name and channel(ADC or PWM). + */ + {0}, /* D0, RX */ + {1}, /* D1, TX */ + {2, GET_PIN(D,10)}, /* D2, BSP:KEY0 */ + {3}, /* D3, PWM */ + {4, GET_PIN(D,9)}, /* D4, BSP:KEY1 */ + {5, GET_PIN(D,8)}, /* D5, BSP:KEY2 */ + {6}, /* D6, PWM */ + {7}, /* D7 */ + {8, GET_PIN(E,7)}, /* D8, BSP: RED-LED */ + {9}, /* D9, PWM */ + {10, GET_PIN(E,9), "pwm1", 1}, /* D10, PWM, BSP: BLUE-LED */ + {11, GET_PIN(B,8), "pwm4", 3}, /* D11, PWM */ + {12, GET_PIN(B,2)}, /* D12, BSP: BEEP */ + {13, GET_PIN(E,8)}, /* D13, LED_BUILTIN, BSP: GREEN-LED */ + {14, GET_PIN(C,2), "adc1", 3}, /* D14, A0 */ + {15}, /* D15, A1 */ + {16}, /* D16, A2 */ + {17}, /* D17, A3 */ + {18}, /* D18, A4 */ + {19} /* D19, A5 */ +}; + +/* initialization for BSP; maybe a blank function */ +void initVariant(void) +{ + /* Nothing needs to initialize for this BSP */ +} diff --git a/bsp/stm32/stm32l475-atk-pandora/applications/arduino/arduino_pinout.h b/bsp/stm32/stm32l475-atk-pandora/applications/arduino/arduino_pinout.h new file mode 100644 index 0000000000..e3b7b8a47a --- /dev/null +++ b/bsp/stm32/stm32l475-atk-pandora/applications/arduino/arduino_pinout.h @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2006-2021, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2021-12-10 Meco Man first version + */ +#ifndef __UNO_PINOUT_H__ +#define __UNO_PINOUT_H__ + +#define LED_BUILTIN 13 /* Built-in LED */ + +#define ARDUINO_PWM_HZ 500 /* Arduino UNO's PWM is around 500Hz */ + +#define ARDUINO_PINOUT_PIN_MAX 20 /* Arduino UNO has 20 pins in total*/ +#define ARDUINO_PINOUT_ADC_MAX 6 /* Arduino UNO has 5 ADC pins */ +#define ARDUINO_PINOUT_PWM_MAX 5 /* Arduino UNO has 5 PWM pins */ + +#define A0 (14) +#define A1 (15) +#define A2 (16) +#define A3 (17) +#define A4 (18) +#define A5 (19) + +#endif /* __UNO_PINOUT_H__ */ diff --git a/bsp/stm32/stm32l475-atk-pandora/applications/arduino_main.cpp b/bsp/stm32/stm32l475-atk-pandora/applications/arduino_main.cpp deleted file mode 100644 index 455e8b8492..0000000000 --- a/bsp/stm32/stm32l475-atk-pandora/applications/arduino_main.cpp +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) 2006-2021, RT-Thread Development Team - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2021-12-10 Meco Man first version - */ -#include - -void setup(void) -{ - // put your setup code here, to run once: - pinMode(LED_BUILTIN, OUTPUT); -} - -void loop(void) -{ - // put your main code here, to run repeatedly: - digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN)); - delay(200); -} diff --git a/bsp/stm32/stm32l475-atk-pandora/board/ports/arduino/SConscript b/bsp/stm32/stm32l475-atk-pandora/board/ports/arduino/SConscript deleted file mode 100644 index 2c5b27d9d2..0000000000 --- a/bsp/stm32/stm32l475-atk-pandora/board/ports/arduino/SConscript +++ /dev/null @@ -1,9 +0,0 @@ -from building import * - -cwd = GetCurrentDir() -src = ['arduino_pinout.c'] -inc = [cwd] - -group = DefineGroup('Arduino', src, depend = ['RT_USING_ARDUINO'], CPPPATH = inc) - -Return('group') diff --git a/bsp/stm32/stm32l475-atk-pandora/board/ports/arduino/arduino_pinout.c b/bsp/stm32/stm32l475-atk-pandora/board/ports/arduino/arduino_pinout.c deleted file mode 100644 index bf9eb45c84..0000000000 --- a/bsp/stm32/stm32l475-atk-pandora/board/ports/arduino/arduino_pinout.c +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2006-2021, RT-Thread Development Team - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2021-12-10 Meco Man first version - */ -#include -#include -#include "arduino_pinout.h" - -const pin_map_t pin_map_table[ARDUINO_PINOUT_PIN_MAX]= -{ - /* - {Arduino Pin, RT-Thread Pin [, Device Name(PWM or ADC), Channel]} - [] means optional - Digital pins must NOT give the device name and channel. - Analog pins MUST give the device name and channel(ADC or PWM). - */ - {0}, /* D0, RX */ - {1}, /* D1, TX */ - {2, GET_PIN(D,10)}, /* D2, BSP:KEY0 */ - {3}, /* D3, PWM */ - {4, GET_PIN(D,9)}, /* D4, BSP:KEY1 */ - {5, GET_PIN(D,8)}, /* D5, BSP:KEY2 */ - {6}, /* D6, PWM */ - {7}, /* D7 */ - {8, GET_PIN(E,7)}, /* D8, BSP: RED-LED */ - {9}, /* D9, PWM */ - {10, GET_PIN(E,9), "pwm1", 1}, /* D10, PWM, BSP: BLUE-LED */ - {11, GET_PIN(B,8), "pwm4", 3}, /* D11, PWM */ - {12, GET_PIN(B,2)}, /* D12, BSP: BEEP */ - {13, GET_PIN(E,8)}, /* D13, LED_BUILTIN, BSP: GREEN-LED */ - {14, GET_PIN(C,2), "adc1", 3}, /* D14, A0 */ - {15}, /* D15, A1 */ - {16}, /* D16, A2 */ - {17}, /* D17, A3 */ - {18}, /* D18, A4 */ - {19} /* D19, A5 */ -}; - -/* initialization for BSP; maybe a blank function */ -void initVariant(void) -{ - /* Nothing needs to initialize for this BSP */ -} diff --git a/bsp/stm32/stm32l475-atk-pandora/board/ports/arduino/arduino_pinout.h b/bsp/stm32/stm32l475-atk-pandora/board/ports/arduino/arduino_pinout.h deleted file mode 100644 index e3b7b8a47a..0000000000 --- a/bsp/stm32/stm32l475-atk-pandora/board/ports/arduino/arduino_pinout.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2006-2021, RT-Thread Development Team - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2021-12-10 Meco Man first version - */ -#ifndef __UNO_PINOUT_H__ -#define __UNO_PINOUT_H__ - -#define LED_BUILTIN 13 /* Built-in LED */ - -#define ARDUINO_PWM_HZ 500 /* Arduino UNO's PWM is around 500Hz */ - -#define ARDUINO_PINOUT_PIN_MAX 20 /* Arduino UNO has 20 pins in total*/ -#define ARDUINO_PINOUT_ADC_MAX 6 /* Arduino UNO has 5 ADC pins */ -#define ARDUINO_PINOUT_PWM_MAX 5 /* Arduino UNO has 5 PWM pins */ - -#define A0 (14) -#define A1 (15) -#define A2 (16) -#define A3 (17) -#define A4 (18) -#define A5 (19) - -#endif /* __UNO_PINOUT_H__ */ -- cgit v1.3.1