samples: boards: nrf: clock_skew: update k_work API
Trivial transformation for a periodic task. Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
This commit is contained in:
parent
e3a25b3b3a
commit
50cf28adb4
1 changed files with 5 additions and 4 deletions
|
@ -21,7 +21,7 @@ static const struct device *timer0;
|
|||
static struct timeutil_sync_config sync_config;
|
||||
static uint64_t counter_ref;
|
||||
static struct timeutil_sync_state sync_state;
|
||||
static struct k_delayed_work sync_work;
|
||||
static struct k_work_delayable sync_work;
|
||||
|
||||
/* Convert local time in ticks to microseconds. */
|
||||
uint64_t local_to_us(uint64_t local)
|
||||
|
@ -192,7 +192,8 @@ static void sync_work_handler(struct k_work *work)
|
|||
printf("Sync update error: %d\n", rc);
|
||||
}
|
||||
}
|
||||
k_delayed_work_submit(&sync_work, K_SECONDS(UPDATE_INTERVAL_S));
|
||||
(void)k_work_schedule(k_work_delayable_from_work(work),
|
||||
K_SECONDS(UPDATE_INTERVAL_S));
|
||||
}
|
||||
|
||||
void main(void)
|
||||
|
@ -253,8 +254,8 @@ void main(void)
|
|||
printf("Timer wraps every %u s\n",
|
||||
(uint32_t)(BIT64(32) / sync_config.ref_Hz));
|
||||
|
||||
k_delayed_work_init(&sync_work, sync_work_handler);
|
||||
rc = k_delayed_work_submit(&sync_work, K_NO_WAIT);
|
||||
k_work_init_delayable(&sync_work, sync_work_handler);
|
||||
rc = k_work_schedule(&sync_work, K_NO_WAIT);
|
||||
|
||||
printk("Started sync: %d\n", rc);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue