Skip to content

Commit

Permalink
samples: clock_skew: conversion of k_work API
Browse files Browse the repository at this point in the history
Replace all existing deprecated API with the recommended alternative.

Be aware that this does not address architectural errors in the use
of the work API.

Fixes zephyrproject-rtos#34096

Signed-off-by: Peter Bigot <[email protected]>
Signed-off-by: Johann Fischer <[email protected]>
  • Loading branch information
pabigot authored and jfischer-no committed Apr 14, 2021
1 parent b003c97 commit 84b8a50
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions samples/boards/nrf/clock_skew/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -166,7 +166,7 @@ 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));
k_work_reschedule(&sync_work, K_SECONDS(UPDATE_INTERVAL_S));
}

void main(void)
Expand Down Expand Up @@ -227,8 +227,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_reschedule(&sync_work, K_NO_WAIT);

printk("Started sync: %d\n", rc);
}

0 comments on commit 84b8a50

Please sign in to comment.