[BSP]添加nrf52840的.ci文件,修复因rt_hw_pin_init引起的finsh警告,修复rtc编译报错 (#9583)
添加nrf52840的.ci文件,修复因rt_hw_pin_init引起的finsh警告,修复rtc编译报错
This commit is contained in:
parent
6b7f1177de
commit
948c8a4901
|
@ -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;
|
||||
|
||||
|
|
|
@ -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__ */
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
CONFIG_BSP_USING_SAADC=y
|
|
@ -0,0 +1 @@
|
|||
CONFIG_BSP_USING_ON_CHIP_FLASH=y
|
|
@ -0,0 +1 @@
|
|||
CONFIG_BSP_USING_GPIO=y
|
|
@ -0,0 +1,2 @@
|
|||
CONFIG_BSP_USING_TIM=y
|
||||
CONFIG_BSP_USING_TIM0=y
|
|
@ -0,0 +1 @@
|
|||
CONFIG_BSP_USING_I2C=y
|
|
@ -0,0 +1 @@
|
|||
CONFIG_BSP_USING_PWM=y
|
|
@ -0,0 +1 @@
|
|||
CONFIG_BSP_USING_QSPI_FLASH=y
|
|
@ -0,0 +1 @@
|
|||
CONFIG_BSP_USING_ONCHIP_RTC=y
|
|
@ -0,0 +1 @@
|
|||
CONFIG_BSP_USING_SPI=y
|
|
@ -0,0 +1 @@
|
|||
CONFIG_BSP_USING_UART=y
|
|
@ -0,0 +1 @@
|
|||
CONFIG_BSP_USING_WDT=y
|
Loading…
Reference in New Issue