Hi,
I'm wanting to use pm_notifier to potentially execute actions on entry/exit from sleep states.
I have these two functions defined:
void power_state_entry_tasks(enum pm_state state)
{
printk("Entering power state %d", state);
}
void power_state_exit_tasks(enum pm_state state)
{
printk("Woke up from power state %d", state);
}
And I have, essentially, the notifier object defined in my context object:
typedef struct
{
struct pm_notifier pm_notifier;
} my_context_t;
my_context_t my_context =
{
.pm_notifier =
{
.state_entry = power_state_entry_tasks,
.state_exit = power_state_exit_tasks,
}
};
And then, my
main()
function:void main(void)
{
pm_notifier_register(&(my_context.pm_notifier));
while (1)
{
LOG_INF("hello");
k_sleep(K_MSEC(1000));
}
}
I see "hello" in the console every second, but I don't see any messages from my sleep entry/exit functions.
What am I missing?
Thanks!