Microchip® Advanced Software Framework

ac_callback.c File Reference

SAM AC - Analog Comparator Callback Driver.

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

#include "ac_callback.h"

Functions

void _ac_interrupt_handler (const uint32_t instance_index)
 Interrupt Handler for AC module. More...
 
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...
 

Variables

struct ac_module_ac_instance [AC_INST_NUM]
 

void _ac_interrupt_handler ( const uint32_t  instance_index)

Interrupt Handler for AC module.

ISR handler for AC

Handles interrupts as they occur, it will run the callback functions that are registered and enabled.

Parameters
[in]instance_indexDefault value 0

References AC_CALLBACK_COMPARATOR_0, AC_CALLBACK_COMPARATOR_1, and AC_CALLBACK_WINDOW_0.

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 configure_ac_callback(), and 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, NULL, and STATUS_OK.

Referenced by cleanup_ac_callback_mode_test().

struct ac_module* _ac_instance[AC_INST_NUM]