[BSP]添加nrf52840的.ci文件,修复因rt_hw_pin_init引起的finsh警告,修复rtc编译报错 (#9583)

添加nrf52840的.ci文件,修复因rt_hw_pin_init引起的finsh警告,修复rtc编译报错
This commit is contained in:
Li-Dongze 2024-10-26 14:59:30 +08:00 committed by GitHub
parent 6b7f1177de
commit 948c8a4901
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
14 changed files with 18 additions and 72 deletions

View File

@ -356,7 +356,7 @@ const static struct rt_pin_ops _nrf5x_pin_ops =
RT_NULL, RT_NULL,
}; };
rt_err_t rt_hw_pin_init(void) int rt_hw_pin_init(void)
{ {
nrfx_err_t err_code; nrfx_err_t err_code;

View File

@ -38,7 +38,7 @@ struct pin_index
rt_base_t pin; rt_base_t pin;
}; };
rt_err_t rt_hw_pin_init(void); int rt_hw_pin_init(void);
#endif /* __DRV_GPIO_H__ */ #endif /* __DRV_GPIO_H__ */

View File

@ -35,7 +35,7 @@
#define TICK_FREQUENCE_HZ (RT_TICK_PER_SECOND) // RTC tick frequence, in HZ #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 time_t init_time;
static uint32_t tick = 0; static uint32_t tick = 0;
@ -112,79 +112,13 @@ const static struct rt_device_ops rtc_ops =
}; };
#endif #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) int rt_hw_rtc_init(void)
{ {
rt_err_t result; rt_err_t result;
#if defined(SOC_NRF5340)
result = rt_hw_rtc_register_5340(&rtc, "rtc", RT_DEVICE_FLAG_RDWR); result = rt_hw_rtc_register(&rtc, "rtc", RT_DEVICE_FLAG_RDWR,RT_NULL);
#else
result = rt_hw_rtc_register(&rtc, "rtc", RT_DEVICE_FLAG_RDWR);
#endif
if (result != RT_EOK) if (result != RT_EOK)
{ {
LOG_E("rtc register err code: %d", result); LOG_E("rtc register err code: %d", result);

View File

@ -0,0 +1 @@
CONFIG_BSP_USING_SAADC=y

View File

@ -0,0 +1 @@
CONFIG_BSP_USING_ON_CHIP_FLASH=y

View File

@ -0,0 +1 @@
CONFIG_BSP_USING_GPIO=y

View File

@ -0,0 +1,2 @@
CONFIG_BSP_USING_TIM=y
CONFIG_BSP_USING_TIM0=y

View File

@ -0,0 +1 @@
CONFIG_BSP_USING_I2C=y

View File

@ -0,0 +1 @@
CONFIG_BSP_USING_PWM=y

View File

@ -0,0 +1 @@
CONFIG_BSP_USING_QSPI_FLASH=y

View File

@ -0,0 +1 @@
CONFIG_BSP_USING_ONCHIP_RTC=y

View File

@ -0,0 +1 @@
CONFIG_BSP_USING_SPI=y

View File

@ -0,0 +1 @@
CONFIG_BSP_USING_UART=y

View File

@ -0,0 +1 @@
CONFIG_BSP_USING_WDT=y