Microchip® Advanced Software Framework

ac_callback.h File Reference

SAM AC - Analog Comparator Callback Driver.

Copyright (c) 2013-2018 Microchip Technology Inc. and its subsidiaries.

#include <compiler.h>
#include <system_interrupt.h>
#include "ac.h"

Functions

Callback Management

{@

enum status_code ac_register_callback (struct ac_module *const module, ac_callback_t callback_func, const enum ac_callback callback_type)
 Registers a callback. More...
 
enum status_code ac_unregister_callback (struct ac_module *const module, const enum ac_callback callback_type)
 Unregisters a callback. More...
 
static void ac_enable_callback (struct ac_module *const module, const enum ac_callback callback_type)
 Enables callback. More...
 
static void ac_disable_callback (struct ac_module *const module, const enum ac_callback callback_type)
 Disables callback. More...
 

static void ac_disable_callback ( struct ac_module *const  module,
const enum ac_callback  callback_type 
)
inlinestatic

Disables callback.

Disables the callback function registered by the ac_register_callback, and the callback will not be called from the interrupt routine. The function will also disable the appropriate interrupts.

Parameters
[in]modulePointer to AC software instance struct
[in]callback_typeCallback type given by an enum

References AC_CALLBACK_COMPARATOR_0, AC_CALLBACK_COMPARATOR_1, AC_CALLBACK_WINDOW_0, and Assert.

Referenced by cleanup_ac_callback_mode_test().

static void ac_enable_callback ( struct ac_module *const  module,
const enum ac_callback  callback_type 
)
inlinestatic

Enables callback.

Enables the callback function registered by the ac_register_callback. The callback function will be called from the interrupt handler when the conditions for the callback type are met. This function will also enable the appropriate interrupts.

Parameters
[in]modulePointer to AC software instance struct
[in]callback_typeCallback type given by an enum

References AC_CALLBACK_COMPARATOR_0, AC_CALLBACK_COMPARATOR_1, AC_CALLBACK_WINDOW_0, Assert, system_interrupt_enable(), and SYSTEM_INTERRUPT_MODULE_AC.

Referenced by setup_ac_callback_mode_test().

enum status_code ac_register_callback ( struct ac_module *const  module,
ac_callback_t  callback_func,
const enum ac_callback  callback_type 
)

Registers a callback.

Registers a callback function which is implemented by the user.

Note
The callback must be enabled by ac_enable_callback, in order for the interrupt handler to call it when the conditions for the callback type is met.
Parameters
[in]modulePointer to software instance struct
[in]callback_funcPointer to callback function
[in]callback_typeCallback type given by an enum
Return values
STATUS_OKThe function exited successfully

References Assert, and STATUS_OK.

Referenced by setup_ac_callback_mode_test().

enum status_code ac_unregister_callback ( struct ac_module *const  module,
const enum ac_callback  callback_type 
)

Unregisters a callback.

Unregisters a callback function implemented by the user.

Parameters
[in]modulePointer to AC software instance struct
[in]callback_typeCallback type given by an enum
Return values
STATUS_OKThe function exited successfully

References Assert, and STATUS_OK.

Referenced by cleanup_ac_callback_mode_test().