summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLi-Dongze <[email protected]>2024-10-26 14:59:30 +0800
committerGitHub <[email protected]>2024-10-26 14:59:30 +0800
commit948c8a4901881346ff8516d56d3572c661cc3d92 (patch)
tree65334be46ea025b84c7b6d5ee13af3ab5f22e19d
parent6b7f1177deeae01a7092c22a89cd41e7b318f01c (diff)
[BSP]添加nrf52840的.ci文件,修复因rt_hw_pin_init引起的finsh警告,修复rtc编译报错 (#9583)
添加nrf52840的.ci文件,修复因rt_hw_pin_init引起的finsh警告,修复rtc编译报错
-rw-r--r--bsp/nrf5x/libraries/drivers/drv_gpio.c2
-rw-r--r--bsp/nrf5x/libraries/drivers/drv_gpio.h2
-rw-r--r--bsp/nrf5x/libraries/drivers/drv_rtc.c74
-rw-r--r--bsp/nrf5x/nrf52840/.ci/attachconfig/devices/adc.attach1
-rw-r--r--bsp/nrf5x/nrf52840/.ci/attachconfig/devices/flash.attach1
-rw-r--r--bsp/nrf5x/nrf52840/.ci/attachconfig/devices/gpio.attach1
-rw-r--r--bsp/nrf5x/nrf52840/.ci/attachconfig/devices/hwtimer.attach2
-rw-r--r--bsp/nrf5x/nrf52840/.ci/attachconfig/devices/i2c.attach1
-rw-r--r--bsp/nrf5x/nrf52840/.ci/attachconfig/devices/pwm.attach1
-rw-r--r--bsp/nrf5x/nrf52840/.ci/attachconfig/devices/qspi_flash.attach1
-rw-r--r--bsp/nrf5x/nrf52840/.ci/attachconfig/devices/rtc.attach1
-rw-r--r--bsp/nrf5x/nrf52840/.ci/attachconfig/devices/spi.attach1
-rw-r--r--bsp/nrf5x/nrf52840/.ci/attachconfig/devices/uart.attach1
-rw-r--r--bsp/nrf5x/nrf52840/.ci/attachconfig/devices/wdt.attach1
14 files changed, 18 insertions, 72 deletions
diff --git a/bsp/nrf5x/libraries/drivers/drv_gpio.c b/bsp/nrf5x/libraries/drivers/drv_gpio.c
index 56297eb785..88385b561f 100644
--- a/bsp/nrf5x/libraries/drivers/drv_gpio.c
+++ b/bsp/nrf5x/libraries/drivers/drv_gpio.c
@@ -356,7 +356,7 @@ const static struct rt_pin_ops _nrf5x_pin_ops =
RT_NULL,
};
-rt_err_t rt_hw_pin_init(void)
+int rt_hw_pin_init(void)
{
nrfx_err_t err_code;
diff --git a/bsp/nrf5x/libraries/drivers/drv_gpio.h b/bsp/nrf5x/libraries/drivers/drv_gpio.h
index 3e4b63c453..0341ad097e 100644
--- a/bsp/nrf5x/libraries/drivers/drv_gpio.h
+++ b/bsp/nrf5x/libraries/drivers/drv_gpio.h
@@ -38,7 +38,7 @@ struct pin_index
rt_base_t pin;
};
-rt_err_t rt_hw_pin_init(void);
+int rt_hw_pin_init(void);
#endif /* __DRV_GPIO_H__ */
diff --git a/bsp/nrf5x/libraries/drivers/drv_rtc.c b/bsp/nrf5x/libraries/drivers/drv_rtc.c
index a06bb934b9..357f2e1611 100644
--- a/bsp/nrf5x/libraries/drivers/drv_rtc.c
+++ b/bsp/nrf5x/libraries/drivers/drv_rtc.c
@@ -35,7 +35,7 @@
#define TICK_FREQUENCE_HZ (RT_TICK_PER_SECOND) // RTC tick frequence, in HZ
-static struct rt_device rtc;
+static struct rt_rtc_device rtc;
static time_t init_time;
static uint32_t tick = 0;
@@ -112,79 +112,13 @@ const static struct rt_device_ops rtc_ops =
};
#endif
-#if defined(SOC_NRF5340)
-static rt_err_t rt_hw_rtc_register_5340(rt_device_t device, const char *name, rt_uint32_t flag)
-{
- struct tm time_new = ONCHIP_RTC_TIME_DEFAULT;
-
- RT_ASSERT(device != RT_NULL);
-
- init_time = timegm(&time_new);
- if (rt_rtc_config(device) != RT_EOK)
- {
- return -RT_ERROR;
- }
-#ifdef RT_USING_DEVICE_OPS
- device->ops = &rtc_ops;
-#else
- device->init = RT_NULL;
- device->open = RT_NULL;
- device->close = RT_NULL;
- device->read = RT_NULL;
- device->write = RT_NULL;
- device->control = rt_rtc_control;
-#endif
- device->type = RT_Device_Class_RTC;
- device->rx_indicate = RT_NULL;
- device->tx_complete = RT_NULL;
- device->user_data = RT_NULL;
-
- /* register a character device */
- rt_device_register(device, name, flag);
-
- return RT_EOK;
-}
-#else
-static rt_err_t rt_hw_rtc_register(rt_device_t device, const char *name, rt_uint32_t flag)
-{
- struct tm time_new = ONCHIP_RTC_TIME_DEFAULT;
-
- RT_ASSERT(device != RT_NULL);
- init_time = timegm(&time_new);
- if (rt_rtc_config(device) != RT_EOK)
- {
- return -RT_ERROR;
- }
-#ifdef RT_USING_DEVICE_OPS
- device->ops = &rtc_ops;
-#else
- device->init = RT_NULL;
- device->open = RT_NULL;
- device->close = RT_NULL;
- device->read = RT_NULL;
- device->write = RT_NULL;
- device->control = rt_rtc_control;
-#endif
- device->type = RT_Device_Class_RTC;
- device->rx_indicate = RT_NULL;
- device->tx_complete = RT_NULL;
- device->user_data = RT_NULL;
-
- /* register a character device */
- rt_device_register(device, name, flag);
-
- return RT_EOK;
-}
-#endif
int rt_hw_rtc_init(void)
{
rt_err_t result;
-#if defined(SOC_NRF5340)
- result = rt_hw_rtc_register_5340(&rtc, "rtc", RT_DEVICE_FLAG_RDWR);
-#else
- result = rt_hw_rtc_register(&rtc, "rtc", RT_DEVICE_FLAG_RDWR);
-#endif
+
+ result = rt_hw_rtc_register(&rtc, "rtc", RT_DEVICE_FLAG_RDWR,RT_NULL);
+
if (result != RT_EOK)
{
LOG_E("rtc register err code: %d", result);
diff --git a/bsp/nrf5x/nrf52840/.ci/attachconfig/devices/adc.attach b/bsp/nrf5x/nrf52840/.ci/attachconfig/devices/adc.attach
new file mode 100644
index 0000000000..fb17a1d885
--- /dev/null
+++ b/bsp/nrf5x/nrf52840/.ci/attachconfig/devices/adc.attach
@@ -0,0 +1 @@
+CONFIG_BSP_USING_SAADC=y \ No newline at end of file
diff --git a/bsp/nrf5x/nrf52840/.ci/attachconfig/devices/flash.attach b/bsp/nrf5x/nrf52840/.ci/attachconfig/devices/flash.attach
new file mode 100644
index 0000000000..5c49eb48fc
--- /dev/null
+++ b/bsp/nrf5x/nrf52840/.ci/attachconfig/devices/flash.attach
@@ -0,0 +1 @@
+CONFIG_BSP_USING_ON_CHIP_FLASH=y \ No newline at end of file
diff --git a/bsp/nrf5x/nrf52840/.ci/attachconfig/devices/gpio.attach b/bsp/nrf5x/nrf52840/.ci/attachconfig/devices/gpio.attach
new file mode 100644
index 0000000000..7b3294cc6f
--- /dev/null
+++ b/bsp/nrf5x/nrf52840/.ci/attachconfig/devices/gpio.attach
@@ -0,0 +1 @@
+CONFIG_BSP_USING_GPIO=y \ No newline at end of file
diff --git a/bsp/nrf5x/nrf52840/.ci/attachconfig/devices/hwtimer.attach b/bsp/nrf5x/nrf52840/.ci/attachconfig/devices/hwtimer.attach
new file mode 100644
index 0000000000..40b09d6155
--- /dev/null
+++ b/bsp/nrf5x/nrf52840/.ci/attachconfig/devices/hwtimer.attach
@@ -0,0 +1,2 @@
+CONFIG_BSP_USING_TIM=y
+CONFIG_BSP_USING_TIM0=y \ No newline at end of file
diff --git a/bsp/nrf5x/nrf52840/.ci/attachconfig/devices/i2c.attach b/bsp/nrf5x/nrf52840/.ci/attachconfig/devices/i2c.attach
new file mode 100644
index 0000000000..e7bf5c0635
--- /dev/null
+++ b/bsp/nrf5x/nrf52840/.ci/attachconfig/devices/i2c.attach
@@ -0,0 +1 @@
+CONFIG_BSP_USING_I2C=y \ No newline at end of file
diff --git a/bsp/nrf5x/nrf52840/.ci/attachconfig/devices/pwm.attach b/bsp/nrf5x/nrf52840/.ci/attachconfig/devices/pwm.attach
new file mode 100644
index 0000000000..1ef1911786
--- /dev/null
+++ b/bsp/nrf5x/nrf52840/.ci/attachconfig/devices/pwm.attach
@@ -0,0 +1 @@
+CONFIG_BSP_USING_PWM=y \ No newline at end of file
diff --git a/bsp/nrf5x/nrf52840/.ci/attachconfig/devices/qspi_flash.attach b/bsp/nrf5x/nrf52840/.ci/attachconfig/devices/qspi_flash.attach
new file mode 100644
index 0000000000..68c1ca98d3
--- /dev/null
+++ b/bsp/nrf5x/nrf52840/.ci/attachconfig/devices/qspi_flash.attach
@@ -0,0 +1 @@
+CONFIG_BSP_USING_QSPI_FLASH=y \ No newline at end of file
diff --git a/bsp/nrf5x/nrf52840/.ci/attachconfig/devices/rtc.attach b/bsp/nrf5x/nrf52840/.ci/attachconfig/devices/rtc.attach
new file mode 100644
index 0000000000..fb6acc20cd
--- /dev/null
+++ b/bsp/nrf5x/nrf52840/.ci/attachconfig/devices/rtc.attach
@@ -0,0 +1 @@
+CONFIG_BSP_USING_ONCHIP_RTC=y \ No newline at end of file
diff --git a/bsp/nrf5x/nrf52840/.ci/attachconfig/devices/spi.attach b/bsp/nrf5x/nrf52840/.ci/attachconfig/devices/spi.attach
new file mode 100644
index 0000000000..5b37d16468
--- /dev/null
+++ b/bsp/nrf5x/nrf52840/.ci/attachconfig/devices/spi.attach
@@ -0,0 +1 @@
+CONFIG_BSP_USING_SPI=y \ No newline at end of file
diff --git a/bsp/nrf5x/nrf52840/.ci/attachconfig/devices/uart.attach b/bsp/nrf5x/nrf52840/.ci/attachconfig/devices/uart.attach
new file mode 100644
index 0000000000..d8570f657d
--- /dev/null
+++ b/bsp/nrf5x/nrf52840/.ci/attachconfig/devices/uart.attach
@@ -0,0 +1 @@
+CONFIG_BSP_USING_UART=y \ No newline at end of file
diff --git a/bsp/nrf5x/nrf52840/.ci/attachconfig/devices/wdt.attach b/bsp/nrf5x/nrf52840/.ci/attachconfig/devices/wdt.attach
new file mode 100644
index 0000000000..f18527eda9
--- /dev/null
+++ b/bsp/nrf5x/nrf52840/.ci/attachconfig/devices/wdt.attach
@@ -0,0 +1 @@
+CONFIG_BSP_USING_WDT=y \ No newline at end of file