Browse Source

Merge pull request #2821 from willianchanlovegithub/dofly

[bsp][stm32][f103-dofly-m3s]Add support for nRF24L01 extension module
Bernard Xiong 6 years ago
parent
commit
0714dffc46

+ 1 - 1
bsp/stm32/stm32f103-dofly-M3S/README.md

@@ -50,7 +50,7 @@ STM32F103 德飞莱-尼莫 M3S 是徳飞莱推出的一款基于 ARM Cortex-M3 
 | I2C | 支持 | 软件I2C |
 | FLASH | 支持 | 已适配 [FAL](https://github.com/RT-Thread-packages/fal) |
 | **扩展模块** | **支持情况** | **备注** |
-| NRF24L01 | 暂不支持 | 即将支持 |
+| NRF24L01 | 支持 | 根据实际板子接线情况修改 NRF24L01 软件包中的 `NRF24L01_CE_PIN` 和 `NRF24_IRQ_PIN` 的宏定义,以及 SPI 设备名 |
 
 ## 使用说明
 

+ 23 - 0
bsp/stm32/stm32f103-dofly-M3S/applications/nrf24l01_init.c

@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2006-2018, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date           Author        Notes
+ * 2019-06-29     WillianChan   first version
+ */
+
+#include <rtthread.h>
+
+#ifdef PKG_USING_NRF24L01
+
+#include "drv_spi.h"
+static int rt_hw_nrf24l01_init(void)
+{
+    rt_hw_spi_device_attach("spi2", "spi20", GPIOG, GPIO_PIN_7);
+    return RT_EOK;
+}
+INIT_COMPONENT_EXPORT(rt_hw_nrf24l01_init);
+
+#endif

+ 7 - 0
bsp/stm32/stm32f103-dofly-M3S/board/Kconfig

@@ -130,6 +130,13 @@ endmenu
 
 menu "Board extended module Drivers"
 
+    config BSP_USING_NRF24L01
+        bool "Enable NRF24L01"
+        select BSP_USING_SPI
+        select BSP_USING_SPI2
+        select PKG_USING_NRF24L01
+        default n
+
 endmenu
 
 endmenu