Microchip® Advanced Software Framework

tc_interrupt.h File Reference

SAM TC - Timer Counter Callback Driver.

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

#include "tc.h"
#include <system_interrupt.h>

Functions

Callback Management

{@

enum status_code tc_register_callback (struct tc_module *const module, tc_callback_t callback_func, const enum tc_callback callback_type)
 Registers a callback. More...
 
enum status_code tc_unregister_callback (struct tc_module *const module, const enum tc_callback callback_type)
 Unregisters a callback. More...
 
static void tc_enable_callback (struct tc_module *const module, const enum tc_callback callback_type)
 Enables callback. More...
 
static void tc_disable_callback (struct tc_module *const module, const enum tc_callback callback_type)
 Disables callback. More...
 

static void tc_disable_callback ( struct tc_module *const  module,
const enum tc_callback  callback_type 
)
inlinestatic

Disables callback.

Disables the callback function registered by the tc_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 TC software instance struct
[in]callback_typeCallback type given by an enum

References Assert, TC_CALLBACK_CC_CHANNEL0, and TC_CALLBACK_CC_CHANNEL1.

static void tc_enable_callback ( struct tc_module *const  module,
const enum tc_callback  callback_type 
)
inlinestatic

Enables callback.

Enables the callback function registered by the tc_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 TC software instance struct
[in]callback_typeCallback type given by an enum

References _tc_get_inst_index(), Assert, system_interrupt_enable(), TC_CALLBACK_CC_CHANNEL0, and TC_CALLBACK_CC_CHANNEL1.

enum status_code tc_register_callback ( struct tc_module *const  module,
tc_callback_t  callback_func,
const enum tc_callback  callback_type 
)

Registers a callback.

Registers a callback function which is implemented by the user.

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

References Assert, STATUS_OK, TC_CALLBACK_CC_CHANNEL0, and TC_CALLBACK_CC_CHANNEL1.

enum status_code tc_unregister_callback ( struct tc_module *const  module,
const enum tc_callback  callback_type 
)

Unregisters a callback.

Unregisters a callback function implemented by the user. The callback should be disabled before it is unregistered.

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

References Assert, STATUS_OK, TC_CALLBACK_CC_CHANNEL0, and TC_CALLBACK_CC_CHANNEL1.