stmhal/rtc: Fix indentation to use spaces rather than tabs.
This commit is contained in:
parent
b106532b32
commit
60401d461a
46
stmhal/rtc.c
46
stmhal/rtc.c
@ -507,34 +507,34 @@ MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_rtc_wakeup_obj, 2, 4, pyb_rtc_wakeup);
|
|||||||
mp_obj_t pyb_rtc_calibration(mp_uint_t n_args, const mp_obj_t *args) {
|
mp_obj_t pyb_rtc_calibration(mp_uint_t n_args, const mp_obj_t *args) {
|
||||||
mp_int_t cal;
|
mp_int_t cal;
|
||||||
if (n_args == 2) {
|
if (n_args == 2) {
|
||||||
cal = mp_obj_get_int(args[1]);
|
cal = mp_obj_get_int(args[1]);
|
||||||
mp_uint_t cal_p, cal_m;
|
mp_uint_t cal_p, cal_m;
|
||||||
if (cal < -511 || cal > 512) {
|
if (cal < -511 || cal > 512) {
|
||||||
nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError,
|
nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError,
|
||||||
"calibration value out of range"));
|
"calibration value out of range"));
|
||||||
}
|
}
|
||||||
if (cal > 0) {
|
if (cal > 0) {
|
||||||
cal_p = RTC_SMOOTHCALIB_PLUSPULSES_SET;
|
cal_p = RTC_SMOOTHCALIB_PLUSPULSES_SET;
|
||||||
cal_m = 512 - cal;
|
cal_m = 512 - cal;
|
||||||
} else {
|
} else {
|
||||||
cal_p = RTC_SMOOTHCALIB_PLUSPULSES_RESET;
|
cal_p = RTC_SMOOTHCALIB_PLUSPULSES_RESET;
|
||||||
cal_m = -cal;
|
cal_m = -cal;
|
||||||
}
|
}
|
||||||
HAL_RTCEx_SetSmoothCalib(&RTCHandle, RTC_SMOOTHCALIB_PERIOD_32SEC, cal_p, cal_m);
|
HAL_RTCEx_SetSmoothCalib(&RTCHandle, RTC_SMOOTHCALIB_PERIOD_32SEC, cal_p, cal_m);
|
||||||
return mp_const_none;
|
return mp_const_none;
|
||||||
} else {
|
} else {
|
||||||
// printf("CALR = 0x%x\n", (mp_uint_t) RTCHandle.Instance->CALR); // DEBUG
|
// printf("CALR = 0x%x\n", (mp_uint_t) RTCHandle.Instance->CALR); // DEBUG
|
||||||
// Test if CALP bit is set in CALR:
|
// Test if CALP bit is set in CALR:
|
||||||
if (RTCHandle.Instance->CALR & 0x8000) {
|
if (RTCHandle.Instance->CALR & 0x8000) {
|
||||||
cal = 512 - (RTCHandle.Instance->CALR & 0x1ff);
|
cal = 512 - (RTCHandle.Instance->CALR & 0x1ff);
|
||||||
} else {
|
} else {
|
||||||
cal = -(RTCHandle.Instance->CALR & 0x1ff);
|
cal = -(RTCHandle.Instance->CALR & 0x1ff);
|
||||||
}
|
}
|
||||||
return mp_obj_new_int(cal);
|
return mp_obj_new_int(cal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_rtc_calibration_obj, 1, 2, pyb_rtc_calibration);
|
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_rtc_calibration_obj, 1, 2, pyb_rtc_calibration);
|
||||||
|
|
||||||
STATIC const mp_map_elem_t pyb_rtc_locals_dict_table[] = {
|
STATIC const mp_map_elem_t pyb_rtc_locals_dict_table[] = {
|
||||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_info), (mp_obj_t)&pyb_rtc_info_obj },
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_info), (mp_obj_t)&pyb_rtc_info_obj },
|
||||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_datetime), (mp_obj_t)&pyb_rtc_datetime_obj },
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_datetime), (mp_obj_t)&pyb_rtc_datetime_obj },
|
||||||
|
Loading…
Reference in New Issue
Block a user