SAM RTC Driver (Count Mode)
Copyright (c) 2012-2020 Microchip Technology Inc. and its subsidiaries.
#include <compiler.h>
#include <conf_clocks.h>
#include <system_interrupt.h>
#include "rtc_tamper.h"
Data Structures | |
struct | rtc_count_config |
RTC Count configuration structure. More... | |
struct | rtc_count_events |
RTC Count event enable/disable structure. More... | |
Macros | |
Driver Feature Definition | |
Define port features set according to different device family. | |
#define | FEATURE_RTC_PERIODIC_INT |
RTC periodic interval interrupt. More... | |
#define | FEATURE_RTC_PRESCALER_OFF |
RTC prescaler is off. More... | |
#define | FEATURE_RTC_CLOCK_SELECTION |
RTC clock selection. More... | |
#define | FEATURE_RTC_GENERAL_PURPOSE_REG |
General purpose registers. More... | |
#define | FEATURE_RTC_TAMPER_DETECTION |
RTC tamper detection. More... | |
Functions | |
uint32_t | rtc_tamper_get_stamp (struct rtc_module *const module) |
Get the tamper stamp value. More... | |
Configuration and Initialization | |
static void | rtc_count_get_config_defaults (struct rtc_count_config *const config) |
Gets the RTC default configurations. More... | |
void | rtc_count_reset (struct rtc_module *const module) |
Resets the RTC module. More... | |
void | rtc_count_enable (struct rtc_module *const module) |
Enables the RTC module. More... | |
void | rtc_count_disable (struct rtc_module *const module) |
Disables the RTC module. More... | |
enum status_code | rtc_count_init (struct rtc_module *const module, Rtc *const hw, const struct rtc_count_config *const config) |
Initializes the RTC module with given configurations. More... | |
enum status_code | rtc_count_frequency_correction (struct rtc_module *const module, const int8_t value) |
Calibrate for too-slow or too-fast oscillator. More... | |
Count and Compare Value Management | |
enum status_code | rtc_count_set_count (struct rtc_module *const module, const uint32_t count_value) |
Set the current count value to desired value. More... | |
uint32_t | rtc_count_get_count (struct rtc_module *const module) |
Get the current count value. More... | |
enum status_code | rtc_count_set_compare (struct rtc_module *const module, const uint32_t comp_value, const enum rtc_count_compare comp_index) |
Set the compare value for the specified compare. More... | |
enum status_code | rtc_count_get_compare (struct rtc_module *const module, uint32_t *const comp_value, const enum rtc_count_compare comp_index) |
Get the current compare value of specified compare. More... | |
enum status_code | rtc_count_set_period (struct rtc_module *const module, uint16_t period_value) |
Set the given value to the period. More... | |
enum status_code | rtc_count_get_period (struct rtc_module *const module, uint16_t *const period_value) |
Retrieves the value of period. More... | |
Status Management | |
static bool | rtc_count_is_overflow (struct rtc_module *const module) |
Check if an RTC overflow has occurred. More... | |
static void | rtc_count_clear_overflow (struct rtc_module *const module) |
Clears the RTC overflow flag. More... | |
static bool | rtc_count_is_periodic_interval (struct rtc_module *const module, enum rtc_count_periodic_interval n) |
Check if an RTC periodic interval interrupt has occurred. More... | |
static void | rtc_count_clear_periodic_interval (struct rtc_module *const module, enum rtc_count_periodic_interval n) |
Clears the RTC periodic interval flag. More... | |
bool | rtc_count_is_compare_match (struct rtc_module *const module, const enum rtc_count_compare comp_index) |
Check if RTC compare match has occurred. More... | |
enum status_code | rtc_count_clear_compare_match (struct rtc_module *const module, const enum rtc_count_compare comp_index) |
Clears RTC compare match flag. More... | |
Event Management | |
static void | rtc_count_enable_events (struct rtc_module *const module, struct rtc_count_events *const events) |
Enables an RTC event output. More... | |
static void | rtc_count_disable_events (struct rtc_module *const module, struct rtc_count_events *const events) |
Disables an RTC event output. More... | |
RTC General Purpose Registers | |
static void | rtc_write_general_purpose_reg (struct rtc_module *const module, const uint8_t index, uint32_t value) |
Write a value into general purpose register. More... | |
static uint32_t | rtc_read_general_purpose_reg (struct rtc_module *const module, const uint8_t index) |
Read the value from general purpose register. More... | |