-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rtc tests refactor #134
Rtc tests refactor #134
Conversation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am happy with the rest of the changes. Just some improvements/questions we can discuss over.
|
||
void rtc_irq_handler(void *self_in, cyhal_rtc_event_t event) { | ||
machine_rtc_obj_t *self = (machine_rtc_obj_t *)self_in; | ||
if (self->callback != NULL) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But where is this initialized as NULL? Should be done in cases where there is no alarm or there is alarm but no callback associated.
ports/psoc6/machine_rtc.c
Outdated
{ MP_QSTR_wake, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} } | ||
}; | ||
|
||
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; | ||
mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); | ||
machine_rtc_obj_t *self = pos_args[0]; | ||
self->callback = args[ARG_handler].u_obj; | ||
// TODO: Shall we do some argument validation here? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally callback can be NULL or a pointer to handler function. For ex: A NULL is valid, when wake-up condition is set. You only want to wake up the system from deep-sleep/hibernate modes and set the wakeup source as RTC ALARM and then you do not need user-level cback. The only difference is if handler is NULL, we don't need to call register function. Rest remains the same.
35b1221
to
3baabea
Compare
3baabea
to
7aaa6ea
Compare
Signed-off-by: enriquezgarc <enriquezgarcia.external@infineon.com>
7aaa6ea
to
1840214
Compare
By creating this pull request you agree to the terms in CONTRIBUTING.md.
https://github.com/Infineon/.github/blob/master/CONTRIBUTING.md
--- DO NOT DELETE ANYTHING ABOVE THIS LINE ---
CONTRIBUTING.md also tells you what to expect in the PR process.
@NikhitaR-IFX here are the changes.
Things that are still missing:
I would say: second call to RTC() should return error. What do you think? Anything I am missing?