Merge pull request #4025 from xckhmf/master
[bsp/nrf5x]support for uarte1
This commit is contained in:
commit
b437478e30
@ -9,8 +9,10 @@ src = Split("""
|
||||
""")
|
||||
|
||||
if GetDepend(['BSP_USING_UART']):
|
||||
src += ['drv_uart.c']
|
||||
|
||||
if GetDepend(['NRFX_USING_UART']):
|
||||
src += ['drv_uart.c']
|
||||
else:
|
||||
src += ['drv_uarte.c']
|
||||
if GetDepend(['BSP_USING_ON_CHIP_FLASH']):
|
||||
src += ['drv_flash.c']
|
||||
|
||||
|
281
bsp/nrf5x/libraries/drivers/drv_uarte.c
Normal file
281
bsp/nrf5x/libraries/drivers/drv_uarte.c
Normal file
@ -0,0 +1,281 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2020, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2020-04-28 xckhmf Modify for <nrfx>
|
||||
* 2020-10-31 xckhmf Support for UART1
|
||||
*
|
||||
*/
|
||||
#include <rtdevice.h>
|
||||
#include <nrfx_uarte.h>
|
||||
#include "drv_uart.h"
|
||||
|
||||
#ifdef BSP_USING_UART
|
||||
#if defined(BSP_USING_UART0) || defined(BSP_USING_UART1)
|
||||
typedef struct
|
||||
{
|
||||
struct rt_serial_device *serial;
|
||||
nrfx_uarte_t uarte_instance;
|
||||
uint8_t rx_length;
|
||||
uint8_t tx_buffer[1];
|
||||
uint8_t rx_buffer[1];
|
||||
bool isInit;
|
||||
uint32_t rx_pin;
|
||||
uint32_t tx_pin;
|
||||
} drv_uart_cb_t;
|
||||
|
||||
#ifdef BSP_USING_UART0
|
||||
static struct rt_serial_device m_serial_0;
|
||||
drv_uart_cb_t m_uarte0_cb = {
|
||||
.uarte_instance = NRFX_UARTE_INSTANCE(0),
|
||||
.rx_length = 0,
|
||||
.rx_pin = BSP_UART0_RX_PIN,
|
||||
.tx_pin = BSP_UART0_TX_PIN,
|
||||
.isInit = false
|
||||
};
|
||||
#endif /* BSP_USING_UART0 */
|
||||
|
||||
#ifdef BSP_USING_UART1
|
||||
static struct rt_serial_device m_serial_1;
|
||||
drv_uart_cb_t m_uarte1_cb = {
|
||||
.uarte_instance = NRFX_UARTE_INSTANCE(1),
|
||||
.rx_length = 0,
|
||||
.rx_pin = BSP_UART1_RX_PIN,
|
||||
.tx_pin = BSP_UART1_TX_PIN,
|
||||
.isInit = false
|
||||
};
|
||||
#endif /* BSP_USING_UART1 */
|
||||
|
||||
static void uarte_evt_handler(nrfx_uarte_event_t const * p_event,
|
||||
void * p_context)
|
||||
{
|
||||
drv_uart_cb_t *p_cb = RT_NULL;
|
||||
p_cb = (drv_uart_cb_t*)p_context;
|
||||
switch (p_event->type)
|
||||
{
|
||||
case NRFX_UARTE_EVT_RX_DONE:
|
||||
p_cb->rx_length = p_event->data.rxtx.bytes;
|
||||
if(p_cb->serial->parent.open_flag&RT_DEVICE_FLAG_INT_RX)
|
||||
{
|
||||
rt_hw_serial_isr(p_cb->serial, RT_SERIAL_EVENT_RX_IND);
|
||||
}
|
||||
(void)nrfx_uarte_rx(&(p_cb->uarte_instance), p_cb->rx_buffer, 1);
|
||||
break;
|
||||
|
||||
case NRFX_UARTE_EVT_ERROR:
|
||||
(void)nrfx_uarte_rx(&(p_cb->uarte_instance), p_cb->rx_buffer, 1);
|
||||
break;
|
||||
|
||||
case NRFX_UARTE_EVT_TX_DONE:
|
||||
if(p_cb->serial->parent.open_flag&RT_DEVICE_FLAG_INT_TX)
|
||||
{
|
||||
rt_hw_serial_isr(p_cb->serial, RT_SERIAL_EVENT_TX_DONE);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static rt_err_t _uart_cfg(struct rt_serial_device *serial, struct serial_configure *cfg)
|
||||
{
|
||||
nrfx_uarte_config_t config = NRFX_UARTE_DEFAULT_CONFIG(NRF_UARTE_PSEL_DISCONNECTED,\
|
||||
NRF_UARTE_PSEL_DISCONNECTED);
|
||||
|
||||
drv_uart_cb_t *p_cb = RT_NULL;
|
||||
|
||||
RT_ASSERT(serial != RT_NULL);
|
||||
RT_ASSERT(cfg != RT_NULL);
|
||||
|
||||
if (serial->parent.user_data == RT_NULL)
|
||||
{
|
||||
return -RT_ERROR;
|
||||
}
|
||||
p_cb = (drv_uart_cb_t*)serial->parent.user_data;
|
||||
if(p_cb->isInit)
|
||||
{
|
||||
nrfx_uarte_uninit(&(p_cb->uarte_instance));
|
||||
p_cb->isInit = false;
|
||||
}
|
||||
|
||||
switch (cfg->baud_rate)
|
||||
{
|
||||
case BAUD_RATE_2400:
|
||||
config.baudrate = NRF_UARTE_BAUDRATE_2400;
|
||||
break;
|
||||
case BAUD_RATE_4800:
|
||||
config.baudrate = NRF_UARTE_BAUDRATE_4800;
|
||||
break;
|
||||
case BAUD_RATE_9600:
|
||||
config.baudrate = NRF_UARTE_BAUDRATE_9600;
|
||||
break;
|
||||
case BAUD_RATE_19200:
|
||||
config.baudrate = NRF_UARTE_BAUDRATE_19200;
|
||||
break;
|
||||
case BAUD_RATE_38400:
|
||||
config.baudrate = NRF_UARTE_BAUDRATE_38400;
|
||||
break;
|
||||
case BAUD_RATE_57600:
|
||||
config.baudrate = NRF_UARTE_BAUDRATE_57600;
|
||||
break;
|
||||
case BAUD_RATE_115200:
|
||||
config.baudrate = NRF_UARTE_BAUDRATE_115200;
|
||||
break;
|
||||
case BAUD_RATE_230400:
|
||||
config.baudrate = NRF_UARTE_BAUDRATE_230400;
|
||||
break;
|
||||
case BAUD_RATE_460800:
|
||||
config.baudrate = NRF_UARTE_BAUDRATE_460800;
|
||||
break;
|
||||
case BAUD_RATE_921600:
|
||||
config.baudrate = NRF_UARTE_BAUDRATE_921600;
|
||||
break;
|
||||
case BAUD_RATE_2000000:
|
||||
case BAUD_RATE_3000000:
|
||||
return -RT_EINVAL;
|
||||
default:
|
||||
config.baudrate = NRF_UARTE_BAUDRATE_115200;
|
||||
break;
|
||||
}
|
||||
config.hal_cfg.parity = (cfg->parity == PARITY_NONE)?\
|
||||
NRF_UARTE_PARITY_EXCLUDED:NRF_UARTE_PARITY_INCLUDED;
|
||||
config.hal_cfg.hwfc = NRF_UARTE_HWFC_DISABLED;
|
||||
config.pselrxd = p_cb->rx_pin;
|
||||
config.pseltxd = p_cb->tx_pin;
|
||||
config.p_context = (void *)p_cb;
|
||||
|
||||
nrfx_uarte_init(&(p_cb->uarte_instance),(nrfx_uarte_config_t const *)&config,uarte_evt_handler);
|
||||
nrfx_uarte_rx(&(p_cb->uarte_instance),p_cb->rx_buffer,1);
|
||||
p_cb->isInit = true;
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
static rt_err_t _uart_ctrl(struct rt_serial_device *serial, int cmd, void *arg)
|
||||
{
|
||||
drv_uart_cb_t *p_cb = RT_NULL;
|
||||
RT_ASSERT(serial != RT_NULL);
|
||||
|
||||
if (serial->parent.user_data == RT_NULL)
|
||||
{
|
||||
return -RT_ERROR;
|
||||
}
|
||||
p_cb = (drv_uart_cb_t*)serial->parent.user_data;
|
||||
|
||||
switch (cmd)
|
||||
{
|
||||
/* disable interrupt */
|
||||
case RT_DEVICE_CTRL_CLR_INT:
|
||||
break;
|
||||
|
||||
/* enable interrupt */
|
||||
case RT_DEVICE_CTRL_SET_INT:
|
||||
break;
|
||||
|
||||
case RT_DEVICE_CTRL_CUSTOM:
|
||||
if ((rt_uint32_t)(arg) == UART_CONFIG_BAUD_RATE_9600)
|
||||
{
|
||||
p_cb->serial->config.baud_rate = 9600;
|
||||
}
|
||||
else if ((rt_uint32_t)(arg) == UART_CONFIG_BAUD_RATE_115200)
|
||||
{
|
||||
p_cb->serial->config.baud_rate = 115200;
|
||||
}
|
||||
_uart_cfg(serial, &(serial->config));
|
||||
break;
|
||||
|
||||
case RT_DEVICE_CTRL_PIN:
|
||||
_uart_cfg(serial, &(serial->config));
|
||||
break;
|
||||
|
||||
case RT_DEVICE_POWERSAVE:
|
||||
if(p_cb->isInit)
|
||||
{
|
||||
nrfx_uarte_uninit(&(p_cb->uarte_instance));
|
||||
p_cb->isInit = false;
|
||||
}
|
||||
break;
|
||||
|
||||
case RT_DEVICE_WAKEUP:
|
||||
_uart_cfg(serial, &(serial->config));
|
||||
break;
|
||||
|
||||
default:
|
||||
return -RT_ERROR;
|
||||
}
|
||||
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
static int _uart_putc(struct rt_serial_device *serial, char c)
|
||||
{
|
||||
drv_uart_cb_t *p_cb = RT_NULL;
|
||||
int rtn = -1;
|
||||
RT_ASSERT(serial != RT_NULL);
|
||||
|
||||
if (serial->parent.user_data != RT_NULL)
|
||||
{
|
||||
p_cb = (drv_uart_cb_t*)serial->parent.user_data;
|
||||
}
|
||||
p_cb->tx_buffer[0] = c;
|
||||
nrfx_uarte_tx(&(p_cb->uarte_instance),p_cb->tx_buffer,1);
|
||||
if(!(serial->parent.open_flag&RT_DEVICE_FLAG_INT_TX))
|
||||
{
|
||||
while(nrfx_uarte_tx_in_progress(&(p_cb->uarte_instance)))
|
||||
{
|
||||
}
|
||||
}
|
||||
return rtn;
|
||||
}
|
||||
|
||||
static int _uart_getc(struct rt_serial_device *serial)
|
||||
{
|
||||
int ch = -1;
|
||||
drv_uart_cb_t *p_cb = RT_NULL;
|
||||
RT_ASSERT(serial != RT_NULL);
|
||||
|
||||
if (serial->parent.user_data != RT_NULL)
|
||||
{
|
||||
p_cb = (drv_uart_cb_t*)serial->parent.user_data;
|
||||
}
|
||||
if(p_cb->rx_length)
|
||||
{
|
||||
ch = p_cb->rx_buffer[0];
|
||||
p_cb->rx_length--;
|
||||
}
|
||||
return ch;
|
||||
}
|
||||
|
||||
static struct rt_uart_ops _uart_ops = {
|
||||
_uart_cfg,
|
||||
_uart_ctrl,
|
||||
_uart_putc,
|
||||
_uart_getc
|
||||
};
|
||||
|
||||
void rt_hw_uart_init(void)
|
||||
{
|
||||
struct serial_configure config = RT_SERIAL_CONFIG_DEFAULT;
|
||||
|
||||
#ifdef BSP_USING_UART0
|
||||
m_serial_0.config = config;
|
||||
m_serial_0.ops = &_uart_ops;
|
||||
m_uarte0_cb.serial = &m_serial_0;
|
||||
rt_hw_serial_register(&m_serial_0, "uart0", \
|
||||
RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX , &m_uarte0_cb);
|
||||
#endif /* BSP_USING_UART0 */
|
||||
|
||||
#ifdef BSP_USING_UART1
|
||||
m_serial_1.config = config;
|
||||
m_serial_1.ops = &_uart_ops;
|
||||
m_uarte1_cb.serial = &m_serial_1;
|
||||
rt_hw_serial_register(&m_serial_1, "uart1", \
|
||||
RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX |RT_DEVICE_FLAG_INT_TX, &m_uarte1_cb);
|
||||
#endif /* BSP_USING_UART1 */
|
||||
|
||||
}
|
||||
#endif /* defined(BSP_USING_UART0) || defined(BSP_USING_UART1) */
|
||||
#endif /* BSP_USING_UART */
|
33
bsp/nrf5x/libraries/drivers/drv_uarte.h
Normal file
33
bsp/nrf5x/libraries/drivers/drv_uarte.h
Normal file
@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2020, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2020-04-28 xckhmf Modify for <nrfx>
|
||||
* 2020-10-31 xckhmf Support for UART1
|
||||
*
|
||||
*/
|
||||
#ifndef __DRV_UART_H__
|
||||
#define __DRV_UART_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define RT_DEVICE_CTRL_CUSTOM 0x20
|
||||
#define RT_DEVICE_CTRL_PIN 0x21
|
||||
#define RT_DEVICE_POWERSAVE 0x22
|
||||
#define RT_DEVICE_WAKEUP 0x23
|
||||
|
||||
#define UART_CONFIG_BAUD_RATE_9600 1
|
||||
#define UART_CONFIG_BAUD_RATE_115200 2
|
||||
|
||||
void rt_hw_uart_init(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __DRV_UART_H__ */
|
@ -120,6 +120,7 @@ CONFIG_RT_SERIAL_RB_BUFSZ=64
|
||||
# CONFIG_RT_USING_HWTIMER is not set
|
||||
# CONFIG_RT_USING_CPUTIME is not set
|
||||
# CONFIG_RT_USING_I2C is not set
|
||||
# CONFIG_RT_USING_PHY is not set
|
||||
CONFIG_RT_USING_PIN=y
|
||||
# CONFIG_RT_USING_ADC is not set
|
||||
# CONFIG_RT_USING_DAC is not set
|
||||
@ -195,15 +196,12 @@ CONFIG_RT_USING_LIBC=y
|
||||
#
|
||||
# IoT - internet of things
|
||||
#
|
||||
# CONFIG_PKG_USING_LORAWAN_DRIVER is not set
|
||||
# CONFIG_PKG_USING_PAHOMQTT is not set
|
||||
# CONFIG_PKG_USING_UMQTT is not set
|
||||
# CONFIG_PKG_USING_WEBCLIENT is not set
|
||||
# CONFIG_PKG_USING_WEBNET is not set
|
||||
# CONFIG_PKG_USING_MONGOOSE is not set
|
||||
# CONFIG_PKG_USING_MYMQTT is not set
|
||||
# CONFIG_PKG_USING_KAWAII_MQTT is not set
|
||||
# CONFIG_PKG_USING_BC28_MQTT is not set
|
||||
# CONFIG_PKG_USING_WEBTERMINAL is not set
|
||||
# CONFIG_PKG_USING_CJSON is not set
|
||||
# CONFIG_PKG_USING_JSMN is not set
|
||||
@ -230,7 +228,6 @@ CONFIG_RT_USING_LIBC=y
|
||||
# CONFIG_PKG_USING_COAP is not set
|
||||
# CONFIG_PKG_USING_NOPOLL is not set
|
||||
# CONFIG_PKG_USING_NETUTILS is not set
|
||||
# CONFIG_PKG_USING_CMUX is not set
|
||||
# CONFIG_PKG_USING_PPP_DEVICE is not set
|
||||
# CONFIG_PKG_USING_AT_DEVICE is not set
|
||||
# CONFIG_PKG_USING_ATSRV_SOCKET is not set
|
||||
@ -243,7 +240,7 @@ CONFIG_RT_USING_LIBC=y
|
||||
# CONFIG_PKG_USING_GAGENT_CLOUD is not set
|
||||
# CONFIG_PKG_USING_ALI_IOTKIT is not set
|
||||
# CONFIG_PKG_USING_AZURE is not set
|
||||
# CONFIG_PKG_USING_TENCENT_IOT_EXPLORER is not set
|
||||
# CONFIG_PKG_USING_TENCENT_IOTHUB is not set
|
||||
# CONFIG_PKG_USING_JIOT-C-SDK is not set
|
||||
# CONFIG_PKG_USING_UCLOUD_IOT_SDK is not set
|
||||
# CONFIG_PKG_USING_JOYLINK is not set
|
||||
@ -265,7 +262,6 @@ CONFIG_RT_USING_LIBC=y
|
||||
# CONFIG_PKG_USING_CAPNP is not set
|
||||
# CONFIG_PKG_USING_RT_CJSON_TOOLS is not set
|
||||
# CONFIG_PKG_USING_AGILE_TELNET is not set
|
||||
# CONFIG_PKG_USING_NMEALIB is not set
|
||||
|
||||
#
|
||||
# security packages
|
||||
@ -274,7 +270,6 @@ CONFIG_RT_USING_LIBC=y
|
||||
# CONFIG_PKG_USING_libsodium is not set
|
||||
# CONFIG_PKG_USING_TINYCRYPT is not set
|
||||
# CONFIG_PKG_USING_TFM is not set
|
||||
# CONFIG_PKG_USING_YD_CRYPTO is not set
|
||||
|
||||
#
|
||||
# language packages
|
||||
@ -309,8 +304,6 @@ CONFIG_RT_USING_LIBC=y
|
||||
# CONFIG_PKG_USING_CHINESE_FONT_LIBRARY is not set
|
||||
# CONFIG_PKG_USING_LUNAR_CALENDAR is not set
|
||||
# CONFIG_PKG_USING_BS8116A is not set
|
||||
# CONFIG_PKG_USING_GPS_RMC is not set
|
||||
# CONFIG_PKG_USING_URLENCODE is not set
|
||||
|
||||
#
|
||||
# system packages
|
||||
@ -321,7 +314,6 @@ CONFIG_RT_USING_LIBC=y
|
||||
# CONFIG_PKG_USING_LWEXT4 is not set
|
||||
# CONFIG_PKG_USING_PARTITION is not set
|
||||
# CONFIG_PKG_USING_FAL is not set
|
||||
# CONFIG_PKG_USING_FLASHDB is not set
|
||||
# CONFIG_PKG_USING_SQLITE is not set
|
||||
# CONFIG_PKG_USING_RTI is not set
|
||||
# CONFIG_PKG_USING_LITTLEVGL2RTT is not set
|
||||
@ -334,9 +326,6 @@ CONFIG_RT_USING_LIBC=y
|
||||
# CONFIG_PKG_USING_SYSWATCH is not set
|
||||
# CONFIG_PKG_USING_SYS_LOAD_MONITOR is not set
|
||||
# CONFIG_PKG_USING_PLCCORE is not set
|
||||
# CONFIG_PKG_USING_RAMDISK is not set
|
||||
# CONFIG_PKG_USING_MININI is not set
|
||||
# CONFIG_PKG_USING_QBOOT is not set
|
||||
|
||||
#
|
||||
# peripheral libraries and drivers
|
||||
@ -378,7 +367,6 @@ CONFIG_PKG_NRFX_VER="v2.1.0"
|
||||
# CONFIG_PKG_USING_RPLIDAR is not set
|
||||
# CONFIG_PKG_USING_AS608 is not set
|
||||
# CONFIG_PKG_USING_RC522 is not set
|
||||
# CONFIG_PKG_USING_WS2812B is not set
|
||||
# CONFIG_PKG_USING_EMBARC_BSP is not set
|
||||
# CONFIG_PKG_USING_EXTERN_RTC_DRIVERS is not set
|
||||
# CONFIG_PKG_USING_MULTI_RTIMER is not set
|
||||
@ -386,11 +374,6 @@ CONFIG_PKG_NRFX_VER="v2.1.0"
|
||||
# CONFIG_PKG_USING_BEEP is not set
|
||||
# CONFIG_PKG_USING_EASYBLINK is not set
|
||||
# CONFIG_PKG_USING_PMS_SERIES is not set
|
||||
# CONFIG_PKG_USING_CAN_YMODEM is not set
|
||||
# CONFIG_PKG_USING_LORA_RADIO_DRIVER is not set
|
||||
# CONFIG_PKG_USING_QLED is not set
|
||||
# CONFIG_PKG_USING_PAJ7620 is not set
|
||||
# CONFIG_PKG_USING_AGILE_CONSOLE is not set
|
||||
|
||||
#
|
||||
# miscellaneous packages
|
||||
@ -427,31 +410,36 @@ CONFIG_PKG_NRFX_VER="v2.1.0"
|
||||
# CONFIG_PKG_USING_VT100 is not set
|
||||
# CONFIG_PKG_USING_ULAPACK is not set
|
||||
# CONFIG_PKG_USING_UKAL is not set
|
||||
# CONFIG_PKG_USING_CRCLIB is not set
|
||||
|
||||
#
|
||||
# Hardware Drivers Config
|
||||
#
|
||||
CONFIG_SOC_NRF52832=y
|
||||
CONFIG_NRFX_CLOCK_ENABLED=1
|
||||
CONFIG_NRFX_CLOCK_DEFAULT_CONFIG_IRQ_PRIORITY=7
|
||||
CONFIG_NRFX_CLOCK_CONFIG_LF_SRC=1
|
||||
CONFIG_SOC_NORDIC=y
|
||||
|
||||
#
|
||||
# Onboard Peripheral Drivers
|
||||
#
|
||||
# CONFIG_BSP_USING_JLINK_TO_USART is not set
|
||||
# CONFIG_BSP_USING_QSPI_FLASH is not set
|
||||
|
||||
#
|
||||
# On-chip Peripheral Drivers
|
||||
#
|
||||
CONFIG_BSP_USING_GPIO=y
|
||||
CONFIG_NRFX_GPIOTE_ENABLED=1
|
||||
# CONFIG_BSP_USING_SAADC is not set
|
||||
# CONFIG_BSP_USING_PWM is not set
|
||||
# CONFIG_BSP_USING_SOFTDEVICE is not set
|
||||
CONFIG_BSP_USING_UART=y
|
||||
CONFIG_NRFX_USING_UART=y
|
||||
# CONFIG_NRFX_USING_UARTE is not set
|
||||
CONFIG_NRFX_UART_ENABLED=1
|
||||
CONFIG_BSP_USING_UART0=y
|
||||
CONFIG_NRFX_UART0_ENABLED=1
|
||||
CONFIG_BSP_UART0_RX_PIN=8
|
||||
CONFIG_BSP_UART0_TX_PIN=6
|
||||
# CONFIG_BSP_USING_UART1 is not set
|
||||
# CONFIG_BSP_USING_SPI is not set
|
||||
# CONFIG_BSP_USING_ON_CHIP_FLASH is not set
|
||||
|
||||
@ -463,3 +451,8 @@ CONFIG_MCU_FLASH_SIZE_KB=1024
|
||||
CONFIG_MCU_SRAM_START_ADDRESS=0x20000000
|
||||
CONFIG_MCU_SRAM_SIZE_KB=256
|
||||
CONFIG_MCU_FLASH_PAGE_SIZE=0x1000
|
||||
# CONFIG_BSP_USING_WDT is not set
|
||||
# CONFIG_BSP_USING_ONCHIP_RTC is not set
|
||||
CONFIG_BLE_STACK_USING_NULL=y
|
||||
# CONFIG_BSP_USING_SOFTDEVICE is not set
|
||||
# CONFIG_BSP_USING_NIMBLE is not set
|
||||
|
@ -157,12 +157,24 @@ menu "On-chip Peripheral Drivers"
|
||||
endif
|
||||
|
||||
|
||||
menuconfig BSP_USING_UART
|
||||
bool "Enable UART"
|
||||
config BSP_USING_UART
|
||||
bool "Enable UART"
|
||||
default y
|
||||
select RT_USING_SERIAL
|
||||
|
||||
if BSP_USING_UART
|
||||
if BSP_USING_UART
|
||||
choice
|
||||
prompt "UART or UARTE"
|
||||
default NRFX_USING_UART
|
||||
help
|
||||
Select the UART or UARTE
|
||||
config NRFX_USING_UART
|
||||
bool "UART"
|
||||
|
||||
config NRFX_USING_UARTE
|
||||
bool "UARTE"
|
||||
endchoice
|
||||
endif
|
||||
if BSP_USING_UART&&NRFX_USING_UART
|
||||
config NRFX_UART_ENABLED
|
||||
int
|
||||
default 1
|
||||
@ -183,9 +195,28 @@ menu "On-chip Peripheral Drivers"
|
||||
range 0 31
|
||||
default 6
|
||||
endif
|
||||
config BSP_USING_UART1
|
||||
bool "Enable UART1"
|
||||
default n
|
||||
endif
|
||||
if BSP_USING_UART&&NRFX_USING_UARTE
|
||||
config NRFX_UARTE_ENABLED
|
||||
int
|
||||
default 1
|
||||
|
||||
config BSP_USING_UART0
|
||||
bool "Enable UARTE0"
|
||||
default n
|
||||
if BSP_USING_UART0
|
||||
config NRFX_UARTE0_ENABLED
|
||||
int
|
||||
default 1
|
||||
config BSP_UART0_RX_PIN
|
||||
int "uarte0 rx pin number"
|
||||
range 0 31
|
||||
default 8
|
||||
config BSP_UART0_TX_PIN
|
||||
int "uarte0 tx pin number"
|
||||
range 0 31
|
||||
default 6
|
||||
endif
|
||||
endif
|
||||
|
||||
config BSP_USING_SPI
|
||||
|
@ -152,6 +152,9 @@
|
||||
/* Hardware Drivers Config */
|
||||
|
||||
#define SOC_NRF52832
|
||||
#define NRFX_CLOCK_ENABLED 1
|
||||
#define NRFX_CLOCK_DEFAULT_CONFIG_IRQ_PRIORITY 7
|
||||
#define NRFX_CLOCK_CONFIG_LF_SRC 1
|
||||
#define SOC_NORDIC
|
||||
|
||||
/* Onboard Peripheral Drivers */
|
||||
@ -160,8 +163,12 @@
|
||||
/* On-chip Peripheral Drivers */
|
||||
|
||||
#define BSP_USING_GPIO
|
||||
#define NRFX_GPIOTE_ENABLED 1
|
||||
#define BSP_USING_UART
|
||||
#define NRFX_USING_UART
|
||||
#define NRFX_UART_ENABLED 1
|
||||
#define BSP_USING_UART0
|
||||
#define NRFX_UART0_ENABLED 1
|
||||
#define BSP_UART0_RX_PIN 8
|
||||
#define BSP_UART0_TX_PIN 6
|
||||
|
||||
@ -172,5 +179,6 @@
|
||||
#define MCU_SRAM_START_ADDRESS 0x20000000
|
||||
#define MCU_SRAM_SIZE_KB 256
|
||||
#define MCU_FLASH_PAGE_SIZE 0x1000
|
||||
#define BLE_STACK_USING_NULL
|
||||
|
||||
#endif
|
||||
|
@ -65,7 +65,7 @@ CONFIG_RT_USING_DEVICE=y
|
||||
# CONFIG_RT_USING_INTERRUPT_INFO is not set
|
||||
CONFIG_RT_USING_CONSOLE=y
|
||||
CONFIG_RT_CONSOLEBUF_SIZE=128
|
||||
CONFIG_RT_CONSOLE_DEVICE_NAME="uart0"
|
||||
CONFIG_RT_CONSOLE_DEVICE_NAME="uart1"
|
||||
CONFIG_RT_VER_NUM=0x40003
|
||||
# CONFIG_RT_USING_CPU_FFS is not set
|
||||
# CONFIG_ARCH_CPU_STACK_GROWS_UPWARD is not set
|
||||
@ -120,6 +120,7 @@ CONFIG_RT_SERIAL_RB_BUFSZ=64
|
||||
# CONFIG_RT_USING_HWTIMER is not set
|
||||
# CONFIG_RT_USING_CPUTIME is not set
|
||||
# CONFIG_RT_USING_I2C is not set
|
||||
# CONFIG_RT_USING_PHY is not set
|
||||
CONFIG_RT_USING_PIN=y
|
||||
# CONFIG_RT_USING_ADC is not set
|
||||
# CONFIG_RT_USING_DAC is not set
|
||||
@ -195,15 +196,12 @@ CONFIG_RT_USING_LIBC=y
|
||||
#
|
||||
# IoT - internet of things
|
||||
#
|
||||
# CONFIG_PKG_USING_LORAWAN_DRIVER is not set
|
||||
# CONFIG_PKG_USING_PAHOMQTT is not set
|
||||
# CONFIG_PKG_USING_UMQTT is not set
|
||||
# CONFIG_PKG_USING_WEBCLIENT is not set
|
||||
# CONFIG_PKG_USING_WEBNET is not set
|
||||
# CONFIG_PKG_USING_MONGOOSE is not set
|
||||
# CONFIG_PKG_USING_MYMQTT is not set
|
||||
# CONFIG_PKG_USING_KAWAII_MQTT is not set
|
||||
# CONFIG_PKG_USING_BC28_MQTT is not set
|
||||
# CONFIG_PKG_USING_WEBTERMINAL is not set
|
||||
# CONFIG_PKG_USING_CJSON is not set
|
||||
# CONFIG_PKG_USING_JSMN is not set
|
||||
@ -230,7 +228,6 @@ CONFIG_RT_USING_LIBC=y
|
||||
# CONFIG_PKG_USING_COAP is not set
|
||||
# CONFIG_PKG_USING_NOPOLL is not set
|
||||
# CONFIG_PKG_USING_NETUTILS is not set
|
||||
# CONFIG_PKG_USING_CMUX is not set
|
||||
# CONFIG_PKG_USING_PPP_DEVICE is not set
|
||||
# CONFIG_PKG_USING_AT_DEVICE is not set
|
||||
# CONFIG_PKG_USING_ATSRV_SOCKET is not set
|
||||
@ -243,7 +240,7 @@ CONFIG_RT_USING_LIBC=y
|
||||
# CONFIG_PKG_USING_GAGENT_CLOUD is not set
|
||||
# CONFIG_PKG_USING_ALI_IOTKIT is not set
|
||||
# CONFIG_PKG_USING_AZURE is not set
|
||||
# CONFIG_PKG_USING_TENCENT_IOT_EXPLORER is not set
|
||||
# CONFIG_PKG_USING_TENCENT_IOTHUB is not set
|
||||
# CONFIG_PKG_USING_JIOT-C-SDK is not set
|
||||
# CONFIG_PKG_USING_UCLOUD_IOT_SDK is not set
|
||||
# CONFIG_PKG_USING_JOYLINK is not set
|
||||
@ -273,7 +270,6 @@ CONFIG_RT_USING_LIBC=y
|
||||
# CONFIG_PKG_USING_libsodium is not set
|
||||
# CONFIG_PKG_USING_TINYCRYPT is not set
|
||||
# CONFIG_PKG_USING_TFM is not set
|
||||
# CONFIG_PKG_USING_YD_CRYPTO is not set
|
||||
|
||||
#
|
||||
# language packages
|
||||
@ -308,7 +304,6 @@ CONFIG_RT_USING_LIBC=y
|
||||
# CONFIG_PKG_USING_CHINESE_FONT_LIBRARY is not set
|
||||
# CONFIG_PKG_USING_LUNAR_CALENDAR is not set
|
||||
# CONFIG_PKG_USING_BS8116A is not set
|
||||
# CONFIG_PKG_USING_URLENCODE is not set
|
||||
|
||||
#
|
||||
# system packages
|
||||
@ -319,7 +314,6 @@ CONFIG_RT_USING_LIBC=y
|
||||
# CONFIG_PKG_USING_LWEXT4 is not set
|
||||
# CONFIG_PKG_USING_PARTITION is not set
|
||||
# CONFIG_PKG_USING_FAL is not set
|
||||
# CONFIG_PKG_USING_FLASHDB is not set
|
||||
# CONFIG_PKG_USING_SQLITE is not set
|
||||
# CONFIG_PKG_USING_RTI is not set
|
||||
# CONFIG_PKG_USING_LITTLEVGL2RTT is not set
|
||||
@ -332,8 +326,6 @@ CONFIG_RT_USING_LIBC=y
|
||||
# CONFIG_PKG_USING_SYSWATCH is not set
|
||||
# CONFIG_PKG_USING_SYS_LOAD_MONITOR is not set
|
||||
# CONFIG_PKG_USING_PLCCORE is not set
|
||||
# CONFIG_PKG_USING_RAMDISK is not set
|
||||
# CONFIG_PKG_USING_MININI is not set
|
||||
|
||||
#
|
||||
# peripheral libraries and drivers
|
||||
@ -353,8 +345,6 @@ CONFIG_RT_USING_LIBC=y
|
||||
# CONFIG_PKG_USING_LITTLED is not set
|
||||
# CONFIG_PKG_USING_LKDGUI is not set
|
||||
# CONFIG_PKG_USING_NRF5X_SDK is not set
|
||||
# CONFIG_PKG_USING_NRF5X_SDK_V1300 is not set
|
||||
# CONFIG_PKG_USING_NRF5X_SDK_LATEST_VERSION is not set
|
||||
CONFIG_PKG_USING_NRFX=y
|
||||
CONFIG_PKG_NRFX_PATH="/packages/peripherals/nrfx"
|
||||
CONFIG_PKG_USING_NRFX_V210=y
|
||||
@ -384,10 +374,6 @@ CONFIG_PKG_NRFX_VER="v2.1.0"
|
||||
# CONFIG_PKG_USING_BEEP is not set
|
||||
# CONFIG_PKG_USING_EASYBLINK is not set
|
||||
# CONFIG_PKG_USING_PMS_SERIES is not set
|
||||
# CONFIG_PKG_USING_CAN_YMODEM is not set
|
||||
# CONFIG_PKG_USING_LORA_RADIO_DRIVER is not set
|
||||
# CONFIG_PKG_USING_QLED is not set
|
||||
# CONFIG_PKG_USING_PAJ7620 is not set
|
||||
|
||||
#
|
||||
# miscellaneous packages
|
||||
@ -429,6 +415,10 @@ CONFIG_PKG_NRFX_VER="v2.1.0"
|
||||
# Hardware Drivers Config
|
||||
#
|
||||
CONFIG_SOC_NRF52840=y
|
||||
CONFIG_NRFX_CLOCK_ENABLED=1
|
||||
CONFIG_NRFX_CLOCK_DEFAULT_CONFIG_IRQ_PRIORITY=7
|
||||
CONFIG_NRFX_CLOCK_CONFIG_LF_SRC=1
|
||||
CONFIG_SOC_NORDIC=y
|
||||
|
||||
#
|
||||
# Onboard Peripheral Drivers
|
||||
@ -440,12 +430,17 @@ CONFIG_SOC_NRF52840=y
|
||||
# On-chip Peripheral Drivers
|
||||
#
|
||||
CONFIG_BSP_USING_GPIO=y
|
||||
# CONFIG_BSP_USING_SOFTDEVICE is not set
|
||||
CONFIG_NRFX_GPIOTE_ENABLED=1
|
||||
# CONFIG_BSP_USING_SAADC is not set
|
||||
# CONFIG_BSP_USING_PWM is not set
|
||||
CONFIG_BSP_USING_UART=y
|
||||
CONFIG_NRFX_USING_UART=y
|
||||
# CONFIG_NRFX_USING_UARTE is not set
|
||||
CONFIG_NRFX_UART_ENABLED=1
|
||||
CONFIG_BSP_USING_UART0=y
|
||||
CONFIG_NRFX_UART0_ENABLED=1
|
||||
CONFIG_BSP_UART0_RX_PIN=8
|
||||
CONFIG_BSP_UART0_TX_PIN=6
|
||||
# CONFIG_BSP_USING_UART1 is not set
|
||||
# CONFIG_BSP_USING_SPI is not set
|
||||
# CONFIG_BSP_USING_ON_CHIP_FLASH is not set
|
||||
|
||||
@ -457,3 +452,8 @@ CONFIG_MCU_FLASH_SIZE_KB=1024
|
||||
CONFIG_MCU_SRAM_START_ADDRESS=0x20000000
|
||||
CONFIG_MCU_SRAM_SIZE_KB=256
|
||||
CONFIG_MCU_FLASH_PAGE_SIZE=0x1000
|
||||
# CONFIG_BSP_USING_WDT is not set
|
||||
# CONFIG_BSP_USING_ONCHIP_RTC is not set
|
||||
CONFIG_BLE_STACK_USING_NULL=y
|
||||
# CONFIG_BSP_USING_SOFTDEVICE is not set
|
||||
# CONFIG_BSP_USING_NIMBLE is not set
|
||||
|
@ -194,12 +194,24 @@ menu "On-chip Peripheral Drivers"
|
||||
endif
|
||||
|
||||
|
||||
menuconfig BSP_USING_UART
|
||||
bool "Enable UART"
|
||||
config BSP_USING_UART
|
||||
bool "Enable UART"
|
||||
default y
|
||||
select RT_USING_SERIAL
|
||||
|
||||
if BSP_USING_UART
|
||||
if BSP_USING_UART
|
||||
choice
|
||||
prompt "UART or UARTE"
|
||||
default NRFX_USING_UART
|
||||
help
|
||||
Select the UART or UARTE
|
||||
config NRFX_USING_UART
|
||||
bool "UART"
|
||||
|
||||
config NRFX_USING_UARTE
|
||||
bool "UARTE"
|
||||
endchoice
|
||||
endif
|
||||
if BSP_USING_UART&&NRFX_USING_UART
|
||||
config NRFX_UART_ENABLED
|
||||
int
|
||||
default 1
|
||||
@ -220,9 +232,44 @@ menu "On-chip Peripheral Drivers"
|
||||
range 0 31
|
||||
default 6
|
||||
endif
|
||||
endif
|
||||
if BSP_USING_UART&&NRFX_USING_UARTE
|
||||
config NRFX_UARTE_ENABLED
|
||||
int
|
||||
default 1
|
||||
|
||||
config BSP_USING_UART0
|
||||
bool "Enable UARTE0"
|
||||
default n
|
||||
if BSP_USING_UART0
|
||||
config NRFX_UARTE0_ENABLED
|
||||
int
|
||||
default 1
|
||||
config BSP_UART0_RX_PIN
|
||||
int "uarte0 rx pin number"
|
||||
range 0 31
|
||||
default 8
|
||||
config BSP_UART0_TX_PIN
|
||||
int "uarte0 tx pin number"
|
||||
range 0 31
|
||||
default 6
|
||||
endif
|
||||
config BSP_USING_UART1
|
||||
bool "Enable UART1"
|
||||
default n
|
||||
bool "Enable UARTE1"
|
||||
default n
|
||||
if BSP_USING_UART1
|
||||
config NRFX_UARTE1_ENABLED
|
||||
int
|
||||
default 1
|
||||
config BSP_UART1_RX_PIN
|
||||
int "uarte1 rx pin number"
|
||||
range 0 31
|
||||
default 7
|
||||
config BSP_UART1_TX_PIN
|
||||
int "uarte1 tx pin number"
|
||||
range 0 31
|
||||
default 5
|
||||
endif
|
||||
endif
|
||||
|
||||
config BSP_USING_SPI
|
||||
|
@ -152,6 +152,10 @@
|
||||
/* Hardware Drivers Config */
|
||||
|
||||
#define SOC_NRF52840
|
||||
#define NRFX_CLOCK_ENABLED 1
|
||||
#define NRFX_CLOCK_DEFAULT_CONFIG_IRQ_PRIORITY 7
|
||||
#define NRFX_CLOCK_CONFIG_LF_SRC 1
|
||||
#define SOC_NORDIC
|
||||
|
||||
/* Onboard Peripheral Drivers */
|
||||
|
||||
@ -159,8 +163,12 @@
|
||||
/* On-chip Peripheral Drivers */
|
||||
|
||||
#define BSP_USING_GPIO
|
||||
#define NRFX_GPIOTE_ENABLED 1
|
||||
#define BSP_USING_UART
|
||||
#define NRFX_USING_UART
|
||||
#define NRFX_UART_ENABLED 1
|
||||
#define BSP_USING_UART0
|
||||
#define NRFX_UART0_ENABLED 1
|
||||
#define BSP_UART0_RX_PIN 8
|
||||
#define BSP_UART0_TX_PIN 6
|
||||
|
||||
@ -171,5 +179,6 @@
|
||||
#define MCU_SRAM_START_ADDRESS 0x20000000
|
||||
#define MCU_SRAM_SIZE_KB 256
|
||||
#define MCU_FLASH_PAGE_SIZE 0x1000
|
||||
#define BLE_STACK_USING_NULL
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user