Merge pull request #4684 from hierophect/nrf-alarm-hotfix

NRF: Fix MP type checking macros
This commit is contained in:
Dan Halbert 2021-04-28 18:25:32 -04:00 committed by GitHub
commit b2b6f53112
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -93,7 +93,7 @@ bool alarm_pin_pinalarm_woke_us_up(void) {
mp_obj_t alarm_pin_pinalarm_get_wakeup_alarm(size_t n_alarms, const mp_obj_t *alarms) { mp_obj_t alarm_pin_pinalarm_get_wakeup_alarm(size_t n_alarms, const mp_obj_t *alarms) {
// First, check to see if we match any given alarms. // First, check to see if we match any given alarms.
for (size_t i = 0; i < n_alarms; i++) { for (size_t i = 0; i < n_alarms; i++) {
if (!MP_OBJ_IS_TYPE(alarms[i], &alarm_pin_pinalarm_type)) { if (!mp_obj_is_type(alarms[i], &alarm_pin_pinalarm_type)) {
continue; continue;
} }
alarm_pin_pinalarm_obj_t *alarm = MP_OBJ_TO_PTR(alarms[i]); alarm_pin_pinalarm_obj_t *alarm = MP_OBJ_TO_PTR(alarms[i]);
@ -197,7 +197,7 @@ void alarm_pin_pinalarm_set_alarms(bool deep_sleep, size_t n_alarms, const mp_ob
int pin_number = -1; int pin_number = -1;
for (size_t i = 0; i < n_alarms; i++) { for (size_t i = 0; i < n_alarms; i++) {
if (!MP_OBJ_IS_TYPE(alarms[i], &alarm_pin_pinalarm_type)) { if (!mp_obj_is_type(alarms[i], &alarm_pin_pinalarm_type)) {
continue; continue;
} }
alarm_pin_pinalarm_obj_t *alarm = MP_OBJ_TO_PTR(alarms[i]); alarm_pin_pinalarm_obj_t *alarm = MP_OBJ_TO_PTR(alarms[i]);

View File

@ -43,7 +43,7 @@ mp_float_t common_hal_alarm_time_timealarm_get_monotonic_time(alarm_time_timeala
mp_obj_t alarm_time_timealarm_get_wakeup_alarm(size_t n_alarms, const mp_obj_t *alarms) { mp_obj_t alarm_time_timealarm_get_wakeup_alarm(size_t n_alarms, const mp_obj_t *alarms) {
// First, check to see if we match // First, check to see if we match
for (size_t i = 0; i < n_alarms; i++) { for (size_t i = 0; i < n_alarms; i++) {
if (MP_OBJ_IS_TYPE(alarms[i], &alarm_time_timealarm_type)) { if (mp_obj_is_type(alarms[i], &alarm_time_timealarm_type)) {
return alarms[i]; return alarms[i];
} }
} }
@ -82,7 +82,7 @@ void alarm_time_timealarm_set_alarms(bool deep_sleep, size_t n_alarms, const mp_
wakeup_time_saved = 0; wakeup_time_saved = 0;
for (size_t i = 0; i < n_alarms; i++) { for (size_t i = 0; i < n_alarms; i++) {
if (!MP_OBJ_IS_TYPE(alarms[i], &alarm_time_timealarm_type)) { if (!mp_obj_is_type(alarms[i], &alarm_time_timealarm_type)) {
continue; continue;
} }
if (timealarm_set) { if (timealarm_set) {