Microchip® Advanced Software Framework

tcc_callback.h File Reference

SAM TCC - Timer Counter for Control Applications Callback Driver.

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

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

Functions

Callback Management

{@

enum status_code tcc_register_callback (struct tcc_module *const module, tcc_callback_t callback_func, const enum tcc_callback callback_type)
 Registers a callback. More...
 
enum status_code tcc_unregister_callback (struct tcc_module *const module, const enum tcc_callback callback_type)
 Unregisters a callback. More...
 
void tcc_enable_callback (struct tcc_module *const module, const enum tcc_callback callback_type)
 Enables callback. More...
 
void tcc_disable_callback (struct tcc_module *const module, const enum tcc_callback callback_type)
 Disables callback. More...
 

void tcc_disable_callback ( struct tcc_module *const  module,
const enum tcc_callback  callback_type 
)

Disables callback.

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

References _tcc_get_inst_index(), _tcc_interrupt_get_interrupt_vector(), _tcc_intflag, Assert, tcc_module::enable_callback_mask, tcc_module::hw, and system_interrupt_disable().

Referenced by nm_bsp_stop_configurable_timer(), and run_callback_test().

void tcc_enable_callback ( struct tcc_module *const  module,
const enum tcc_callback  callback_type 
)

Enables callback.

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

References _tcc_get_inst_index(), _tcc_interrupt_get_interrupt_vector(), _tcc_intflag, Assert, tcc_module::enable_callback_mask, tcc_module::hw, and system_interrupt_enable().

Referenced by configure_tcc_callbacks(), nm_bsp_start_configurable_timer(), run_callback_test(), run_capture_and_compare_test(), sw_timer_init(), timer0_init(), and wifi_cb().

enum status_code tcc_register_callback ( struct tcc_module *const  module,
tcc_callback_t  callback_func,
const enum tcc_callback  callback_type 
)

Registers a callback.

Registers a callback function which is implemented by the user.

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

References _tcc_intflag, Assert, tcc_module::callback, tcc_module::register_callback_mask, and STATUS_OK.

Referenced by configurable_timer_init(), configure_tcc_callbacks(), configure_timer(), run_callback_test(), run_capture_and_compare_test(), sw_timer_init(), and timer0_init().

enum status_code tcc_unregister_callback ( struct tcc_module *const  module,
const enum tcc_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 TCC software instance struct
[in]callback_typeCallback type given by an enum

References _tcc_intflag, Assert, tcc_module::callback, NULL, tcc_module::register_callback_mask, and STATUS_OK.