SAM Asynchronous Timer (AST) driver.
Copyright (c) 2012-2018 Microchip Technology Inc. and its subsidiaries.
#include <compiler.h>
Data Structures | |
struct | ast_calendar |
struct | ast_calv |
Description for Calendar Field. More... | |
struct | ast_config |
AST configuration. More... | |
Macros | |
#define | AST_POLL_TIMEOUT 10000 |
Timeout to prevent code hang in clock initialization. More... | |
Predefined PSEL Values | |
#define | AST_PSEL_32KHZ_1HZ 14 |
The PSEL value to set the AST source clock (after the prescaler) to 1Hz, when using an external 32-kHz crystal. More... | |
#define | AST_PSEL_RC_1_76HZ 15 |
The PSEL value to set the AST source clock (after the prescaler) to 1.76Hz when using the internal RC oscillator (~ 115kHz) More... | |
Typedefs | |
typedef void(* | ast_callback_t )(void) |
AST interrupt callback. More... | |
typedef enum ast_event_source | ast_event_source_t |
AST event source. More... | |
typedef enum ast_interrupt_source | ast_interrupt_source_t |
AST interrupt source. More... | |
typedef enum ast_mode | ast_mode_t |
AST Calendar Mode. More... | |
typedef enum ast_oscillator_type | ast_oscillator_type_t |
AST Oscillator type. More... | |
typedef enum ast_wakeup_source | ast_wakeup_source_t |
AST wake-up source. More... | |
Enumerations | |
enum | ast_event_source { AST_EVENT_ALARM = 0, AST_EVENT_PER, AST_EVENT_OVF } |
AST event source. More... | |
enum | ast_interrupt_source { AST_INTERRUPT_ALARM = 0, AST_INTERRUPT_PER, AST_INTERRUPT_OVF, AST_INTERRUPT_READY, AST_INTERRUPT_CLKREADY } |
AST interrupt source. More... | |
enum | ast_mode { AST_COUNTER_MODE = 0, AST_CALENDAR_MODE = 1 } |
AST Calendar Mode. More... | |
enum | ast_oscillator_type { AST_OSC_RC = 0, AST_OSC_32KHZ = 1, AST_OSC_PB = 2, AST_OSC_GCLK = 3, AST_OSC_1KHZ = 4 } |
AST Oscillator type. More... | |
enum | ast_wakeup_source { AST_WAKEUP_ALARM = 0, AST_WAKEUP_PER, AST_WAKEUP_OVF } |
AST wake-up source. More... | |
Functions | |
void | ast_clear_interrupt_flag (Ast *ast, ast_interrupt_source_t source) |
Clear an AST interrupt status flag. More... | |
void | ast_clear_prescalar (Ast *ast) |
Clear the AST periodic prescaler counter to zero. More... | |
uint32_t | ast_configure_digital_tuner (Ast *ast, uint32_t input_freq, uint32_t tuned_freq) |
Tune the AST prescaler frequency to the desired frequency. More... | |
void | ast_disable (Ast *ast) |
Disable the AST counter and module. More... | |
void | ast_disable_digital_tuner (Ast *ast) |
Disable the AST digital tuner. More... | |
void | ast_disable_event (Ast *ast, ast_event_source_t source) |
Disable an AST event. More... | |
void | ast_disable_interrupt (Ast *ast, ast_interrupt_source_t source) |
Disable an AST interrupt. More... | |
void | ast_disable_wakeup (Ast *ast, ast_wakeup_source_t source) |
Disable an AST asynchronous wake-up source. More... | |
void | ast_enable (Ast *ast) |
Enable the AST module. More... | |
void | ast_enable_counter_clear_on_alarm (Ast *ast, uint8_t alarm_channel) |
Enable the option to clear the counter on an AST alarm. More... | |
void | ast_enable_event (Ast *ast, ast_event_source_t source) |
Enable an AST event. More... | |
void | ast_enable_interrupt (Ast *ast, ast_interrupt_source_t source) |
Enable an AST interrupt. More... | |
void | ast_enable_wakeup (Ast *ast, ast_wakeup_source_t source) |
Enable an AST asynchronous wake-up source. More... | |
void | ast_init_digital_tuner (Ast *ast, bool add, uint8_t value, uint8_t exp) |
Initialize the AST digital tuner. More... | |
static bool | ast_is_busy (Ast *ast) |
Check the busy status of AST. More... | |
static bool | ast_is_clkbusy (Ast *ast) |
Check the busy status of the AST clock. More... | |
bool | ast_is_enabled (Ast *ast) |
Check the status of the AST module. More... | |
struct ast_calendar | ast_read_calendar_value (Ast *ast) |
Get the AST current calendar value. More... | |
static uint32_t | ast_read_counter_value (Ast *ast) |
Get the AST current counter value. More... | |
static uint32_t | ast_read_interrupt_mask (Ast *ast) |
Get the AST interrupt mask value. More... | |
static uint32_t | ast_read_status (Ast *ast) |
Get the status of AST. More... | |
void | ast_set_callback (Ast *ast, ast_interrupt_source_t source, ast_callback_t callback, uint8_t irq_line, uint8_t irq_level) |
Set callback for AST interrupts. More... | |
uint32_t | ast_set_config (Ast *ast, struct ast_config *ast_conf) |
Initialize and enable the AST module in Calendar Mode or Counter Mode. More... | |
static void | ast_start (Ast *ast) |
Start the AST counter. More... | |
static void | ast_stop (Ast *ast) |
Stop the AST counter. More... | |
void | ast_write_alarm0_value (Ast *ast, uint32_t alarm_value) |
Set the AST alarm0 value. More... | |
void | ast_write_calendar_value (Ast *ast, struct ast_calendar calendar) |
Set the AST current calendar value. More... | |
void | ast_write_counter_value (Ast *ast, uint32_t ast_counter) |
Set the AST current counter value. More... | |
void | ast_write_periodic0_value (Ast *ast, uint32_t pir) |
Set the AST periodic0 value. More... | |