Skip to content

Commit 5d9b7b4

Browse files
committed
fix co-pliot issue
1 parent 4e10801 commit 5d9b7b4

3 files changed

Lines changed: 22 additions & 12 deletions

File tree

bsp/nxp/mcx/mcxa/Libraries/drivers/drv_spi.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,20 @@ static struct lpc_spi lpc_obj[] =
7979
rt_err_t rt_hw_spi_device_attach(const char *bus_name, const char *device_name, rt_uint32_t pin)
8080
{
8181
struct rt_spi_device *spi_device = rt_malloc(sizeof(struct rt_spi_device));
82+
rt_err_t ret;
83+
8284
if (!spi_device)
8385
{
8486
return -RT_ENOMEM;
8587
}
8688

87-
return rt_spi_bus_attach_device_cspin(spi_device, device_name, bus_name, pin, NULL);
89+
ret = rt_spi_bus_attach_device_cspin(spi_device, device_name, bus_name, pin, NULL);
90+
if (ret != RT_EOK)
91+
{
92+
rt_free(spi_device);
93+
}
94+
95+
return ret;
8896
}
8997

9098
static rt_err_t spi_configure(struct rt_spi_device *device, struct rt_spi_configuration *cfg)

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ cwd = GetCurrentDir()
55
CPPPATH = [cwd]
66
src = Glob('*.c')
77

8-
group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH)
9-
108
if GetDepend(['PKG_USING_RTDUINO']) and not GetDepend(['RTDUINO_NO_SETUP_LOOP']):
119
src += ['arduino_main.cpp']
1210

11+
group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH)
12+
1313
list = os.listdir(cwd)
1414
for item in list:
1515
if os.path.isfile(os.path.join(cwd, item, 'SConscript')):

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

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ menu "On-chip Peripheral Drivers"
2626

2727
if BSP_USING_UART
2828
config BSP_USING_UART2
29-
bool "Enable LPUART2 as defalt UART"
29+
bool "Enable LPUART2 as default UART"
3030
default y
3131

3232
endif
@@ -136,14 +136,16 @@ menu "Onboard Peripheral Drivers"
136136
config BSP_USING_ARDUINO
137137
bool "Compatible with Arduino Ecosystem (RTduino)"
138138
select PKG_USING_RTDUINO
139-
select BSP_USING_UART2
140-
select BSP_USING_GPIO
141-
select BSP_USING_ADC0
142-
select BSP_USING_PWM0
143-
select BSP_USING_PWM1
144-
select BSP_USING_I2C1
145-
select BSP_USING_I2C2
146-
select BSP_USING_SPI1
139+
select BSP_USING_PIN
140+
select BSP_USING_UART
141+
select BSP_USING_UART2
142+
select BSP_USING_I2C
143+
select BSP_USING_SPI
144+
select BSP_USING_SPI1
145+
select BSP_USING_ADC
146+
select BSP_USING_PWM
147+
select BSP_USING_PWM0
148+
select BSP_USING_PWM1
147149
endmenu
148150

149151

0 commit comments

Comments
 (0)