Add support to RP2350.

RP2350 does not support RTC, so we use AON timer instead.
This commit is contained in:
Pol Henarejos
2024-08-28 16:42:46 +02:00
parent c2eda3ca53
commit 2d6545f191

View File

@@ -29,11 +29,14 @@
#include "tusb.h" #include "tusb.h"
#else #else
#include "pico/stdlib.h" #include "pico/stdlib.h"
#include "bsp/board.h"
#include "pico/aon_timer.h"
#endif #endif
#include "random.h" #include "random.h"
#include "pico_keys.h" #include "pico_keys.h"
#include "apdu.h" #include "apdu.h"
#include "usb.h"
#ifdef CYW43_WL_GPIO_LED_PIN #ifdef CYW43_WL_GPIO_LED_PIN
#include "pico/cyw43_arch.h" #include "pico/cyw43_arch.h"
#endif #endif
@@ -85,13 +88,6 @@ static inline void ws2812_program_init(PIO pio,
} }
#endif #endif
#if !defined(ESP_PLATFORM) && !defined(ENABLE_EMULATION)
#include "hardware/rtc.h"
#include "bsp/board.h"
#endif
#include "usb.h"
extern void do_flash(); extern void do_flash();
extern void low_flash_init(); extern void low_flash_init();
@@ -309,20 +305,10 @@ void led_off_all() {
} }
void init_rtc() { void init_rtc() {
#if defined(ENABLE_EMULATION) #ifdef PICO_PLATFORM
#elif defined(ESP_PLATFORM) struct timespec tv = {0};
#else tv.tv_sec = 1577836800; // 2020-01-01
rtc_init(); aon_timer_start(&tv);
datetime_t dt = {
.year = 2020,
.month = 1,
.day = 1,
.dotw = 3, // 0 is Sunday, so 5 is Friday
.hour = 00,
.min = 00,
.sec = 00
};
rtc_set_datetime(&dt);
#endif #endif
} }