Skip to content

Commit 597ac31

Browse files
committed
add mcxa346-RTduino
1 parent 9a6d515 commit 597ac31

File tree

9 files changed

+161
-0
lines changed

9 files changed

+161
-0
lines changed

bsp/nxp/mcx/mcxa/frdm-mcxa346/applications/SConscript

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ src = Glob('*.c')
77

88
group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH)
99

10+
if GetDepend(['PKG_USING_RTDUINO']) and not GetDepend(['RTDUINO_NO_SETUP_LOOP']):
11+
src += ['arduino_main.cpp']
12+
1013
list = os.listdir(cwd)
1114
for item in list:
1215
if os.path.isfile(os.path.join(cwd, item, 'SConscript')):
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
* Copyright (c) 2006-2023, RT-Thread Development Team
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*
6+
* Change Logs:
7+
* Date Author Notes
8+
* 2025-12-08 westcity-yolo first version
9+
*
10+
*/
11+
12+
#include <Arduino.h>
13+
14+
void setup(void)
15+
{
16+
/* put your setup code here, to run once: */
17+
Serial.begin();
18+
Serial.println("Hello RTduino!");
19+
}
20+
21+
void loop(void)
22+
{
23+
/* put your main code here, to run repeatedly: */
24+
delay(1000);
25+
}
94.9 KB
Loading
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
from building import *
2+
3+
cwd = GetCurrentDir()
4+
src = Glob('*.c') + Glob('*.cpp')
5+
inc = [cwd]
6+
7+
group = DefineGroup('RTduino-pinout', src, depend = ['PKG_USING_RTDUINO'], CPPPATH = inc)
8+
9+
Return('group')
895 KB
Loading
776 KB
Loading
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*
2+
* Copyright (c) 2006-2023, RT-Thread Development Team
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*
6+
* Change Logs:
7+
* Date Author Notes
8+
* 2023-02-22 ChuShicheng first version
9+
* 2023-02-23 Wangyuqiang second version
10+
*/
11+
12+
#include <Arduino.h>
13+
#include <board.h>
14+
#include <drv_pin.h>
15+
#include "pins_arduino.h"
16+
17+
/*
18+
* {Arduino Pin, RT-Thread Pin [, Device Name, Channel]}
19+
* [] means optional
20+
* Digital pins must NOT give the device name and channel.
21+
* Analog pins MUST give the device name and channel(ADC, PWM or DAC).
22+
* Arduino Pin must keep in sequence.
23+
*/
24+
const pin_map_t pin_map_table[]=
25+
{
26+
{D0, GET_PINS(2,3), "uart2"}, /* Serial2-RX */
27+
{D1, GET_PINS(2,2), "uart2"}, /* Serial2-TX */
28+
{D2, GET_PINS(3,31)},
29+
{D3, GET_PINS(3,14), "pwm1", 1}, /* PWM */
30+
{D4, GET_PINS(4,7)},
31+
{D5, GET_PINS(3,1), "pwm0", 0}, /* PWM */
32+
{D6, GET_PINS(3,17), "pwm1", 0}, /* PWM */
33+
{D7, GET_PINS(3,22)},
34+
{D8, GET_PINS(4,3)},
35+
{D9, GET_PINS(3,13), "pwm1", 2}, /* PWM */
36+
{D10, GET_PINS(3,11),"spi1"}, /* SPI-SS */
37+
{D11, GET_PINS(3,8), "spi1"}, /* SPI-SDO */
38+
{D12, GET_PINS(3,9), "spi1"}, /* SPI-SDI */
39+
{D13, GET_PINS(3,10),"spi1"}, /* SPI-SCK */
40+
{D18, GET_PINS(1,8),"i2c2"}, /* I2C-SDA (Wire) */
41+
{D19, GET_PINS(1,9),"i2c2"}, /* I2C-SCL (Wire) */
42+
{A0, GET_PINS(1,14),"adc1", 12}, /* ADC */
43+
{A1, GET_PINS(2,5), "adc1", 1}, /* ADC */
44+
{A2, GET_PINS(2,7),"adc0", 7}, /* ADC */
45+
{A3, GET_PINS(3,30),"adc1", 21},
46+
{A4, GET_PINS(1,0),"i2c1"}, /* I2C-SDA (Wire) */
47+
{A5, GET_PINS(1,1),"i2c1"}, /* I2C-SCL (Wire) */
48+
49+
};
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
/*
2+
* Copyright (c) 2006-2023, RT-Thread Development Team
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*
6+
* Change Logs:
7+
* Date Author Notes
8+
* 2025-12-08 westcity-yolo first version
9+
*
10+
*/
11+
12+
#ifndef Pins_Arduino_h
13+
#define Pins_Arduino_h
14+
15+
#define GET_PINS(PORTx, PINx) (32 * PORTx + PINx)
16+
17+
/* pins alias. Must keep in sequence */
18+
#define D0 (0)
19+
#define D1 (1)
20+
#define D2 (2)
21+
#define D3 (3)
22+
#define D4 (4)
23+
#define D5 (5)
24+
#define D6 (6)
25+
#define D7 (7)
26+
#define D8 (8)
27+
#define D9 (9)
28+
#define D10 (10)
29+
#define D11 (11)
30+
#define D12 (12)
31+
#define D13 (13)
32+
#define D18 (14)
33+
#define D19 (15)
34+
35+
#define A0 (16)
36+
#define A1 (17)
37+
#define A2 (18)
38+
#define A3 (19)
39+
#define A4 (20)
40+
#define A5 (21)
41+
#define A6 (22)
42+
#define A7 (23)
43+
44+
#define RTDUINO_PIN_MAX_LIMIT A7 /* pin number max limit check */
45+
46+
#define F_CPU 180000000L /* CPU:180MHz */
47+
48+
/* i2c2 : P(,1_8-SDA P(,1_9-SCL */
49+
#define RTDUINO_DEFAULT_IIC_BUS_NAME "i2c2"
50+
51+
/* Serial2 : P(,2_2-TX P(,2_3-RX */
52+
#define RTDUINO_SERIAL2_DEVICE_NAME "uart2"
53+
54+
/* spi1 : P(,3_8-SDO P(,3_9-SDI P(,3_10-SCK P(,3_11-SS */
55+
56+
#define RTDUINO_DEFAULT_SPI_BUS_NAME "spi1"
57+
58+
#endif /* Pins_Arduino_h */

bsp/nxp/mcx/mcxa/frdm-mcxa346/board/Kconfig

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,23 @@ menu "On-chip Peripheral Drivers"
123123
endif
124124
endmenu
125125

126+
menu "Onboard Peripheral Drivers"
127+
config BSP_USING_ARDUINO
128+
bool "Compatible with Arduino Ecosystem (RTduino)"
129+
select PKG_USING_RTDUINO
130+
select BSP_USING_UART2
131+
select BSP_USING_GPIO
132+
select BSP_USING_ADC
133+
select BSP_USING_ADC0
134+
select BSP_USING_ADC0_CH0
135+
select BSP_USING_PWM
136+
select BSP_USING_I2C
137+
select BSP_USING_I2C1
138+
select RTDUINO_USING_WIRE
139+
imply RTDUINO_USING_SERVO
140+
default n
141+
endmenu
142+
126143

127144
menu "Board extended module Drivers"
128145
menuconfig BSP_USING_RW007

0 commit comments

Comments
 (0)