samd: Remove the MICROPY_PY_MACHINE_RTC config option.

RTC is enabled on all boards.  Therefore the conditional compile is not
needed.  Removing it simplifies the source code a little bit.

Signed-off-by: robert-hh <robert@hammelrath.com>
pull/13303/head
robert-hh 2023-11-30 21:27:23 +01:00 zatwierdzone przez Damien George
rodzic 8498b0b13e
commit 36d9e98fc6
5 zmienionych plików z 1 dodań i 24 usunięć

Wyświetl plik

@ -33,13 +33,5 @@
extern uint32_t time_offset;
MP_WEAK DWORD get_fattime(void) {
#if MICROPY_PY_MACHINE_RTC
return (RTC->MODE2.CLOCK.reg >> 1) + (20 << 25);
#else
extern void rtc_gettime(timeutils_struct_time_t *tm);
timeutils_struct_time_t tm;
timeutils_seconds_since_epoch_to_struct_time(mp_hal_ticks_ms_64() / 1000 + time_offset, &tm);
return ((tm.tm_year - 1980) << 25) | ((tm.tm_mon) << 21) | ((tm.tm_mday) << 16) |
((tm.tm_hour) << 11) | ((tm.tm_min) << 5) | (tm.tm_sec / 2);
#endif
}

Wyświetl plik

@ -31,8 +31,6 @@
#include "extmod/modmachine.h"
#include "sam.h"
#if MICROPY_PY_MACHINE_RTC
typedef struct _machine_rtc_obj_t {
mp_obj_base_t base;
mp_obj_t callback;
@ -177,5 +175,3 @@ MP_DEFINE_CONST_OBJ_TYPE(
make_new, machine_rtc_make_new,
locals_dict, &machine_rtc_locals_dict
);
#endif // MICROPY_PY_MACHINE_RTC

Wyświetl plik

@ -48,16 +48,10 @@
#define LIGHTSLEEP_CPU_FREQ 200000
#if MICROPY_PY_MACHINE_RTC
#define MICROPY_PY_MACHINE_RTC_ENTRY { MP_ROM_QSTR(MP_QSTR_RTC), MP_ROM_PTR(&machine_rtc_type) },
#else
#define MICROPY_PY_MACHINE_RTC_ENTRY
#endif
#define MICROPY_PY_MACHINE_EXTRA_GLOBALS \
{ MP_ROM_QSTR(MP_QSTR_Pin), MP_ROM_PTR(&machine_pin_type) }, \
{ MP_ROM_QSTR(MP_QSTR_Timer), MP_ROM_PTR(&machine_timer_type) }, \
MICROPY_PY_MACHINE_RTC_ENTRY \
{ MP_ROM_QSTR(MP_QSTR_RTC), MP_ROM_PTR(&machine_rtc_type) }, \
\
/* Class constants. */ \
/* Use numerical constants instead of the symbolic names, */ \

Wyświetl plik

@ -109,7 +109,6 @@
#define MICROPY_PY_RANDOM (1)
#define MICROPY_PY_DEFLATE (1)
#define MICROPY_PY_ASYNCIO (1)
#define MICROPY_PY_MACHINE_RTC (1)
#ifndef MICROPY_PY_MACHINE_ADC
#define MICROPY_PY_MACHINE_ADC (1)
#endif

Wyświetl plik

@ -38,9 +38,7 @@
#include "tusb.h"
#include "mphalport.h"
#if MICROPY_PY_MACHINE_RTC
extern void machine_rtc_start(bool force);
#endif
static void usb_init(void) {
// Init USB clock
@ -124,9 +122,7 @@ void samd_init(void) {
#if defined(MCU_SAMD51)
mp_hal_ticks_cpu_enable();
#endif
#if MICROPY_PY_MACHINE_RTC
machine_rtc_start(false);
#endif
}
#if MICROPY_PY_MACHINE_I2C || MICROPY_PY_MACHINE_SPI || MICROPY_PY_MACHINE_UART