Xmega Application Note


event_system_driver.c

Go to the documentation of this file.
00001 /* This file has been prepared for Doxygen automatic documentation generation.*/
00066 #include "event_system_driver.h"
00067 
00068 
00077 bool EVSYS_SetEventSource( uint8_t eventChannel, EVSYS_CHMUX_t eventSource )
00078 {
00079         volatile uint8_t * chMux;
00080 
00081         /*  Check if channel is valid and set the pointer offset for the selected
00082          *  channel and assign the eventSource value.
00083          */
00084         if (eventChannel < 8) {
00085                 chMux = &EVSYS.CH0MUX + eventChannel;
00086                 *chMux = eventSource;
00087 
00088                 return true;
00089         } else {
00090                 return false;
00091         }
00092 }
00093 
00107 bool EVSYS_SetEventChannelParameters( uint8_t eventChannel,
00108                                       EVSYS_QDIRM_t QDIRM,
00109                                       bool QDIndexEnable,
00110                                       bool QDEnable,
00111                                       EVSYS_DIGFILT_t filterCoefficient )
00112 {
00113 
00114         /*  Check if channel is valid and set the pointer offset for the selected
00115          *  channel and assign the configuration value.
00116          */
00117         if ( ( eventChannel == 0 ) ||
00118              ( eventChannel == 2 ) ||
00119              ( eventChannel == 4 ) ) {
00120 
00121                 volatile uint8_t * chCtrl;
00122                 chCtrl = &EVSYS.CH0CTRL + eventChannel;
00123                 *chCtrl = ( uint8_t ) QDIRM |
00124                           filterCoefficient |
00125                           ( QDIndexEnable ? EVSYS_QDIEN_bm : 0 ) |
00126                           ( QDEnable ? EVSYS_QDEN_bm : 0 );
00127 
00128                 return true;
00129         } else {
00130                 return false;
00131         }
00132 }
00133 
00142 bool EVSYS_SetEventChannelFilter( uint8_t eventChannel,
00143                                   EVSYS_DIGFILT_t filterCoefficient )
00144 {
00145         /*  Check if channel is valid and set the pointer offset for the selected
00146          *  channel and assign the configuration value.
00147          */
00148         if (eventChannel < 8) {
00149 
00150                 volatile uint8_t * chCtrl;
00151                 chCtrl = &EVSYS.CH0CTRL + eventChannel;
00152                 *chCtrl = filterCoefficient;
00153 
00154                 return true;
00155         } else {
00156                 return false;
00157         }
00158 }
00159 
00160 
00173 void EVSYS_ManualTrigger( uint8_t dataMask, uint8_t strobeMask )
00174 {
00175         /* The datamask register must be set before the strobe register. */
00176         EVSYS.DATA = dataMask;
00177         EVSYS.STROBE = strobeMask;
00178 }
@DOC_TITLE@
Generated on Tue Apr 22 14:20:07 2008 for AVR1001 Getting Started With the XMEGA Event System by doxygen 1.5.5