Microchip® Advanced Software Framework

tc_interrupt.c File Reference

SAM TC - Timer Counter Callback Driver.

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

#include "tc_interrupt.h"

Macros

#define _TC_INTERRUPT_HANDLER(n, m)
 

Functions

void _tc_interrupt_handler (uint8_t instance)
 
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...
 

Variables

void * _tc_instances [TC_INST_NUM]
 

#define _TC_INTERRUPT_HANDLER (   n,
 
)
Value:
void TC##n##_Handler(void) \
{ \
}
void _tc_interrupt_handler(uint8_t instance)
Definition: tc_interrupt.c:143

ISR handler for TC

Auto-generate a set of interrupt handlers for each TC in the device.

void _tc_interrupt_handler ( uint8_t  instance)

Interrupt Handler for TC module

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

Parameters
[in]instanceID of the TC instance calling the interrupt handler

References _tc_instances, TC_CALLBACK_CC_CHANNEL0, TC_CALLBACK_CC_CHANNEL1, TC_CALLBACK_ERROR, and TC_CALLBACK_OVERFLOW.

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.

void* _tc_instances[TC_INST_NUM]

Referenced by _tc_interrupt_handler(), and tc_init().