mirror of
https://github.com/polhenarejos/pico-keys-sdk
synced 2026-05-28 17:11:23 +02:00
Add support to RP2350.
RP2350 does not support RTC, so we use AON timer instead.
This commit is contained in:
28
src/main.c
28
src/main.c
@@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user