Skip to content

Commit

Permalink
hw/mcu/dialog: Add API to get expected wakeup time
Browse files Browse the repository at this point in the history
  • Loading branch information
andrzej-kaczmarek committed Aug 1, 2023
1 parent bd7aa45 commit 1e32211
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions hw/mcu/dialog/da1469x/include/mcu/da1469x_sleep.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ struct da1469x_sleep_cb {
};

void da1469x_sleep_cb_register(struct da1469x_sleep_cb *cb);
uint32_t da1469x_sleep_wakeup_time_us_get(void);

#ifdef __cplusplus
}
Expand Down
9 changes: 9 additions & 0 deletions hw/mcu/dialog/da1469x/src/da1469x_sleep.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,3 +167,12 @@ da1469x_sleep_cb_register(struct da1469x_sleep_cb *cb)
{
}
#endif

uint32_t
da1469x_sleep_wakeup_time_us_get(void)
{
/* XXX assume fast wakeup, i.e. up to 12 RC32K cycles + time required for
* XTAL32M to settle */
return 12 * 1000000 / da1469x_clock_lp_rc32k_freq_get() +
MYNEWT_VAL(MCU_CLOCK_XTAL32M_SETTLE_TIME_US);
}

0 comments on commit 1e32211

Please sign in to comment.