SAM RTC Driver (Count Mode)
Copyright (c) 2012-2020 Microchip Technology Inc. and its subsidiaries.
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_CONTINUOUSLY_UPDATED |
RTC continuously updated. More... | |
Enumerations | |
enum | rtc_count_compare { RTC_COUNT_COMPARE_0 = 0, RTC_COUNT_COMPARE_1 = 1, RTC_COUNT_COMPARE_2 = 2, RTC_COUNT_COMPARE_3 = 3, RTC_COUNT_COMPARE_4 = 4, RTC_COUNT_COMPARE_5 = 5 } |
Available compare channels. More... | |
enum | rtc_count_mode { RTC_COUNT_MODE_16BIT = 0, RTC_COUNT_MODE_32BIT = 1 } |
Available operation modes for the RTC. More... | |
enum | rtc_count_prescaler { RTC_COUNT_PRESCALER_DIV_1 = RTC_MODE0_CTRL_PRESCALER_DIV1, RTC_COUNT_PRESCALER_DIV_2 = RTC_MODE0_CTRL_PRESCALER_DIV2, RTC_COUNT_PRESCALER_DIV_4 = RTC_MODE0_CTRL_PRESCALER_DIV4, RTC_COUNT_PRESCALER_DIV_8 = RTC_MODE0_CTRL_PRESCALER_DIV8, RTC_COUNT_PRESCALER_DIV_16 = RTC_MODE0_CTRL_PRESCALER_DIV16, RTC_COUNT_PRESCALER_DIV_32 = RTC_MODE0_CTRL_PRESCALER_DIV32, RTC_COUNT_PRESCALER_DIV_64 = RTC_MODE0_CTRL_PRESCALER_DIV64, RTC_COUNT_PRESCALER_DIV_128 = RTC_MODE0_CTRL_PRESCALER_DIV128, RTC_COUNT_PRESCALER_DIV_256 = RTC_MODE0_CTRL_PRESCALER_DIV256, RTC_COUNT_PRESCALER_DIV_512 = RTC_MODE0_CTRL_PRESCALER_DIV512, RTC_COUNT_PRESCALER_DIV_1024 = RTC_MODE0_CTRL_PRESCALER_DIV1024 } |
RTC input clock prescaler settings. More... | |
Functions | |
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... | |
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... | |