2021-03-02 11:41:53 -05:00
|
|
|
/*
|
|
|
|
* This file is part of the Micro Python project, http://micropython.org/
|
|
|
|
*
|
|
|
|
* The MIT License (MIT)
|
|
|
|
*
|
|
|
|
* Copyright (c) 2021 Lucian Copeland for Adafruit Industries
|
2022-06-07 16:39:31 -04:00
|
|
|
* Copyright (c) 2022 Matthew McGowan for Blues Wireless Inc
|
2021-03-02 11:41:53 -05:00
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
* of this software and associated documentation files (the "Software"), to deal
|
|
|
|
* in the Software without restriction, including without limitation the rights
|
|
|
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
* copies of the Software, and to permit persons to whom the Software is
|
|
|
|
* furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be included in
|
|
|
|
* all copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
* THE SOFTWARE.
|
2021-03-11 17:50:05 -05:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __MICROPY_INCLUDED_STM32_PERIPHERALS_RTC_H__
|
|
|
|
#define __MICROPY_INCLUDED_STM32_PERIPHERALS_RTC_H__
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <stdbool.h>
|
|
|
|
|
|
|
|
#define PERIPHERALS_ALARM_A 0
|
|
|
|
#define PERIPHERALS_ALARM_B 1
|
|
|
|
|
|
|
|
uint32_t stm32_peripherals_get_rtc_freq(void);
|
|
|
|
void stm32_peripherals_rtc_init(void);
|
2023-05-12 00:28:37 -04:00
|
|
|
uint64_t stm32_peripherals_rtc_monotonic_ticks(uint8_t *subticks);
|
2021-03-11 17:50:05 -05:00
|
|
|
|
2021-05-10 18:04:43 -04:00
|
|
|
void stm32_peripherals_rtc_assign_wkup_callback(void (*callback)(void));
|
2021-03-11 17:50:05 -05:00
|
|
|
void stm32_peripherals_rtc_set_wakeup_mode_seconds(uint32_t seconds);
|
|
|
|
void stm32_peripherals_rtc_set_wakeup_mode_tick(void);
|
|
|
|
void stm32_peripherals_rtc_enable_wakeup_timer(void);
|
|
|
|
void stm32_peripherals_rtc_disable_wakeup_timer(void);
|
|
|
|
|
2021-04-02 15:13:10 -04:00
|
|
|
void stm32_peripherals_rtc_reset_alarms(void);
|
2021-05-10 18:04:43 -04:00
|
|
|
void stm32_peripherals_rtc_assign_alarm_callback(uint8_t alarm_idx, void (*callback)(void));
|
2021-03-11 17:50:05 -05:00
|
|
|
void stm32_peripherals_rtc_set_alarm(uint8_t alarm_idx, uint32_t ticks);
|
|
|
|
bool stm32_peripherals_rtc_alarm_triggered(uint8_t alarm_idx);
|
|
|
|
|
2022-06-07 16:39:31 -04:00
|
|
|
#if CIRCUITPY_RTC
|
|
|
|
typedef struct _timeutils_struct_time_t timeutils_struct_time_t;
|
|
|
|
void stm32_peripherals_rtc_get_time(timeutils_struct_time_t *tm);
|
|
|
|
void stm32_peripherals_rtc_set_time(timeutils_struct_time_t *tm);
|
|
|
|
#endif
|
|
|
|
|
2021-03-11 17:50:05 -05:00
|
|
|
#endif // __MICROPY_INCLUDED_STM32_PERIPHERALS_RTC_H__
|