From 89bf823f7d2aa12782483f15d5f7240dbb3fdcf8 Mon Sep 17 00:00:00 2001 From: "Man, Jianting (Meco)" <920369182@qq.com> Date: Thu, 17 Feb 2022 00:36:15 -0500 Subject: [arduino][stm32l475] update application/arduino folder (#5599) --- .../applications/arduino/SConscript | 5 +-- .../applications/arduino/arduino_main.cpp | 23 ----------- .../applications/arduino/arduino_pinout.c | 48 ---------------------- .../applications/arduino/arduino_pinout.h | 28 ------------- .../applications/arduino/pins_arduino.c | 48 ++++++++++++++++++++++ .../applications/arduino/pins_arduino.h | 28 +++++++++++++ 6 files changed, 77 insertions(+), 103 deletions(-) delete mode 100644 bsp/stm32/stm32l475-atk-pandora/applications/arduino/arduino_main.cpp delete mode 100644 bsp/stm32/stm32l475-atk-pandora/applications/arduino/arduino_pinout.c delete mode 100644 bsp/stm32/stm32l475-atk-pandora/applications/arduino/arduino_pinout.h create mode 100644 bsp/stm32/stm32l475-atk-pandora/applications/arduino/pins_arduino.c create mode 100644 bsp/stm32/stm32l475-atk-pandora/applications/arduino/pins_arduino.h (limited to 'bsp') diff --git a/bsp/stm32/stm32l475-atk-pandora/applications/arduino/SConscript b/bsp/stm32/stm32l475-atk-pandora/applications/arduino/SConscript index 82cb10de12..cce015c7ea 100644 --- a/bsp/stm32/stm32l475-atk-pandora/applications/arduino/SConscript +++ b/bsp/stm32/stm32l475-atk-pandora/applications/arduino/SConscript @@ -1,12 +1,9 @@ from building import * cwd = GetCurrentDir() -src = ['arduino_pinout.c'] +src = Glob('*.c') + Glob('*.cpp') inc = [cwd] group = DefineGroup('Arduino', src, depend = ['RT_USING_ARDUINO'], CPPPATH = inc) -src = ['arduino_main.cpp'] -group = 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 deleted file mode 100644 index 455e8b8492..0000000000 --- a/bsp/stm32/stm32l475-atk-pandora/applications/arduino/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/applications/arduino/arduino_pinout.c b/bsp/stm32/stm32l475-atk-pandora/applications/arduino/arduino_pinout.c deleted file mode 100644 index bf9eb45c84..0000000000 --- a/bsp/stm32/stm32l475-atk-pandora/applications/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/applications/arduino/arduino_pinout.h b/bsp/stm32/stm32l475-atk-pandora/applications/arduino/arduino_pinout.h deleted file mode 100644 index 1ec160b9d7..0000000000 --- a/bsp/stm32/stm32l475-atk-pandora/applications/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 6 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/pins_arduino.c b/bsp/stm32/stm32l475-atk-pandora/applications/arduino/pins_arduino.c new file mode 100644 index 0000000000..38c08af4f3 --- /dev/null +++ b/bsp/stm32/stm32l475-atk-pandora/applications/arduino/pins_arduino.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 "pins_arduino.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/pins_arduino.h b/bsp/stm32/stm32l475-atk-pandora/applications/arduino/pins_arduino.h new file mode 100644 index 0000000000..1b0d5170ca --- /dev/null +++ b/bsp/stm32/stm32l475-atk-pandora/applications/arduino/pins_arduino.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 Pins_Arduino_h +#define Pins_Arduino_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 6 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 /* Pins_Arduino_h */ -- cgit v1.3.1