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>
This commit is contained in:
parent
8498b0b13e
commit
36d9e98fc6
|
@ -33,13 +33,5 @@
|
||||||
extern uint32_t time_offset;
|
extern uint32_t time_offset;
|
||||||
|
|
||||||
MP_WEAK DWORD get_fattime(void) {
|
MP_WEAK DWORD get_fattime(void) {
|
||||||
#if MICROPY_PY_MACHINE_RTC
|
|
||||||
return (RTC->MODE2.CLOCK.reg >> 1) + (20 << 25);
|
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
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,8 +31,6 @@
|
||||||
#include "extmod/modmachine.h"
|
#include "extmod/modmachine.h"
|
||||||
#include "sam.h"
|
#include "sam.h"
|
||||||
|
|
||||||
#if MICROPY_PY_MACHINE_RTC
|
|
||||||
|
|
||||||
typedef struct _machine_rtc_obj_t {
|
typedef struct _machine_rtc_obj_t {
|
||||||
mp_obj_base_t base;
|
mp_obj_base_t base;
|
||||||
mp_obj_t callback;
|
mp_obj_t callback;
|
||||||
|
@ -177,5 +175,3 @@ MP_DEFINE_CONST_OBJ_TYPE(
|
||||||
make_new, machine_rtc_make_new,
|
make_new, machine_rtc_make_new,
|
||||||
locals_dict, &machine_rtc_locals_dict
|
locals_dict, &machine_rtc_locals_dict
|
||||||
);
|
);
|
||||||
|
|
||||||
#endif // MICROPY_PY_MACHINE_RTC
|
|
||||||
|
|
|
@ -48,16 +48,10 @@
|
||||||
|
|
||||||
#define LIGHTSLEEP_CPU_FREQ 200000
|
#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 \
|
#define MICROPY_PY_MACHINE_EXTRA_GLOBALS \
|
||||||
{ MP_ROM_QSTR(MP_QSTR_Pin), MP_ROM_PTR(&machine_pin_type) }, \
|
{ MP_ROM_QSTR(MP_QSTR_Pin), MP_ROM_PTR(&machine_pin_type) }, \
|
||||||
{ MP_ROM_QSTR(MP_QSTR_Timer), MP_ROM_PTR(&machine_timer_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. */ \
|
/* Class constants. */ \
|
||||||
/* Use numerical constants instead of the symbolic names, */ \
|
/* Use numerical constants instead of the symbolic names, */ \
|
||||||
|
|
|
@ -109,7 +109,6 @@
|
||||||
#define MICROPY_PY_RANDOM (1)
|
#define MICROPY_PY_RANDOM (1)
|
||||||
#define MICROPY_PY_DEFLATE (1)
|
#define MICROPY_PY_DEFLATE (1)
|
||||||
#define MICROPY_PY_ASYNCIO (1)
|
#define MICROPY_PY_ASYNCIO (1)
|
||||||
#define MICROPY_PY_MACHINE_RTC (1)
|
|
||||||
#ifndef MICROPY_PY_MACHINE_ADC
|
#ifndef MICROPY_PY_MACHINE_ADC
|
||||||
#define MICROPY_PY_MACHINE_ADC (1)
|
#define MICROPY_PY_MACHINE_ADC (1)
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -38,9 +38,7 @@
|
||||||
#include "tusb.h"
|
#include "tusb.h"
|
||||||
#include "mphalport.h"
|
#include "mphalport.h"
|
||||||
|
|
||||||
#if MICROPY_PY_MACHINE_RTC
|
|
||||||
extern void machine_rtc_start(bool force);
|
extern void machine_rtc_start(bool force);
|
||||||
#endif
|
|
||||||
|
|
||||||
static void usb_init(void) {
|
static void usb_init(void) {
|
||||||
// Init USB clock
|
// Init USB clock
|
||||||
|
@ -124,9 +122,7 @@ void samd_init(void) {
|
||||||
#if defined(MCU_SAMD51)
|
#if defined(MCU_SAMD51)
|
||||||
mp_hal_ticks_cpu_enable();
|
mp_hal_ticks_cpu_enable();
|
||||||
#endif
|
#endif
|
||||||
#if MICROPY_PY_MACHINE_RTC
|
|
||||||
machine_rtc_start(false);
|
machine_rtc_start(false);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if MICROPY_PY_MACHINE_I2C || MICROPY_PY_MACHINE_SPI || MICROPY_PY_MACHINE_UART
|
#if MICROPY_PY_MACHINE_I2C || MICROPY_PY_MACHINE_SPI || MICROPY_PY_MACHINE_UART
|
||||||
|
|
Loading…
Reference in New Issue