4
0
mirror of https://github.com/RT-Thread/rt-thread.git synced 2025-02-06 23:05:23 +08:00

[bsp][stm32][wdt] Optimize code style.

This commit is contained in:
tangweikang 2020-07-23 18:37:35 +08:00
parent 1a42ca9035
commit ab8b25bcd3

View File

@ -18,12 +18,12 @@
struct stm32_wdt_obj struct stm32_wdt_obj
{ {
rt_watchdog_t watchdog;
IWDG_HandleTypeDef hiwdg; IWDG_HandleTypeDef hiwdg;
rt_uint16_t is_start; rt_uint16_t is_start;
}; };
static struct stm32_wdt_obj stm32_wdt; static struct stm32_wdt_obj stm32_wdt;
static struct rt_watchdog_ops ops; static struct rt_watchdog_ops ops;
static rt_watchdog_t watchdog;
static rt_err_t wdt_init(rt_watchdog_t *wdt) static rt_err_t wdt_init(rt_watchdog_t *wdt)
{ {
@ -116,9 +116,9 @@ int rt_wdt_init(void)
ops.init = &wdt_init; ops.init = &wdt_init;
ops.control = &wdt_control; ops.control = &wdt_control;
watchdog.ops = &ops; stm32_wdt.watchdog.ops = &ops;
/* register watchdog device */ /* register watchdog device */
if (rt_hw_watchdog_register(&watchdog, "wdt", RT_DEVICE_FLAG_DEACTIVATE, RT_NULL) != RT_EOK) if (rt_hw_watchdog_register(&stm32_wdt.watchdog, "wdt", RT_DEVICE_FLAG_DEACTIVATE, RT_NULL) != RT_EOK)
{ {
LOG_E("wdt device register failed."); LOG_E("wdt device register failed.");
return -RT_ERROR; return -RT_ERROR;