mirror of
https://github.com/caperren/school_archives.git
synced 2025-11-09 21:51:15 +00:00
Added OSU Mars Rover 2104 Firmware and Design Files
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
|
||||
<workspace>
|
||||
<project>
|
||||
<path>$WS_DIR$\AVR1306.ewp</path>
|
||||
</project>
|
||||
<batchBuild/>
|
||||
</workspace>
|
||||
|
||||
|
||||
@@ -0,0 +1,433 @@
|
||||
/* This file has been prepared for Doxygen automatic documentation generation.*/
|
||||
/*! \file *********************************************************************
|
||||
*
|
||||
* \brief XMEGA Timer/Counter driver source file.
|
||||
*
|
||||
* This file contains the function implementations the XMEGA Timer/Counter
|
||||
* driver.
|
||||
*
|
||||
* The driver is not intended for size and/or speed critical code, since
|
||||
* most functions are just a few lines of code, and the function call
|
||||
* overhead would decrease code performance. The driver is intended for
|
||||
* rapid prototyping and documentation purposes for getting started with
|
||||
* the XMEGA Timer/Counter module.
|
||||
*
|
||||
* For size and/or speed critical code, it is recommended to copy the
|
||||
* function contents directly into your application instead of making
|
||||
* a function call.
|
||||
*
|
||||
* Several functions use the following construct:
|
||||
* "some_register = ... | (some_parameter ? SOME_BIT_bm : 0) | ..."
|
||||
* Although the use of the ternary operator ( if ? then : else ) is discouraged,
|
||||
* in some occasions the operator makes it possible to write pretty clean and
|
||||
* neat code. In this driver, the construct is used to set or not set a
|
||||
* configuration bit based on a boolean input parameter, such as
|
||||
* the "some_parameter" in the example above.
|
||||
*
|
||||
* \par Application note:
|
||||
* AVR1306: Using the XMEGA Timer/Counter
|
||||
*
|
||||
* \par Documentation
|
||||
* For comprehensive code documentation, supported compilers, compiler
|
||||
* settings and supported devices see readme.html
|
||||
*
|
||||
* \author
|
||||
* Atmel Corporation: http://www.atmel.com \n
|
||||
* Support email: avr@atmel.com
|
||||
*
|
||||
* $Revision: 1569 $
|
||||
* $Date: 2008-04-22 13:03:43 +0200 (ti, 22 apr 2008) $ \n
|
||||
*
|
||||
* Copyright (c) 2008, Atmel Corporation All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. The name of ATMEL may not be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY AND
|
||||
* SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
#include "avr_compiler.h"
|
||||
#include "TC_driver.h"
|
||||
|
||||
/*! \brief Configures clock source for the Timer/Counter 0.
|
||||
*
|
||||
* This function clears the old clock source setting of the Timer/Counter and
|
||||
* sets a new clock source according to the clockSelection parameter.
|
||||
*
|
||||
* \param tc Timer/Counter module instance.
|
||||
* \param clockSelection Timer/Counter clock source setting.
|
||||
*/
|
||||
void TC0_ConfigClockSource( volatile TC0_t * tc, TC_CLKSEL_t clockSelection )
|
||||
{
|
||||
tc->CTRLA = ( tc->CTRLA & ~TC0_CLKSEL_gm ) | clockSelection;
|
||||
}
|
||||
|
||||
/*! \brief Configures clock source for the Timer/Counter 1.
|
||||
*
|
||||
* This function clears the old clock source setting of the Timer/Counter and
|
||||
* sets a new clock source according to the clockSelection parameter.
|
||||
*
|
||||
* \param tc Timer/Counter module instance.
|
||||
* \param clockSelection Timer/Counter clock source setting.
|
||||
*/
|
||||
void TC1_ConfigClockSource( volatile TC1_t * tc, TC_CLKSEL_t clockSelection )
|
||||
{
|
||||
tc->CTRLA = ( tc->CTRLA & ~TC1_CLKSEL_gm ) | clockSelection;
|
||||
}
|
||||
|
||||
|
||||
/*! \brief Configures the Waveform Generation Mode for the Timer/Counter 0.
|
||||
*
|
||||
* This function clears the old WGM setting of the Timer/Counter and sets a
|
||||
* new WGM setting according to the wgm parameter.
|
||||
*
|
||||
* \param tc Timer/Counter module instance.
|
||||
* \param wgm Waveform generation mode.
|
||||
*/
|
||||
void TC0_ConfigWGM( volatile TC0_t * tc, TC_WGMODE_t wgm )
|
||||
{
|
||||
tc->CTRLB = ( tc->CTRLB & ~TC0_WGMODE_gm ) | wgm;
|
||||
}
|
||||
|
||||
|
||||
/*! \brief Configures the Waveform Generation Mode for the Timer/Counter 1.
|
||||
*
|
||||
* This function clears the old WGM setting of the Timer/Counter and sets a
|
||||
* new WGM setting according to the wgm parameter.
|
||||
*
|
||||
* \param tc Timer/Counter module instance.
|
||||
* \param wgm Waveform generation mode.
|
||||
*/
|
||||
void TC1_ConfigWGM( volatile TC1_t * tc, TC_WGMODE_t wgm )
|
||||
{
|
||||
tc->CTRLB = ( tc->CTRLB & ~TC1_WGMODE_gm ) | wgm;
|
||||
}
|
||||
|
||||
|
||||
/*! \brief Configures the Timer/Counter 0 for input capture operation.
|
||||
*
|
||||
* This function sets the Timer/Counter in input capture mode and selects
|
||||
* the event lines that will trigger the individual input capture channels.
|
||||
*
|
||||
* \note Output compare operation is disabled when input capture operation is
|
||||
* enabled.
|
||||
*
|
||||
* \param tc Timer/Counter module instance.
|
||||
* \param eventSource Event source selection.
|
||||
*/
|
||||
void TC0_ConfigInputCapture( volatile TC0_t * tc, TC_EVSEL_t eventSource )
|
||||
{
|
||||
tc->CTRLD = ( tc->CTRLD & ~( TC0_EVSEL_gm | TC0_EVACT_gm ) ) |
|
||||
eventSource |
|
||||
TC_EVACT_CAPT_gc;
|
||||
}
|
||||
|
||||
|
||||
/*! \brief Configures the Timer/Counter 1 for input capture operation.
|
||||
*
|
||||
* This function sets the Timer/Counter in input capture mode and selects
|
||||
* the event lines that will trigger the individual input capture channels.
|
||||
*
|
||||
* \note Output compare operation is disabled when input capture operation is
|
||||
* enabled.
|
||||
*
|
||||
* \param tc Timer/Counter module instance.
|
||||
* \param eventSource Event source selection.
|
||||
*/
|
||||
void TC1_ConfigInputCapture( volatile TC1_t * tc, TC_EVSEL_t eventSource )
|
||||
{
|
||||
tc->CTRLD = ( tc->CTRLD & ~( TC1_EVSEL_gm | TC1_EVACT_gm ) ) |
|
||||
eventSource |
|
||||
TC_EVACT_CAPT_gc;
|
||||
}
|
||||
|
||||
|
||||
/*! \brief Enables compare/capture channels for Timer/Counter 0.
|
||||
*
|
||||
* This function enables compare/capture channels according to the supplied
|
||||
* enableMask. The enableMask can be obtained by ORing together the symbols
|
||||
* - TC0_CCAEN_bm
|
||||
* - TC0_CCBEN_bm
|
||||
* - TC0_CCCEN_bm
|
||||
* - TC0_CCDEN_bm
|
||||
*
|
||||
* Example: TC0_EnableCCChannels( &TCC0, TC0_CCAEN_bm | TC0_CCCEN_bm ) will
|
||||
* enable channels A and C.
|
||||
*
|
||||
* \note No capture/compare channels are disabled by calling this function.
|
||||
* Disabling is done by calling \ref TC0_DisableCCChannels.
|
||||
*
|
||||
* \param tc Timer/Counter module instance.
|
||||
* \param enableMask Mask of channels to enable.
|
||||
*/
|
||||
void TC0_EnableCCChannels( volatile TC0_t * tc, uint8_t enableMask )
|
||||
{
|
||||
/* Make sure only CCxEN bits are set in enableMask. */
|
||||
enableMask &= ( TC0_CCAEN_bm | TC0_CCBEN_bm | TC0_CCCEN_bm | TC0_CCDEN_bm );
|
||||
|
||||
/* Enable channels. */
|
||||
tc->CTRLB |= enableMask;
|
||||
}
|
||||
|
||||
/*! \brief Enables compare/capture channels for Timer/Counter 1.
|
||||
*
|
||||
* This function enables compare/capture channels according to the supplied
|
||||
* enableMask. The enableMask can be obtained by ORing together the symbols
|
||||
* - TC1_CCAEN_bm
|
||||
* - TC1_CCBEN_bm
|
||||
*
|
||||
* Example: TC1_EnableCCChannels( &TCC1, TC1_CCAEN_bm | TC1_CCBEN_bm ) will
|
||||
* enable channels A and B.
|
||||
*
|
||||
* \note No capture/compare channels are disabled by calling this function.
|
||||
* Disabling is done by calling \ref TC1_DisableCCChannels.
|
||||
*
|
||||
* \param tc Timer/Counter module instance.
|
||||
* \param enableMask Mask of channels to enable.
|
||||
*/
|
||||
void TC1_EnableCCChannels( volatile TC1_t * tc, uint8_t enableMask )
|
||||
{
|
||||
/* Make sure only CCxEN bits are set in enableMask. */
|
||||
enableMask &= ( TC1_CCAEN_bm | TC1_CCBEN_bm );
|
||||
|
||||
/* Enable channels. */
|
||||
tc->CTRLB |= enableMask;
|
||||
}
|
||||
|
||||
|
||||
/*! \brief Disables compare/capture channels on Timer/Counter 0.
|
||||
*
|
||||
* This function disables compare/capture channels according to the supplied
|
||||
* disableMask. The disableMask can be obtained by ORing together the symbols
|
||||
* - TC0_CCAEN_bm
|
||||
* - TC0_CCBEN_bm
|
||||
* - TC0_CCCEN_bm
|
||||
* - TC0_CCDEN_bm
|
||||
*
|
||||
* Example: TC0_DisableCCChannels( &TCC0, TC0_CCAEN_bm | TC0_CCCEN_bm ) will
|
||||
* disable channels A and C.
|
||||
*
|
||||
* \param tc Timer/Counter module instance.
|
||||
* \param disableMask Mask of channels to disable.
|
||||
*/
|
||||
void TC0_DisableCCChannels( volatile TC0_t * tc, uint8_t disableMask )
|
||||
{
|
||||
/* Make sure only CCxEN bits are set in disableMask. */
|
||||
disableMask &= ( TC0_CCAEN_bm | TC0_CCBEN_bm | TC0_CCCEN_bm | TC0_CCDEN_bm );
|
||||
|
||||
/* Disable channels. */
|
||||
tc->CTRLB &= ~disableMask;
|
||||
}
|
||||
|
||||
|
||||
/*! \brief Disables compare/capture channels on Timer/Counter 1.
|
||||
*
|
||||
* This function disables compare/capture channels according to the supplied
|
||||
* disableMask. The disableMask can be obtained by ORing together the symbols
|
||||
* - TC1_CCAEN_bm
|
||||
* - TC1_CCBEN_bm
|
||||
*
|
||||
* Example: TC1_DisableCCChannels( &TCC1, TC1_CCAEN_bm | TC1_CCBEN_bm ) will
|
||||
* disable channels A and B.
|
||||
*
|
||||
* \param tc Timer/Counter module instance.
|
||||
* \param disableMask Mask of channels to disable.
|
||||
*/
|
||||
void TC1_DisableCCChannels( volatile TC1_t * tc, uint8_t disableMask )
|
||||
{
|
||||
/* Make sure only CCxEN bits are set in disableMask. */
|
||||
disableMask &= ( TC1_CCAEN_bm | TC1_CCBEN_bm );
|
||||
|
||||
/* Disable channels. */
|
||||
tc->CTRLB &= ~disableMask;
|
||||
}
|
||||
|
||||
/*! \brief Sets the overflow interrupt level.
|
||||
*
|
||||
* This function sets the overflow interrupt level of this Timer/Counter 0.
|
||||
*
|
||||
* \param tc Timer/Counter module instance.
|
||||
* \param intLevel New overflow interrupt level.
|
||||
*/
|
||||
void TC0_SetOverflowIntLevel( volatile TC0_t * tc, TC_OVFINTLVL_t intLevel )
|
||||
{
|
||||
tc->INTCTRLA = ( tc->INTCTRLA & ~TC0_OVFINTLVL_gm ) | intLevel;
|
||||
}
|
||||
|
||||
|
||||
/*! \brief Sets the overflow interrupt level.
|
||||
*
|
||||
* This function sets the overflow interrupt level of this Timer/Counter 1.
|
||||
*
|
||||
* \param tc Timer/Counter module instance.
|
||||
* \param intLevel New overflow interrupt level.
|
||||
*/
|
||||
void TC1_SetOverflowIntLevel( volatile TC1_t * tc, TC_OVFINTLVL_t intLevel )
|
||||
{
|
||||
tc->INTCTRLA = ( tc->INTCTRLA & ~TC1_OVFINTLVL_gm ) | intLevel;
|
||||
}
|
||||
|
||||
|
||||
/*! \brief Sets the Error interrupt level.
|
||||
*
|
||||
* This function sets the overflow interrupt level of this Timer/Counter 0.
|
||||
*
|
||||
* \param tc Timer/Counter module instance.
|
||||
* \param intLevel New error interrupt level.
|
||||
*/
|
||||
void TC0_SetErrorIntLevel( volatile TC0_t * tc, TC_ERRINTLVL_t intLevel )
|
||||
{
|
||||
tc->INTCTRLA = ( tc->INTCTRLA & ~TC0_ERRINTLVL_gm ) | intLevel;
|
||||
}
|
||||
|
||||
|
||||
/*! \brief Sets the Error interrupt level.
|
||||
*
|
||||
* This function sets the overflow interrupt level of this Timer/Counter 1.
|
||||
*
|
||||
* \param tc Timer/Counter module instance.
|
||||
* \param intLevel New error interrupt level.
|
||||
*/
|
||||
void TC1_SetErrorIntLevel( volatile TC1_t * tc, TC_ERRINTLVL_t intLevel )
|
||||
{
|
||||
tc->INTCTRLA = ( tc->INTCTRLA & ~TC1_ERRINTLVL_gm ) | intLevel;
|
||||
}
|
||||
|
||||
|
||||
/*! \brief Sets the interrupt level for compare/capture channel A interrupt.
|
||||
*
|
||||
* This function sets the interrupt level for compare/capture channel A
|
||||
* interrupt in Timer/Counter 0.
|
||||
*
|
||||
* \param tc Timer/Counter module instance.
|
||||
* \param intLevel New compare/capture channel A interrupt level.
|
||||
*/
|
||||
void TC0_SetCCAIntLevel( volatile TC0_t * tc, TC_CCAINTLVL_t intLevel )
|
||||
{
|
||||
tc->INTCTRLB = ( tc->INTCTRLB & ~TC0_CCAINTLVL_gm ) | intLevel;
|
||||
}
|
||||
|
||||
|
||||
/*! \brief Sets the interrupt level for compare/capture channel A interrupt.
|
||||
*
|
||||
* This function sets the interrupt level for compare/capture channel A
|
||||
* interrupt in Timer/Counter 1.
|
||||
*
|
||||
* \param tc Timer/Counter module instance.
|
||||
* \param intLevel New compare/capture channel A interrupt level.
|
||||
*/
|
||||
void TC1_SetCCAIntLevel( volatile TC1_t * tc, TC_CCAINTLVL_t intLevel )
|
||||
{
|
||||
tc->INTCTRLB = ( tc->INTCTRLB & ~TC1_CCAINTLVL_gm ) | intLevel;
|
||||
}
|
||||
|
||||
|
||||
/*! \brief Sets the interrupt level for compare/capture channel B interrupt.
|
||||
*
|
||||
* This function sets the interrupt level for compare/capture channel B
|
||||
* interrupt in Timer/Counter 0.
|
||||
*
|
||||
* \param tc Timer/Counter module instance.
|
||||
* \param intLevel New compare/capture channel B interrupt level.
|
||||
*/
|
||||
void TC0_SetCCBIntLevel( volatile TC0_t * tc, TC_CCBINTLVL_t intLevel )
|
||||
{
|
||||
tc->INTCTRLB = ( tc->INTCTRLB & ~TC0_CCBINTLVL_gm ) | intLevel;
|
||||
}
|
||||
|
||||
|
||||
/*! \brief Sets the interrupt level for compare/capture channel B interrupt.
|
||||
*
|
||||
* This function sets the interrupt level for compare/capture channel B
|
||||
* interrupt in Timer/Counter 1.
|
||||
*
|
||||
* \param tc Timer/Counter module instance.
|
||||
* \param intLevel New compare/capture channel B interrupt level.
|
||||
*/
|
||||
void TC1_SetCCBIntLevel( volatile TC1_t * tc, TC_CCBINTLVL_t intLevel )
|
||||
{
|
||||
tc->INTCTRLB = ( tc->INTCTRLB & ~TC1_CCBINTLVL_gm ) | intLevel;
|
||||
}
|
||||
|
||||
|
||||
/*! \brief Sets the interrupt level for compare/capture channel C interrupt.
|
||||
*
|
||||
* This function sets the interrupt level for compare/capture channel C
|
||||
* interrupt in Timer/Counter 0.
|
||||
*
|
||||
* \param tc Timer/Counter module instance.
|
||||
* \param intLevel New compare/capture channel A interrupt level.
|
||||
*/
|
||||
void TC0_SetCCCIntLevel( volatile TC0_t * tc, TC_CCCINTLVL_t intLevel )
|
||||
{
|
||||
tc->INTCTRLB = ( tc->INTCTRLB & ~TC0_CCCINTLVL_gm ) | intLevel;
|
||||
}
|
||||
|
||||
|
||||
/*! \brief Sets the interrupt level for compare/capture channel D interrupt.
|
||||
*
|
||||
* This function sets the interrupt level for compare/capture channel D
|
||||
* interrupt in Timer/Counter 0.
|
||||
*
|
||||
* \param tc Timer/Counter module instance.
|
||||
* \param intLevel New compare/capture channel A interrupt level.
|
||||
*/
|
||||
void TC0_SetCCDIntLevel( volatile TC0_t * tc, TC_CCDINTLVL_t intLevel )
|
||||
{
|
||||
tc->INTCTRLB = ( tc->INTCTRLB & ~TC0_CCDINTLVL_gm ) | intLevel;
|
||||
}
|
||||
|
||||
|
||||
/*! \brief Resets the Timer/Counter 0.
|
||||
*
|
||||
* This function will reset the Timer/Counter. After calling this function,
|
||||
* the Timer/Counter will be in the same state as it would after a full
|
||||
* reset of the device.
|
||||
*
|
||||
* \param tc Timer/Counter 0 module instance.
|
||||
*/
|
||||
void TC0_Reset( volatile TC0_t * tc )
|
||||
{
|
||||
/* TC must be turned off before a Reset command. */
|
||||
tc->CTRLA = ( tc->CTRLA & ~TC0_CLKSEL_gm ) | TC_CLKSEL_OFF_gc;
|
||||
|
||||
/* Issue Reset command. */
|
||||
tc->CTRLFSET = TC_CMD_RESET_gc;
|
||||
}
|
||||
|
||||
|
||||
/*! \brief Resets the Timer/Counter 1.
|
||||
*
|
||||
* This function will reset the Timer/Counter. After calling this function,
|
||||
* the Timer/Counter will be in the same state as it would after a full
|
||||
* reset of the device.
|
||||
*
|
||||
* \param tc Timer/Counter 1 module instance.
|
||||
*/
|
||||
void TC1_Reset( volatile TC1_t * tc )
|
||||
{
|
||||
/* TC must be turned off before a Reset command. */
|
||||
tc->CTRLA = ( tc->CTRLA & ~TC1_CLKSEL_gm ) | TC_CLKSEL_OFF_gc;
|
||||
|
||||
/* Issue Reset command. */
|
||||
tc->CTRLFSET = TC_CMD_RESET_gc;
|
||||
}
|
||||
@@ -0,0 +1,423 @@
|
||||
/* This file has been prepared for Doxygen automatic documentation generation.*/
|
||||
/*! \file *********************************************************************
|
||||
*
|
||||
* \brief XMEGA Timer/Counter driver header file.
|
||||
*
|
||||
* This file contains the function prototypes and enumerator definitions
|
||||
* for various configuration parameters for the XMEGA Timer/Counter driver.
|
||||
*
|
||||
* The driver is not intended for size and/or speed critical code, since
|
||||
* most functions are just a few lines of code, and the function call
|
||||
* overhead would decrease code performance. The driver is intended for
|
||||
* rapid prototyping and documentation purposes for getting started with
|
||||
* the XMEGA Timer/Counter module.
|
||||
*
|
||||
* For size and/or speed critical code, it is recommended to copy the
|
||||
* function contents directly into your application instead of making
|
||||
* a function call.
|
||||
*
|
||||
* \par Application note:
|
||||
* AVR1306: Using the XMEGA Timer/Counter
|
||||
*
|
||||
* \par Documentation
|
||||
* For comprehensive code documentation, supported compilers, compiler
|
||||
* settings and supported devices see readme.html
|
||||
*
|
||||
* \author
|
||||
* Atmel Corporation: http://www.atmel.com \n
|
||||
* Support email: avr@atmel.com
|
||||
*
|
||||
* $Revision: 1569 $
|
||||
* $Date: 2008-04-22 13:03:43 +0200 (ti, 22 apr 2008) $ \n
|
||||
*
|
||||
* Copyright (c) 2008, Atmel Corporation All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. The name of ATMEL may not be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY AND
|
||||
* SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
#ifndef TC_DRIVER_H
|
||||
#define TC_DRIVER_H
|
||||
|
||||
#include "avr_compiler.h"
|
||||
|
||||
/* Definition of macros. */
|
||||
|
||||
/*! \brief Enables the event delay for this TC.
|
||||
*
|
||||
* This macro enables a one clock cycle delay of event sources for this TC.
|
||||
* Mainly used for the high word TC when two TCs are cascaded to form a 32-bit
|
||||
* TC.
|
||||
*
|
||||
* \param _tc The Timer/Counter to enable delay on.
|
||||
*/
|
||||
#define TC_EnableEventDelay( _tc ) ( (_tc)->CTRLD |= TC0_EVDLY_bm )
|
||||
|
||||
/*! \brief This macro disables the event delay for this TC.
|
||||
*
|
||||
* \param _tc The Timer/Counter to disable delay on.
|
||||
*/
|
||||
#define TC_DisableEventDelay( _tc ) ( (_tc)->CTRLD &= ~TC0_EVDLY_bm )
|
||||
|
||||
/*! \brief Locks automatic updating of compare and period registers.
|
||||
*
|
||||
* This macro will lock automatic updates of compare registers from the
|
||||
* corresponding buffer registers. To enable automatic updates again, use the
|
||||
* \ref TC_UnlockCompareUpdate macro.
|
||||
*
|
||||
* \param _tc Timer/Counter module instance.
|
||||
*/
|
||||
#define TC_LockCompareUpdate( _tc ) ( (_tc)->CTRLFSET = TC0_LUPD_bm )
|
||||
|
||||
/*! \brief Unlocks automatic updating of compare and period registers.
|
||||
*
|
||||
* This macro will unlock automatic updates of compare registers from the
|
||||
* corresponding buffer registers. Note that the output compare registers will
|
||||
* not be updated until an update event occurs, e.g. that the counter hits
|
||||
* TOP or BOTTOM. To force an update of the compare register from the buffer
|
||||
* register, use the \ref TC_ForceUpdate macro.
|
||||
*
|
||||
* \param _tc Timer/Counter module instance.
|
||||
*/
|
||||
#define TC_UnlockCompareUpdate( _tc ) ( (_tc)->CTRLFCLR = TC0_LUPD_bm )
|
||||
|
||||
|
||||
/*! \brief Force an update of the output compare and period registers.
|
||||
*
|
||||
* This macro will trigger a transfer from the output compare and period
|
||||
* buffer registers ( CCxBUF and PERBUF ) to the output compare and period
|
||||
* registers ( CCx and PER ). Calling this macro has the same effect as an
|
||||
* update condition.
|
||||
*
|
||||
* \param _tc Timer/Counter module instance.
|
||||
*/
|
||||
#define TC_ForceUpdate( _tc ) ( (_tc)->CTRLFSET = TC_CMD_UPDATE_gc )
|
||||
|
||||
/*! \brief Restart the Timer/Counter.
|
||||
*
|
||||
* This macro will restart the timer. The effect of running this command is:
|
||||
* - The CNT[H:L] register is cleared.
|
||||
* - The direction (DIR ) is reset. (Next clock cycle will increase the counter )
|
||||
* - All compare outputs are set to 0.
|
||||
* - If a DTI module is connected to the timer, it will be reset as well.
|
||||
*
|
||||
* \param _tc Timer/Counter module instance.
|
||||
*/
|
||||
#define TC_Restart( _tc ) ( (_tc)->CTRLFSET = TC_CMD_RESTART_gc )
|
||||
|
||||
/*! \brief Manually set the count.
|
||||
*
|
||||
* This macro writes a new value to the CNT[H:L] register.
|
||||
* Note that the CNT[H:L] register is not double buffered, so it is recommended
|
||||
* that the timer is not running when this macro is used.
|
||||
*
|
||||
* \param _tc Timer/Counter module instance.
|
||||
* \param _count New count value.
|
||||
*/
|
||||
#define TC_SetCount( _tc, _count ) ( (_tc)->CNT = (_count) )
|
||||
|
||||
/*! \brief Sets the timer period.
|
||||
*
|
||||
* This macro sets a new timer period. The period buffer register is not
|
||||
* used, so the new period will be valid immediately after the 16-bit write
|
||||
* is finished.
|
||||
*
|
||||
* \param _tc Timer/Counter module instance.
|
||||
* \param _period New Timer/Counter period.
|
||||
*/
|
||||
#define TC_SetPeriod( _tc, _period ) ( (_tc)->PER = (_period) )
|
||||
|
||||
/*! \brief Sets the timer period ( double buffered ).
|
||||
*
|
||||
* This macro sets a new timer period. The period buffer register is used,
|
||||
* so the new period will be valid after the next update condition.
|
||||
*
|
||||
* \param _tc Timer/Counter 0 or 1 module instance.
|
||||
* \param _period New Timer/Counter period.
|
||||
*/
|
||||
#define TC_SetPeriodBuffered( _tc, _period ) ( (_tc)->PERBUF = (_period) )
|
||||
|
||||
/*! \brief Set new compare value for compare channel A. ( Double buffered )
|
||||
*
|
||||
* This macro sets a new compare value for compare channel A. The compare
|
||||
* channel A buffer register is used, so the new period will be valid from the
|
||||
* next update condition.
|
||||
*
|
||||
* \param _tc Timer/Counter 0 or 1 module instance.
|
||||
* \param _compareValue New compare value for compare channel A.
|
||||
*/
|
||||
#define TC_SetCompareA( _tc, _compareValue ) ( (_tc)->CCABUF = (_compareValue) )
|
||||
|
||||
/*! \brief Set new compare value for compare channel B. ( Double buffered )
|
||||
*
|
||||
* This macro sets a new compare value for compare channel B. The compare
|
||||
* channel B buffer register is used, so the new period will be valid from the
|
||||
* next update condition.
|
||||
*
|
||||
* \param _tc Timer/Counter 0 or 1 module instance.
|
||||
* \param _compareValue New compare value for compare channel B.
|
||||
*/
|
||||
#define TC_SetCompareB( _tc, _compareValue ) ( (_tc)->CCBBUF = (_compareValue) )
|
||||
|
||||
/*! \brief Set new compare value for compare channel C. ( Double buffered )
|
||||
*
|
||||
* This macro sets a new compare value for compare channel C. The compare
|
||||
* channel C buffer register is used, so the new period will be valid from the
|
||||
* next update condition.
|
||||
*
|
||||
* \note The CCC channel is not available on TCx1.
|
||||
*
|
||||
* \param _tc Timer/Counter 0 module instance.
|
||||
* \param _compareValue New compare value for compare channel C.
|
||||
*/
|
||||
#define TC_SetCompareC( _tc, _compareValue ) ( (_tc)->CCCBUF = (_compareValue) )
|
||||
|
||||
/*! \brief Set new compare value for compare channel D. ( Double buffered )
|
||||
*
|
||||
* This macro sets a new compare value for compare channel D. The compare
|
||||
* channel D buffer register is used, so the new period will be valid from the
|
||||
* next update condition.
|
||||
*
|
||||
* \note The CCD channel is not available on TCx1.
|
||||
*
|
||||
* \param _tc Timer/Counter 0 module instance.
|
||||
* \param _compareValue New compare value for compare channel D.
|
||||
*/
|
||||
#define TC_SetCompareD( _tc, _compareValue ) ( (_tc)->CCDBUF = (_compareValue) )
|
||||
|
||||
/*! \brief Test whether an overflow has occurred.
|
||||
*
|
||||
* The return value of this macro indicates if an overflow has occurred.
|
||||
*
|
||||
* \param _tc Timer/Counter module instance.
|
||||
*
|
||||
* \return Non-zero if overflow flag is set, zero otherwise.
|
||||
*/
|
||||
#define TC_GetOverflowFlag( _tc ) ( (_tc)->INTFLAGS & TC0_OVFIF_bm )
|
||||
|
||||
/*! \brief Clears the Timer/Counter overflow flag.
|
||||
*
|
||||
* This macro clears the Timer/Counter overflow flag.
|
||||
*
|
||||
* \param _tc Timer/Counter module instance.
|
||||
*/
|
||||
#define TC_ClearOverflowFlag( _tc ) ( (_tc)->INTFLAGS = TC0_OVFIF_bm )
|
||||
|
||||
/*! \brief Test whether an error has occurred.
|
||||
*
|
||||
* The return value of this macro indicates if an error has occurred.
|
||||
*
|
||||
* \param _tc Timer/Counter module instance.
|
||||
*
|
||||
* \return Non-zero if the Timer error flag is set.
|
||||
*/
|
||||
#define TC_GetErrorFlag( _tc ) ( (_tc)->INTFLAGS & TC0_ERRIF_bm )
|
||||
|
||||
/*! \brief Clears the Timer/Counter error flag.
|
||||
*
|
||||
* This macro clears the Timer/Counter error flag.
|
||||
*
|
||||
* \param _tc Timer/Counter module instance.
|
||||
*/
|
||||
#define TC_ClearErrorFlag( _tc ) ( (_tc)->INTFLAGS = TC0_ERRIF_bm )
|
||||
|
||||
/*! \brief Get the status for Compare or Capture channel A.
|
||||
*
|
||||
* When the TC is in Input Capture mode, the return value of this macro
|
||||
* indicates whether there is an unread input capture value available for
|
||||
* capture channel A.
|
||||
*
|
||||
* When the TC is in any other mode, the return value of this macro
|
||||
* indicates whether there has been a compare match between channel A and the
|
||||
* counter.
|
||||
*
|
||||
* \param _tc Timer/Counter 0 or 1 module instance.
|
||||
*
|
||||
* \return Non-zero if Compare or capture has occured, zero otherwise.
|
||||
*/
|
||||
#define TC_GetCCAFlag( _tc ) ( (_tc)->INTFLAGS & TC0_CCAIF_bm )
|
||||
|
||||
/*! \brief Clears the Timer/Counter compare or capture A interrupt flag.
|
||||
*
|
||||
* \param _tc Timer/Counter 0 or 1 module instance.
|
||||
*/
|
||||
#define TC_ClearCCAFlag( _tc ) ( (_tc)->INTFLAGS = TC0_CCAIF_bm )
|
||||
|
||||
/*! \brief Get the status for Compare or Capture channel B.
|
||||
*
|
||||
* When the TC is in Input Capture mode, the return value of this macro
|
||||
* indicates whether there is an unread input capture value available for
|
||||
* capture channel B.
|
||||
*
|
||||
* When the TC is in any other mode, the return value of this macro
|
||||
* indicates whether there has been a compare match between channel B and the
|
||||
* counter.
|
||||
*
|
||||
* \param _tc Timer/Counter 0 or 1 module instance.
|
||||
*
|
||||
* \return Non-zero if Compare or capture has occured, zero otherwise.
|
||||
*/
|
||||
#define TC_GetCCBFlag( _tc ) ( (_tc)->INTFLAGS & TC0_CCBIF_bm )
|
||||
|
||||
/*! \brief Clears the Timer/Counter compare or capture B interrupt flag.
|
||||
*
|
||||
* \param _tc Timer/Counter 0 or 1 module instance.
|
||||
*/
|
||||
#define TC_ClearCCBFlag( _tc ) ( (_tc)->INTFLAGS = TC0_CCBIF_bm )
|
||||
|
||||
/*! \brief Get the status for Compare or Capture channel C.
|
||||
*
|
||||
* When the TC is in Input Capture mode, the return value of this macro
|
||||
* indicates whether there is an unread input capture value available for
|
||||
* capture channel C.
|
||||
*
|
||||
* When the TC is in any other mode, the return value of this macro
|
||||
* indicates whether there has been a compare match between channel C and the
|
||||
* counter.
|
||||
*
|
||||
* \note The CCC channel is not available on TCx1.
|
||||
*
|
||||
* \param _tc Timer/Counter 0 module instance.
|
||||
*
|
||||
* \return Non-zero if Compare or capture has occured, zero otherwise.
|
||||
*/
|
||||
#define TC_GetCCCFlag( _tc ) ( (_tc)->INTFLAGS & TC0_CCCIF_bm )
|
||||
|
||||
/*! \brief Clears the Timer/Counter compare or capture C interrupt flag.
|
||||
*
|
||||
* This macro clears the Timer/Counter compare or capture C interrupt flag.
|
||||
*
|
||||
* \note The CCC channel is not available on TCx1.
|
||||
*
|
||||
* \param _tc Timer/Counter 0 module instance.
|
||||
*/
|
||||
#define TC_ClearCCCFlag( _tc ) ( (_tc)->INTFLAGS = TC0_CCCIF_bm )
|
||||
|
||||
/*! \brief Get the status for Compare or Capture channel D.
|
||||
*
|
||||
* When the TC is in Input Capture mode, the return value of this macro
|
||||
* indicates whether there is an unread input capture value available for
|
||||
* capture channel D.
|
||||
*
|
||||
* When the TC is in any other mode, the return value of this macro
|
||||
* indicates whether there has been a compare match between channel D and the
|
||||
* counter.
|
||||
*
|
||||
* \note The CCD channel is not available on TCx1.
|
||||
*
|
||||
* \param _tc Timer/Counter 0 module instance.
|
||||
*
|
||||
* \return Non-zero if Compare or capture has occured, zero otherwise.
|
||||
*/
|
||||
#define TC_GetCCDFlag( _tc ) ( (_tc)->INTFLAGS & TC0_CCDIF_bm )
|
||||
|
||||
/*! \brief Clears the Timer/Counter compare or capture D interrupt flag.
|
||||
*
|
||||
* This macro clears the Timer/Counter compare or capture D interrupt flag.
|
||||
*
|
||||
* \note The CCD channel is not available on TCx1.
|
||||
*
|
||||
* \param _tc Timer/Counter 0 module instance.
|
||||
*/
|
||||
#define TC_ClearCCDFlag( _tc ) ( (_tc)->INTFLAGS = TC0_CCDIF_bm )
|
||||
|
||||
|
||||
/*! \brief Reads the first available input capture value for channel A.
|
||||
*
|
||||
* This macro returns the first available input capture value for
|
||||
* capture channel A.
|
||||
*
|
||||
* \param _tc Timer/Counter 0 or 1 module instance.
|
||||
*
|
||||
* \return The first available input capture value for channel A.
|
||||
*/
|
||||
#define TC_GetCaptureA( _tc ) ( (_tc)->CCA )
|
||||
|
||||
/*! \brief Reads the first available input capture value for channel B.
|
||||
*
|
||||
* This macro returns the first available input capture value for
|
||||
* capture channel B.
|
||||
*
|
||||
* \param _tc Timer/Counter 0 or 1 module instance.
|
||||
*
|
||||
* \return The first available input capture value for channel B.
|
||||
*/
|
||||
#define TC_GetCaptureB( _tc ) ( (_tc)->CCB )
|
||||
|
||||
/*! \brief Reads the first available input capture value for channel C.
|
||||
*
|
||||
* This macro returns the first available input capture value for
|
||||
* capture channel C.
|
||||
*
|
||||
* \note The CCC channel is not available on TCx1.
|
||||
*
|
||||
* \param _tc Timer/Counter 0 module instance.
|
||||
*
|
||||
* \return The first available input capture value for channel C.
|
||||
*/
|
||||
#define TC_GetCaptureC( _tc ) ( (_tc)->CCC )
|
||||
|
||||
/*! \brief Reads the first available input capture value for channel D.
|
||||
*
|
||||
* This macro returns the first available input capture value for
|
||||
* capture channel D.
|
||||
*
|
||||
* \note The CCD channel is not available on TCx1.
|
||||
*
|
||||
* \param _tc Timer/Counter 0 module instance.
|
||||
*
|
||||
* \return The first available input capture value for channel D.
|
||||
*/
|
||||
#define TC_GetCaptureD( _tc ) ( (_tc)->CCD )
|
||||
|
||||
|
||||
/* Prototyping of functions. Documentation can be found in source file. */
|
||||
|
||||
void TC0_ConfigClockSource( volatile TC0_t * tc, TC_CLKSEL_t clockSelection );
|
||||
void TC0_ConfigWGM( volatile TC0_t * tc, TC_WGMODE_t wgm );
|
||||
void TC0_ConfigInputCapture( volatile TC0_t * tc, TC_EVSEL_t eventSource );
|
||||
void TC0_EnableCCChannels( volatile TC0_t * tc, uint8_t enableMask );
|
||||
void TC0_DisableCCChannels( volatile TC0_t * tc, uint8_t disableMask );
|
||||
void TC0_SetOverflowIntLevel( volatile TC0_t * tc, TC_OVFINTLVL_t intLevel );
|
||||
void TC0_SetErrorIntLevel( volatile TC0_t * tc, TC_ERRINTLVL_t intLevel );
|
||||
void TC0_SetCCAIntLevel( volatile TC0_t * tc, TC_CCAINTLVL_t intLevel );
|
||||
void TC0_SetCCBIntLevel( volatile TC0_t * tc, TC_CCBINTLVL_t intLevel );
|
||||
void TC0_SetCCCIntLevel( volatile TC0_t * tc, TC_CCCINTLVL_t intLevel );
|
||||
void TC0_SetCCDIntLevel( volatile TC0_t * tc, TC_CCDINTLVL_t intLevel );
|
||||
void TC0_Reset( volatile TC0_t * tc );
|
||||
|
||||
void TC1_ConfigClockSource( volatile TC1_t * tc, TC_CLKSEL_t clockSelection );
|
||||
void TC1_ConfigWGM( volatile TC1_t * tc, TC_WGMODE_t wgm );
|
||||
void TC1_ConfigInputCapture( volatile TC1_t * tc, TC_EVSEL_t eventSource );
|
||||
void TC1_EnableCCChannels( volatile TC1_t * tc, uint8_t enableMask );
|
||||
void TC1_DisableCCChannels( volatile TC1_t * tc, uint8_t disableMask );
|
||||
void TC1_SetOverflowIntLevel( volatile TC1_t * tc, TC_OVFINTLVL_t intLevel );
|
||||
void TC1_SetErrorIntLevel( volatile TC1_t * tc, TC_ERRINTLVL_t intLevel );
|
||||
void TC1_SetCCAIntLevel( volatile TC1_t * tc, TC_CCAINTLVL_t intLevel );
|
||||
void TC1_SetCCBIntLevel( volatile TC1_t * tc, TC_CCBINTLVL_t intLevel );
|
||||
void TC1_SetCCCIntLevel( volatile TC1_t * tc, TC_CCCINTLVL_t intLevel );
|
||||
void TC1_SetCCDIntLevel( volatile TC1_t * tc, TC_CCDINTLVL_t intLevel );
|
||||
void TC1_Reset( volatile TC1_t * tc );
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,358 @@
|
||||
/* This file has been prepared for Doxygen automatic documentation generation.*/
|
||||
/*! \file *********************************************************************
|
||||
*
|
||||
* \brief XMEGA Timer/Counter example source file.
|
||||
*
|
||||
* This file contains an example application that demonstrates the Timer/
|
||||
* Counter driver.
|
||||
*
|
||||
* \par Application note:
|
||||
* AVR1306: Using the XMEGA Timer/Counter
|
||||
*
|
||||
* \par Documentation
|
||||
* For comprehensive code documentation, supported compilers, compiler
|
||||
* settings and supported devices see readme.html
|
||||
*
|
||||
* \author
|
||||
* Atmel Corporation: http://www.atmel.com \n
|
||||
* Support email: avr@atmel.com
|
||||
*
|
||||
* $Revision: 1569 $
|
||||
* $Date: 2008-04-22 13:03:43 +0200 (ti, 22 apr 2008) $ \n
|
||||
*
|
||||
* Copyright (c) 2008, Atmel Corporation All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. The name of ATMEL may not be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY AND
|
||||
* SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
/* Definition of the CPU clock speed and TC prescaler setting. */
|
||||
#define F_CPU 2000000UL
|
||||
#define CPU_PRESCALER 1
|
||||
|
||||
#include "avr_compiler.h"
|
||||
#include "TC_driver.h"
|
||||
|
||||
/* Prototyping of functions. */
|
||||
void Example1( void );
|
||||
void Example2( void );
|
||||
void Example3( void );
|
||||
void Example4( void );
|
||||
void Example5( void );
|
||||
void Example6( void );
|
||||
|
||||
|
||||
/* \brief This is the main function for executing one of the examples.
|
||||
*
|
||||
* Uncomment one of the function calls to show the example.
|
||||
*/
|
||||
int main( void )
|
||||
{
|
||||
Example1();
|
||||
/*Example2();*/
|
||||
/*Example3();*/
|
||||
/*Example4();*/
|
||||
/*Example5();*/
|
||||
/*Example6();*/
|
||||
}
|
||||
|
||||
|
||||
/*! \brief This example shows how to configure TCC0 for basic timer operation.
|
||||
*
|
||||
* This function implements example 1, "Basic Timer/Counter Operation" from
|
||||
* the "Getting Started" section of application note AVR1306.
|
||||
*/
|
||||
void Example1( void )
|
||||
{
|
||||
/* Set period/TOP value. */
|
||||
TC_SetPeriod( &TCC0, 0x1000 );
|
||||
|
||||
/* Select clock source. */
|
||||
TC0_ConfigClockSource( &TCC0, TC_CLKSEL_DIV1_gc );
|
||||
|
||||
do {
|
||||
/* Wait while the timer counts. */
|
||||
} while (1);
|
||||
}
|
||||
|
||||
|
||||
/*! \brief This function shows how to use the Input Capture functionality.
|
||||
*
|
||||
* This function implements example 2, "Using the Input Capture Functionality"
|
||||
* from the "Getting Started" section of application note AVR1306.
|
||||
*
|
||||
*/
|
||||
void Example2( void )
|
||||
{
|
||||
uint16_t inputCaptureTime;
|
||||
|
||||
/* Configure PC0 for input, triggered on falling edge. */
|
||||
PORTC.PIN0CTRL = PORT_ISC_FALLING_gc;
|
||||
PORTC.DIRCLR = 0x01;
|
||||
|
||||
/* Configure Port D for output. */
|
||||
PORTD.DIRSET = 0xFF;
|
||||
|
||||
/* Select PC0 as input to event channel 2. */
|
||||
EVSYS.CH2MUX = EVSYS_CHMUX_PORTC_PIN0_gc;
|
||||
|
||||
/* Configure TCC0 for Input Capture using event channel 2. */
|
||||
TC0_ConfigInputCapture( &TCC0, TC_EVSEL_CH2_gc );
|
||||
|
||||
/* Enable Input Capture channel A. */
|
||||
TC0_EnableCCChannels( &TCC0, TC0_CCAEN_bm );
|
||||
|
||||
/* Start timer by selecting a clock source. */
|
||||
TC0_ConfigClockSource( &TCC0, TC_CLKSEL_DIV1_gc );
|
||||
|
||||
do {
|
||||
do {
|
||||
/* Wait for Input Capture. */
|
||||
} while ( TC_GetCCAFlag( &TCC0 ) == 0 );
|
||||
|
||||
inputCaptureTime = TC_GetCaptureA( &TCC0 );
|
||||
PORTD.OUT = (uint8_t) (inputCaptureTime >> 8);
|
||||
} while (1);
|
||||
}
|
||||
|
||||
|
||||
/*! \brief This example shows how to configure TCC0 for measurement of Frequency
|
||||
* and Duty cycle of a signal applied to PC0.
|
||||
*
|
||||
* This function implements example 3, "Using Input Capture to Calculate
|
||||
* Frequency and Duty Cycle of a Signal" from the "Getting Started" section of
|
||||
* application note AVR1306.
|
||||
*/
|
||||
void Example3( void )
|
||||
{
|
||||
/* Configure PC0 for input, triggered on both edges. */
|
||||
PORTC.PIN0CTRL = PORT_ISC_BOTHEDGES_gc;
|
||||
PORTC.DIRCLR = 0x01;
|
||||
|
||||
/* Select PC0 as input to event channel 0. */
|
||||
EVSYS.CH0MUX = EVSYS_CHMUX_PORTC_PIN0_gc;
|
||||
|
||||
/* Configure TCC0 for Input Capture using event channel 2. */
|
||||
TC0_ConfigInputCapture( &TCC0, TC_EVSEL_CH0_gc );
|
||||
|
||||
/* Enable Input "Capture or Compare" channel A. */
|
||||
TC0_EnableCCChannels( &TCC0, TC0_CCAEN_bm );
|
||||
|
||||
/* Clear MSB of PER[H:L] to allow for propagation of edge polarity. */
|
||||
TC_SetPeriod( &TCC0, 0x7FFF );
|
||||
|
||||
/* Start timer by selecting a clock source. */
|
||||
TC0_ConfigClockSource( &TCC0, TC_CLKSEL_DIV1_gc );
|
||||
|
||||
/* Enable CCA interrupt. */
|
||||
TC0_SetCCAIntLevel( &TCC0, TC_CCAINTLVL_LO_gc );
|
||||
PMIC.CTRL |= PMIC_LOLVLEN_bm;
|
||||
|
||||
sei();
|
||||
|
||||
do {
|
||||
/* Wait while interrupt measure Frequency and Duty cycle. */
|
||||
} while (1);
|
||||
}
|
||||
|
||||
|
||||
ISR(TCC0_CCA_vect)
|
||||
{
|
||||
static uint32_t frequency;
|
||||
static uint32_t dutyCycle;
|
||||
static uint16_t totalPeriod;
|
||||
static uint16_t highPeriod;
|
||||
|
||||
uint16_t thisCapture = TC_GetCaptureA( &TCC0 );
|
||||
|
||||
/* Save total period based on rising edge and reset counter. */
|
||||
if ( thisCapture & 0x8000 ) {
|
||||
totalPeriod = thisCapture & 0x7FFF;
|
||||
TC_Restart( &TCC0 );
|
||||
}
|
||||
/* Calculate duty cycle based on time from reset and falling edge. */
|
||||
else {
|
||||
highPeriod = thisCapture;
|
||||
}
|
||||
|
||||
dutyCycle = ( ( ( highPeriod * 100 ) / totalPeriod ) + dutyCycle ) / 2;
|
||||
frequency = ( ( ( F_CPU / CPU_PRESCALER ) / totalPeriod ) + frequency ) / 2;
|
||||
}
|
||||
|
||||
|
||||
/*! \brief This example shows how to configure TCC0 for pulse width modulation
|
||||
* output with varying duty cycle on channel A.
|
||||
*
|
||||
* This function implements example 4, "Using a Timer/Counter for PWM
|
||||
* Generation" from the "Getting Started" section of application note AVR1306.
|
||||
*/
|
||||
void Example4( void )
|
||||
{
|
||||
uint16_t compareValue = 0x0000;
|
||||
|
||||
/* Enable output on PC0. */
|
||||
PORTC.DIR = 0x01;
|
||||
|
||||
/* Set the TC period. */
|
||||
TC_SetPeriod( &TCC0, 0xFFFF );
|
||||
|
||||
/* Configure the TC for single slope mode. */
|
||||
TC0_ConfigWGM( &TCC0, TC_WGMODE_SS_gc );
|
||||
|
||||
/* Enable Compare channel A. */
|
||||
TC0_EnableCCChannels( &TCC0, TC0_CCAEN_bm );
|
||||
|
||||
/* Start timer by selecting a clock source. */
|
||||
TC0_ConfigClockSource( &TCC0, TC_CLKSEL_DIV1_gc );
|
||||
|
||||
do {
|
||||
/* Calculate new compare value. */
|
||||
compareValue += 32;
|
||||
|
||||
/* Output new compare value. */
|
||||
TC_SetCompareA( &TCC0, compareValue );
|
||||
|
||||
do {
|
||||
/* Wait for the new compare value to be latched
|
||||
* from CCABUF[H:L] to CCA[H:L]. This happens at
|
||||
* TC overflow (UPDATE ).
|
||||
*/
|
||||
} while( TC_GetOverflowFlag( &TCC0 ) == 0 );
|
||||
|
||||
/* Clear overflow flag. */
|
||||
TC_ClearOverflowFlag( &TCC0 );
|
||||
|
||||
} while (1);
|
||||
}
|
||||
|
||||
|
||||
/*! \brief This example shows how to configure TCC0 to count events.
|
||||
*
|
||||
* This function implements example 5, "Event Counting" from the "Getting
|
||||
* Started" section of application note AVR1306.
|
||||
*
|
||||
* This example shows how to configure TCC0 to count the number of switch
|
||||
* presses for a switch connected to PC0. PD0 is used as output and will
|
||||
* be toggled for every 5 switch presses on PC0.
|
||||
*/
|
||||
void Example5( void )
|
||||
{
|
||||
/* Configure PORTC as input on PC0, sense on falling edge. */
|
||||
PORTC.PIN0CTRL = PORT_ISC_RISING_gc;
|
||||
PORTC.DIRCLR = 0x01;
|
||||
|
||||
/* Configure PORTD as output on PD0. */
|
||||
PORTD.DIRSET = 0x01;
|
||||
|
||||
/* Select PC0 as input to event channel 0, enable filtering. */
|
||||
EVSYS.CH0MUX = EVSYS_CHMUX_PORTC_PIN0_gc;
|
||||
EVSYS.CH0CTRL = EVSYS_DIGFILT_8SAMPLES_gc;
|
||||
|
||||
/* Set period ( TOP value ). */
|
||||
TC_SetPeriod( &TCC0, 4 );
|
||||
|
||||
/* Enable overflow interrupt at low level */
|
||||
TC0_SetOverflowIntLevel( &TCC0, TC_OVFINTLVL_LO_gc );
|
||||
PMIC.CTRL |= PMIC_LOLVLEN_bm;
|
||||
|
||||
sei();
|
||||
|
||||
/* Start Timer/Counter. */
|
||||
TC0_ConfigClockSource( &TCC0, TC_CLKSEL_EVCH0_gc );
|
||||
|
||||
do {
|
||||
/* Wait for user input. */
|
||||
} while (1);
|
||||
}
|
||||
|
||||
|
||||
ISR(TCC0_OVF_vect)
|
||||
{
|
||||
/* Toggle PD0 output after 5 switch presses. */
|
||||
PORTD.OUTTGL = 0x01;
|
||||
}
|
||||
|
||||
|
||||
/*! \brief This example shows how to configure Timer/Counter for 32-bit counting
|
||||
* with input capture.
|
||||
*
|
||||
* This function implements example 6, "Setting up a 32-bit Timer/Counter With
|
||||
* Input Capture" from the "Getting Started" section of application note
|
||||
* AVR1306.
|
||||
*
|
||||
* This example shows how to configure TCC0 and TCC1 for 32-bit Timer/Counter
|
||||
* operation with input capture. The overflow from TCC0 is routed through
|
||||
* event channel 0 to TCC1. An input capture is triggered by a falling edge on
|
||||
* PC0, routed through event channel 1.
|
||||
*/
|
||||
void Example6( void )
|
||||
{
|
||||
uint32_t inputCaptureTime;
|
||||
|
||||
/* Configure PC0 for input, triggered on falling edge. */
|
||||
PORTC.PIN0CTRL = PORT_ISC_FALLING_gc;
|
||||
PORTC.DIRCLR = 0x01;
|
||||
|
||||
/* Configure PORTD as output. */
|
||||
PORTD.DIRSET = 0xFF;
|
||||
|
||||
/* Use PC0 as multiplexer input for event channel 1. */
|
||||
EVSYS.CH1MUX = EVSYS_CHMUX_PORTC_PIN0_gc;
|
||||
|
||||
/* Use TCC0 overflow as input for event channel 0. */
|
||||
EVSYS.CH0MUX = EVSYS_CHMUX_TCC0_OVF_gc;
|
||||
|
||||
/* Configure TCC0 and TCC1 for input capture with event channel 1 as
|
||||
* trigger source.
|
||||
*/
|
||||
TC0_ConfigInputCapture( &TCC0, TC_EVSEL_CH1_gc );
|
||||
TC1_ConfigInputCapture( &TCC1, TC_EVSEL_CH1_gc );
|
||||
|
||||
/* Enable event delay on TCC1. */
|
||||
TC_EnableEventDelay( &TCC1 );
|
||||
|
||||
/* Enable input capture channel A on TCC0 and TCC1 */
|
||||
TC0_EnableCCChannels( &TCC0, TC0_CCAEN_bm );
|
||||
TC1_EnableCCChannels( &TCC1, TC1_CCAEN_bm );
|
||||
|
||||
/* Use event channel 0 as clock source for TCC1. */
|
||||
TC1_ConfigClockSource( &TCC1, TC_CLKSEL_EVCH0_gc );
|
||||
|
||||
/* Select system clock as TCC0 clock source. */
|
||||
TC0_ConfigClockSource( &TCC0, TC_CLKSEL_DIV1_gc );
|
||||
|
||||
do {
|
||||
do {
|
||||
/* Wait for Input Capture. */
|
||||
} while ( TC_GetCCAFlag( &TCC0 ) == 0 );
|
||||
|
||||
uint16_t highWord = TC_GetCaptureA( &TCC1 );
|
||||
uint16_t lowWord = TC_GetCaptureA( &TCC0 );
|
||||
inputCaptureTime = ( (uint32_t) highWord << 16 ) | lowWord;
|
||||
|
||||
PORTD.OUT = (uint8_t) (inputCaptureTime >> 24);
|
||||
|
||||
} while (1);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,154 @@
|
||||
/* This file has been prepared for Doxygen automatic documentation generation.*/
|
||||
/*! \file *********************************************************************
|
||||
*
|
||||
* \brief This file implements some macros that makes the IAR C-compiler and
|
||||
* avr-gcc work with the same code base for the AVR architecture.
|
||||
*
|
||||
* \par Documentation
|
||||
* For comprehensive code documentation, supported compilers, compiler
|
||||
* settings and supported devices see readme.html
|
||||
*
|
||||
* \author
|
||||
* Atmel Corporation: http://www.atmel.com \n
|
||||
* Support email: avr@atmel.com
|
||||
*
|
||||
* $Revision: 613 $
|
||||
* $Date: 2006-04-07 14:40:07 +0200 (fr, 07 apr 2006) $ \n
|
||||
*
|
||||
* Copyright (c) 2008, Atmel Corporation All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. The name of ATMEL may not be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY AND
|
||||
* SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef COMPILER_AVR_H
|
||||
#define COMPILER_AVR_H
|
||||
|
||||
#ifndef F_CPU
|
||||
/*! \brief Define default CPU frequency, if this is not already defined. */
|
||||
#define F_CPU 2000000UL
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/*! \brief This macro will protect the following code from interrupts. */
|
||||
#define AVR_ENTER_CRITICAL_REGION( ) uint8_t volatile saved_sreg = SREG; \
|
||||
cli();
|
||||
|
||||
/*! \brief This macro must always be used in conjunction with AVR_ENTER_CRITICAL_REGION
|
||||
* so the interrupts are enabled again.
|
||||
*/
|
||||
#define AVR_LEAVE_CRITICAL_REGION( ) SREG = saved_sreg;
|
||||
|
||||
#if defined( __ICCAVR__ )
|
||||
|
||||
#include <inavr.h>
|
||||
#include <ioavr.h>
|
||||
#include <intrinsics.h>
|
||||
#include <pgmspace.h>
|
||||
|
||||
#ifndef __HAS_ELPM__
|
||||
#define _MEMATTR __flash
|
||||
#else /* __HAS_ELPM__ */
|
||||
#define _MEMATTR __farflash
|
||||
#endif /* __HAS_ELPM__ */
|
||||
|
||||
/*! \brief Perform a delay of \c us microseconds.
|
||||
*
|
||||
* The macro F_CPU is supposed to be defined to a constant defining the CPU
|
||||
* clock frequency (in Hertz).
|
||||
*
|
||||
* The maximal possible delay is 262.14 ms / F_CPU in MHz.
|
||||
*
|
||||
* \note For the IAR compiler, currently F_CPU must be a
|
||||
* multiple of 1000000UL (1 MHz).
|
||||
*/
|
||||
#define delay_us( us ) ( __delay_cycles( ( F_CPU / 1000000UL ) * ( us ) ) )
|
||||
|
||||
/*! \brief Preprocessor magic.
|
||||
*
|
||||
* Some preprocessor magic to allow for a header file abstraction of
|
||||
* interrupt service routine declarations for the IAR compiler. This
|
||||
* requires the use of the C99 _Pragma() directive (rather than the
|
||||
* old #pragma one that could not be used as a macro replacement), as
|
||||
* well as two different levels of preprocessor concetanations in
|
||||
* order to do both, assign the correct interrupt vector name, as well
|
||||
* as construct a unique function name for the ISR.
|
||||
*
|
||||
* \note Do *NOT* try to reorder the macros below, as this will only
|
||||
* work in the given order.
|
||||
*/
|
||||
#define PRAGMA(x) _Pragma( #x )
|
||||
#define ISR(vec) PRAGMA( vector=vec ) __interrupt void handler_##vec(void)
|
||||
#define sei( ) (__enable_interrupt( ))
|
||||
#define cli( ) (__disable_interrupt( ))
|
||||
|
||||
/*! \brief Define the no operation macro. */
|
||||
#define nop( ) (__no_operation())
|
||||
|
||||
/*! \brief Define the watchdog reset macro. */
|
||||
#define watchdog_reset( ) (__watchdog_reset( ))
|
||||
|
||||
|
||||
#define INLINE PRAGMA( inline=forced ) static
|
||||
|
||||
#define FLASH_DECLARE(x) _MEMATTR x
|
||||
#define FLASH_STRING(x) ((_MEMATTR const char *)(x))
|
||||
#define FLASH_STRING_T char const _MEMATTR *
|
||||
#define FLASH_BYTE_ARRAY_T uint8_t const _MEMATTR *
|
||||
#define PGM_READ_BYTE(x) *(x)
|
||||
#define PGM_READ_WORD(x) *(x)
|
||||
|
||||
#define SHORTENUM /**/
|
||||
|
||||
#elif defined( __GNUC__ )
|
||||
|
||||
#include <avr/io.h>
|
||||
#include <avr/interrupt.h>
|
||||
#include <avr/pgmspace.h>
|
||||
#include <util/delay.h>
|
||||
|
||||
/*! \brief Define the delay_us macro for GCC. */
|
||||
#define delay_us( us ) (_delay_us( us ))
|
||||
|
||||
#define INLINE static inline
|
||||
|
||||
/*! \brief Define the no operation macro. */
|
||||
#define nop() do { __asm__ __volatile__ ("nop"); } while (0)
|
||||
|
||||
#define MAIN_TASK_PROLOGUE int
|
||||
|
||||
|
||||
#define MAIN_TASK_EPILOGUE() return -1;
|
||||
|
||||
#define SHORTENUM __attribute__ ((packed))
|
||||
|
||||
#else
|
||||
#error Compiler not supported.
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,234 @@
|
||||
# Doxyfile 1.5.3
|
||||
# $Id: config.doxygen 623 2006-07-19 10:06:00Z raapeland $
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Project related configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
DOXYFILE_ENCODING = UTF-8
|
||||
PROJECT_NAME = "AVR1306 Using the XMEGA Timer/Counter "
|
||||
PROJECT_NUMBER = "<A href= http://www.atmel.com/dyn/products/app_notes.asp?family_id=607 >Atmel AVR Application Notes</A> "
|
||||
OUTPUT_DIRECTORY =
|
||||
CREATE_SUBDIRS = NO
|
||||
OUTPUT_LANGUAGE = English
|
||||
BRIEF_MEMBER_DESC = YES
|
||||
REPEAT_BRIEF = YES
|
||||
ABBREVIATE_BRIEF =
|
||||
ALWAYS_DETAILED_SEC = NO
|
||||
INLINE_INHERITED_MEMB = NO
|
||||
FULL_PATH_NAMES = YES
|
||||
STRIP_FROM_PATH =
|
||||
STRIP_FROM_INC_PATH =
|
||||
SHORT_NAMES = NO
|
||||
JAVADOC_AUTOBRIEF = NO
|
||||
QT_AUTOBRIEF = NO
|
||||
MULTILINE_CPP_IS_BRIEF = NO
|
||||
DETAILS_AT_TOP = YES
|
||||
INHERIT_DOCS = YES
|
||||
SEPARATE_MEMBER_PAGES = NO
|
||||
TAB_SIZE = 8
|
||||
ALIASES =
|
||||
OPTIMIZE_OUTPUT_FOR_C = YES
|
||||
OPTIMIZE_OUTPUT_JAVA = NO
|
||||
BUILTIN_STL_SUPPORT = NO
|
||||
CPP_CLI_SUPPORT = NO
|
||||
DISTRIBUTE_GROUP_DOC = YES
|
||||
SUBGROUPING = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Build related configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
EXTRACT_ALL = YES
|
||||
EXTRACT_PRIVATE = YES
|
||||
EXTRACT_STATIC = YES
|
||||
EXTRACT_LOCAL_CLASSES = YES
|
||||
EXTRACT_LOCAL_METHODS = YES
|
||||
EXTRACT_ANON_NSPACES = NO
|
||||
HIDE_UNDOC_MEMBERS = NO
|
||||
HIDE_UNDOC_CLASSES = NO
|
||||
HIDE_FRIEND_COMPOUNDS = NO
|
||||
HIDE_IN_BODY_DOCS = NO
|
||||
INTERNAL_DOCS = YES
|
||||
CASE_SENSE_NAMES = YES
|
||||
HIDE_SCOPE_NAMES = NO
|
||||
SHOW_INCLUDE_FILES = YES
|
||||
INLINE_INFO = YES
|
||||
SORT_MEMBER_DOCS = YES
|
||||
SORT_BRIEF_DOCS = YES
|
||||
SORT_BY_SCOPE_NAME = NO
|
||||
GENERATE_TODOLIST = YES
|
||||
GENERATE_TESTLIST = YES
|
||||
GENERATE_BUGLIST = YES
|
||||
GENERATE_DEPRECATEDLIST= YES
|
||||
ENABLED_SECTIONS =
|
||||
MAX_INITIALIZER_LINES = 30
|
||||
SHOW_USED_FILES = NO
|
||||
SHOW_DIRECTORIES = YES
|
||||
FILE_VERSION_FILTER =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to warning and progress messages
|
||||
#---------------------------------------------------------------------------
|
||||
QUIET = NO
|
||||
WARNINGS = YES
|
||||
WARN_IF_UNDOCUMENTED = YES
|
||||
WARN_IF_DOC_ERROR = YES
|
||||
WARN_NO_PARAMDOC = NO
|
||||
WARN_FORMAT = "$file:$line: $text "
|
||||
WARN_LOGFILE =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the input files
|
||||
#---------------------------------------------------------------------------
|
||||
INPUT =
|
||||
INPUT_ENCODING = UTF-8
|
||||
FILE_PATTERNS = *.c \
|
||||
*.h \
|
||||
*.cpp
|
||||
RECURSIVE = YES
|
||||
EXCLUDE =
|
||||
EXCLUDE_SYMLINKS = NO
|
||||
EXCLUDE_PATTERNS =
|
||||
EXCLUDE_SYMBOLS =
|
||||
EXAMPLE_PATH =
|
||||
EXAMPLE_PATTERNS =
|
||||
EXAMPLE_RECURSIVE = NO
|
||||
IMAGE_PATH = doxygen/
|
||||
INPUT_FILTER =
|
||||
FILTER_PATTERNS =
|
||||
FILTER_SOURCE_FILES = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to source browsing
|
||||
#---------------------------------------------------------------------------
|
||||
SOURCE_BROWSER = YES
|
||||
INLINE_SOURCES = YES
|
||||
STRIP_CODE_COMMENTS = YES
|
||||
REFERENCED_BY_RELATION = YES
|
||||
REFERENCES_RELATION = YES
|
||||
REFERENCES_LINK_SOURCE = YES
|
||||
USE_HTAGS = NO
|
||||
VERBATIM_HEADERS = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the alphabetical class index
|
||||
#---------------------------------------------------------------------------
|
||||
ALPHABETICAL_INDEX = NO
|
||||
COLS_IN_ALPHA_INDEX = 5
|
||||
IGNORE_PREFIX =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the HTML output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_HTML = YES
|
||||
HTML_OUTPUT = doxygen
|
||||
HTML_FILE_EXTENSION = .html
|
||||
HTML_HEADER = doxygen/atmel-header.html
|
||||
HTML_FOOTER = doxygen/atmel-footer.html
|
||||
HTML_STYLESHEET =
|
||||
HTML_ALIGN_MEMBERS = YES
|
||||
GENERATE_HTMLHELP = NO
|
||||
HTML_DYNAMIC_SECTIONS = NO
|
||||
CHM_FILE =
|
||||
HHC_LOCATION =
|
||||
GENERATE_CHI = NO
|
||||
BINARY_TOC = NO
|
||||
TOC_EXPAND = NO
|
||||
DISABLE_INDEX = YES
|
||||
ENUM_VALUES_PER_LINE = 4
|
||||
GENERATE_TREEVIEW = YES
|
||||
TREEVIEW_WIDTH = 250
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the LaTeX output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_LATEX = NO
|
||||
LATEX_OUTPUT = latex
|
||||
LATEX_CMD_NAME = latex
|
||||
MAKEINDEX_CMD_NAME = makeindex
|
||||
COMPACT_LATEX = NO
|
||||
PAPER_TYPE = a4wide
|
||||
EXTRA_PACKAGES =
|
||||
LATEX_HEADER =
|
||||
PDF_HYPERLINKS = NO
|
||||
USE_PDFLATEX = NO
|
||||
LATEX_BATCHMODE = NO
|
||||
LATEX_HIDE_INDICES = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the RTF output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_RTF = NO
|
||||
RTF_OUTPUT = RTF
|
||||
COMPACT_RTF = NO
|
||||
RTF_HYPERLINKS = YES
|
||||
RTF_STYLESHEET_FILE =
|
||||
RTF_EXTENSIONS_FILE =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the man page output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_MAN = NO
|
||||
MAN_OUTPUT = man
|
||||
MAN_EXTENSION = .3
|
||||
MAN_LINKS = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the XML output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_XML = NO
|
||||
XML_OUTPUT = xml
|
||||
XML_SCHEMA =
|
||||
XML_DTD =
|
||||
XML_PROGRAMLISTING = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options for the AutoGen Definitions output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_AUTOGEN_DEF = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the Perl module output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_PERLMOD = NO
|
||||
PERLMOD_LATEX = NO
|
||||
PERLMOD_PRETTY = YES
|
||||
PERLMOD_MAKEVAR_PREFIX =
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the preprocessor
|
||||
#---------------------------------------------------------------------------
|
||||
ENABLE_PREPROCESSING = YES
|
||||
MACRO_EXPANSION = NO
|
||||
EXPAND_ONLY_PREDEF = NO
|
||||
SEARCH_INCLUDES = YES
|
||||
INCLUDE_PATH =
|
||||
INCLUDE_FILE_PATTERNS =
|
||||
PREDEFINED =
|
||||
EXPAND_AS_DEFINED =
|
||||
SKIP_FUNCTION_MACROS = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration::additions related to external references
|
||||
#---------------------------------------------------------------------------
|
||||
TAGFILES =
|
||||
GENERATE_TAGFILE =
|
||||
ALLEXTERNALS = NO
|
||||
EXTERNAL_GROUPS = YES
|
||||
PERL_PATH = /usr/bin/perl
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the dot tool
|
||||
#---------------------------------------------------------------------------
|
||||
CLASS_DIAGRAMS = YES
|
||||
MSCGEN_PATH =
|
||||
HIDE_UNDOC_RELATIONS = YES
|
||||
HAVE_DOT = YES
|
||||
CLASS_GRAPH = YES
|
||||
COLLABORATION_GRAPH = YES
|
||||
GROUP_GRAPHS = YES
|
||||
UML_LOOK = NO
|
||||
TEMPLATE_RELATIONS = YES
|
||||
INCLUDE_GRAPH = YES
|
||||
INCLUDED_BY_GRAPH = YES
|
||||
CALL_GRAPH = YES
|
||||
CALLER_GRAPH = NO
|
||||
GRAPHICAL_HIERARCHY = YES
|
||||
DIRECTORY_GRAPH = YES
|
||||
DOT_IMAGE_FORMAT = png
|
||||
DOT_PATH =
|
||||
DOTFILE_DIRS =
|
||||
DOT_GRAPH_MAX_NODES = 50
|
||||
MAX_DOT_GRAPH_DEPTH = 0
|
||||
DOT_TRANSPARENT = NO
|
||||
DOT_MULTI_TARGETS = NO
|
||||
GENERATE_LEGEND = YES
|
||||
DOT_CLEANUP = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration::additions related to the search engine
|
||||
#---------------------------------------------------------------------------
|
||||
SEARCHENGINE = NO
|
||||
@@ -0,0 +1,57 @@
|
||||
/* Doxygen documentation mainpage ********************************************/
|
||||
/*! \mainpage
|
||||
* \section intro Introduction
|
||||
* This documents the firmware for the application note. \n
|
||||
*
|
||||
* \section compinfo Compilation Info
|
||||
* This firmware was compiled with IAR Embedded Workbench 5.10 and WinAVR 20080411.\n
|
||||
*
|
||||
* To make the project in IAR EWAVR:\n
|
||||
* Add the .c files (and .S90 files where applicable) for the given example to your
|
||||
* project. Use device ATxmega128A1 and enable bit definitions in I/O include files,
|
||||
* optimization low for debug target and high for release, output format: ubrof8 for
|
||||
* Debug and intel_extended for Release, select Normal DLIB as library. \n
|
||||
*
|
||||
* To make the project in WinAVR:\n
|
||||
* Add the .c files (and .S files where applicable) for the given example to your project.
|
||||
* Use device ATxmega128A1, optimization low for debug target and high for release. \n
|
||||
*
|
||||
* \section deviceinfo Device Info
|
||||
* All XMEGA devices with the targeted module can be used. The example is
|
||||
* written for ATxmega128A1.
|
||||
*
|
||||
* \section contactinfo Contact Info
|
||||
* For more info about Atmel AVR visit http://www.atmel.com/products/AVR/ \n
|
||||
* For application notes visit
|
||||
* http://www.atmel.com/dyn/products/app_notes.asp?family_id=607 \n
|
||||
* Support mail: avr@atmel.com \n
|
||||
*
|
||||
* $Revision: 1251 $
|
||||
* $Date: 2008-02-18 15:33:18 +0100 (ma, 18 feb 2008) $
|
||||
*
|
||||
* Copyright (c) 2008, Atmel Corporation All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. The name of ATMEL may not be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY AND
|
||||
* SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.8 KiB |
@@ -0,0 +1,200 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
|
||||
<title>@DOC_TITLE@</title>
|
||||
<link href="doxygen.css" rel="stylesheet" type="text/css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<table width="100%" height="10%" bgcolor="#FFFFFF">
|
||||
<tr>
|
||||
<td colspan="2"><p><A href=http://www.atmel.com ><img src="atmel.jpg"/ border=0></A></p><br /></td>
|
||||
<td colspan="2"> <strong><font face="Helvetica" color="#000000" size="+3">Xmega Application Note</font></strong></td>
|
||||
<td colspan="2"><p><A href=http://www.atmel.com/products/AVR><img src="AVR_logo_blue.gif"/ border=0></A></p><br /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="6" height="1" background="blue.gif"></td>
|
||||
</tr>
|
||||
</table>
|
||||
<!-- Generated by Doxygen 1.5.5 -->
|
||||
<h1>TC_driver.c</h1><a href="TC__driver_8c.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* This file has been prepared for Doxygen automatic documentation generation.*/</span>
|
||||
<a name="l00068"></a>00068 <span class="preprocessor">#include "<a class="code" href="avr__compiler_8h.html" title="This file implements some macros that makes the IAR C-compiler and avr-gcc work with...">avr_compiler.h</a>"</span>
|
||||
<a name="l00069"></a>00069 <span class="preprocessor">#include "<a class="code" href="TC__driver_8h.html" title="XMEGA Timer/Counter driver header file.">TC_driver.h</a>"</span>
|
||||
<a name="l00070"></a>00070
|
||||
<a name="l00079"></a><a class="code" href="TC__driver_8h.html#1a5b3ccf2b872dcdf8f4162e5cdc6e81">00079</a> <span class="keywordtype">void</span> <a class="code" href="TC__driver_8c.html#1a5b3ccf2b872dcdf8f4162e5cdc6e81" title="Configures clock source for the Timer/Counter 0.">TC0_ConfigClockSource</a>( <span class="keyword">volatile</span> TC0_t * tc, TC_CLKSEL_t clockSelection )
|
||||
<a name="l00080"></a>00080 {
|
||||
<a name="l00081"></a>00081 tc->CTRLA = ( tc->CTRLA & ~TC0_CLKSEL_gm ) | clockSelection;
|
||||
<a name="l00082"></a>00082 }
|
||||
<a name="l00083"></a>00083
|
||||
<a name="l00092"></a><a class="code" href="TC__driver_8h.html#ef27c3126f89d13b02732de352bff21f">00092</a> <span class="keywordtype">void</span> <a class="code" href="TC__driver_8c.html#ef27c3126f89d13b02732de352bff21f" title="Configures clock source for the Timer/Counter 1.">TC1_ConfigClockSource</a>( <span class="keyword">volatile</span> TC1_t * tc, TC_CLKSEL_t clockSelection )
|
||||
<a name="l00093"></a>00093 {
|
||||
<a name="l00094"></a>00094 tc->CTRLA = ( tc->CTRLA & ~TC1_CLKSEL_gm ) | clockSelection;
|
||||
<a name="l00095"></a>00095 }
|
||||
<a name="l00096"></a>00096
|
||||
<a name="l00097"></a>00097
|
||||
<a name="l00106"></a><a class="code" href="TC__driver_8h.html#45e98ab822bfcd2e284c13fddac90f32">00106</a> <span class="keywordtype">void</span> <a class="code" href="TC__driver_8c.html#45e98ab822bfcd2e284c13fddac90f32" title="Configures the Waveform Generation Mode for the Timer/Counter 0.">TC0_ConfigWGM</a>( <span class="keyword">volatile</span> TC0_t * tc, TC_WGMODE_t wgm )
|
||||
<a name="l00107"></a>00107 {
|
||||
<a name="l00108"></a>00108 tc->CTRLB = ( tc->CTRLB & ~TC0_WGMODE_gm ) | wgm;
|
||||
<a name="l00109"></a>00109 }
|
||||
<a name="l00110"></a>00110
|
||||
<a name="l00111"></a>00111
|
||||
<a name="l00120"></a><a class="code" href="TC__driver_8h.html#ea811f24d3ebc34c561eb648f2952314">00120</a> <span class="keywordtype">void</span> <a class="code" href="TC__driver_8c.html#ea811f24d3ebc34c561eb648f2952314" title="Configures the Waveform Generation Mode for the Timer/Counter 1.">TC1_ConfigWGM</a>( <span class="keyword">volatile</span> TC1_t * tc, TC_WGMODE_t wgm )
|
||||
<a name="l00121"></a>00121 {
|
||||
<a name="l00122"></a>00122 tc->CTRLB = ( tc->CTRLB & ~TC1_WGMODE_gm ) | wgm;
|
||||
<a name="l00123"></a>00123 }
|
||||
<a name="l00124"></a>00124
|
||||
<a name="l00125"></a>00125
|
||||
<a name="l00137"></a><a class="code" href="TC__driver_8h.html#309a2ca4eaf39437b57ca13edb23b70b">00137</a> <span class="keywordtype">void</span> <a class="code" href="TC__driver_8c.html#309a2ca4eaf39437b57ca13edb23b70b" title="Configures the Timer/Counter 0 for input capture operation.">TC0_ConfigInputCapture</a>( <span class="keyword">volatile</span> TC0_t * tc, TC_EVSEL_t eventSource )
|
||||
<a name="l00138"></a>00138 {
|
||||
<a name="l00139"></a>00139 tc->CTRLD = ( tc->CTRLD & ~( TC0_EVSEL_gm | TC0_EVACT_gm ) ) |
|
||||
<a name="l00140"></a>00140 eventSource |
|
||||
<a name="l00141"></a>00141 TC_EVACT_CAPT_gc;
|
||||
<a name="l00142"></a>00142 }
|
||||
<a name="l00143"></a>00143
|
||||
<a name="l00144"></a>00144
|
||||
<a name="l00156"></a><a class="code" href="TC__driver_8h.html#8d41d6b130f6fd3928e8198e9bf9512b">00156</a> <span class="keywordtype">void</span> <a class="code" href="TC__driver_8c.html#8d41d6b130f6fd3928e8198e9bf9512b" title="Configures the Timer/Counter 1 for input capture operation.">TC1_ConfigInputCapture</a>( <span class="keyword">volatile</span> TC1_t * tc, TC_EVSEL_t eventSource )
|
||||
<a name="l00157"></a>00157 {
|
||||
<a name="l00158"></a>00158 tc->CTRLD = ( tc->CTRLD & ~( TC1_EVSEL_gm | TC1_EVACT_gm ) ) |
|
||||
<a name="l00159"></a>00159 eventSource |
|
||||
<a name="l00160"></a>00160 TC_EVACT_CAPT_gc;
|
||||
<a name="l00161"></a>00161 }
|
||||
<a name="l00162"></a>00162
|
||||
<a name="l00163"></a>00163
|
||||
<a name="l00182"></a><a class="code" href="TC__driver_8h.html#e6b05576247ef4109e9249ea4f8e6b28">00182</a> <span class="keywordtype">void</span> <a class="code" href="TC__driver_8c.html#e6b05576247ef4109e9249ea4f8e6b28" title="Enables compare/capture channels for Timer/Counter 0.">TC0_EnableCCChannels</a>( <span class="keyword">volatile</span> TC0_t * tc, uint8_t enableMask )
|
||||
<a name="l00183"></a>00183 {
|
||||
<a name="l00184"></a>00184 <span class="comment">/* Make sure only CCxEN bits are set in enableMask. */</span>
|
||||
<a name="l00185"></a>00185 enableMask &= ( TC0_CCAEN_bm | TC0_CCBEN_bm | TC0_CCCEN_bm | TC0_CCDEN_bm );
|
||||
<a name="l00186"></a>00186
|
||||
<a name="l00187"></a>00187 <span class="comment">/* Enable channels. */</span>
|
||||
<a name="l00188"></a>00188 tc->CTRLB |= enableMask;
|
||||
<a name="l00189"></a>00189 }
|
||||
<a name="l00190"></a>00190
|
||||
<a name="l00207"></a><a class="code" href="TC__driver_8h.html#41d8a44ed53255f2bb991a2aab3bf031">00207</a> <span class="keywordtype">void</span> <a class="code" href="TC__driver_8c.html#41d8a44ed53255f2bb991a2aab3bf031" title="Enables compare/capture channels for Timer/Counter 1.">TC1_EnableCCChannels</a>( <span class="keyword">volatile</span> TC1_t * tc, uint8_t enableMask )
|
||||
<a name="l00208"></a>00208 {
|
||||
<a name="l00209"></a>00209 <span class="comment">/* Make sure only CCxEN bits are set in enableMask. */</span>
|
||||
<a name="l00210"></a>00210 enableMask &= ( TC1_CCAEN_bm | TC1_CCBEN_bm );
|
||||
<a name="l00211"></a>00211
|
||||
<a name="l00212"></a>00212 <span class="comment">/* Enable channels. */</span>
|
||||
<a name="l00213"></a>00213 tc->CTRLB |= enableMask;
|
||||
<a name="l00214"></a>00214 }
|
||||
<a name="l00215"></a>00215
|
||||
<a name="l00216"></a>00216
|
||||
<a name="l00232"></a><a class="code" href="TC__driver_8h.html#ec887336e135fc7f2c95532b7b2bee3f">00232</a> <span class="keywordtype">void</span> <a class="code" href="TC__driver_8c.html#ec887336e135fc7f2c95532b7b2bee3f" title="Disables compare/capture channels on Timer/Counter 0.">TC0_DisableCCChannels</a>( <span class="keyword">volatile</span> TC0_t * tc, uint8_t disableMask )
|
||||
<a name="l00233"></a>00233 {
|
||||
<a name="l00234"></a>00234 <span class="comment">/* Make sure only CCxEN bits are set in disableMask. */</span>
|
||||
<a name="l00235"></a>00235 disableMask &= ( TC0_CCAEN_bm | TC0_CCBEN_bm | TC0_CCCEN_bm | TC0_CCDEN_bm );
|
||||
<a name="l00236"></a>00236
|
||||
<a name="l00237"></a>00237 <span class="comment">/* Disable channels. */</span>
|
||||
<a name="l00238"></a>00238 tc->CTRLB &= ~disableMask;
|
||||
<a name="l00239"></a>00239 }
|
||||
<a name="l00240"></a>00240
|
||||
<a name="l00241"></a>00241
|
||||
<a name="l00255"></a><a class="code" href="TC__driver_8h.html#0573753afe3df7200cd686d84e1fded6">00255</a> <span class="keywordtype">void</span> <a class="code" href="TC__driver_8c.html#0573753afe3df7200cd686d84e1fded6" title="Disables compare/capture channels on Timer/Counter 1.">TC1_DisableCCChannels</a>( <span class="keyword">volatile</span> TC1_t * tc, uint8_t disableMask )
|
||||
<a name="l00256"></a>00256 {
|
||||
<a name="l00257"></a>00257 <span class="comment">/* Make sure only CCxEN bits are set in disableMask. */</span>
|
||||
<a name="l00258"></a>00258 disableMask &= ( TC1_CCAEN_bm | TC1_CCBEN_bm );
|
||||
<a name="l00259"></a>00259
|
||||
<a name="l00260"></a>00260 <span class="comment">/* Disable channels. */</span>
|
||||
<a name="l00261"></a>00261 tc->CTRLB &= ~disableMask;
|
||||
<a name="l00262"></a>00262 }
|
||||
<a name="l00263"></a>00263
|
||||
<a name="l00271"></a><a class="code" href="TC__driver_8h.html#5630e34078d4a93db2a655703c13c71a">00271</a> <span class="keywordtype">void</span> <a class="code" href="TC__driver_8c.html#5630e34078d4a93db2a655703c13c71a" title="Sets the overflow interrupt level.">TC0_SetOverflowIntLevel</a>( <span class="keyword">volatile</span> TC0_t * tc, TC_OVFINTLVL_t intLevel )
|
||||
<a name="l00272"></a>00272 {
|
||||
<a name="l00273"></a>00273 tc->INTCTRLA = ( tc->INTCTRLA & ~TC0_OVFINTLVL_gm ) | intLevel;
|
||||
<a name="l00274"></a>00274 }
|
||||
<a name="l00275"></a>00275
|
||||
<a name="l00276"></a>00276
|
||||
<a name="l00284"></a><a class="code" href="TC__driver_8h.html#a99bc1615bda1604c9ea7a738c1e595f">00284</a> <span class="keywordtype">void</span> <a class="code" href="TC__driver_8c.html#a99bc1615bda1604c9ea7a738c1e595f" title="Sets the overflow interrupt level.">TC1_SetOverflowIntLevel</a>( <span class="keyword">volatile</span> TC1_t * tc, TC_OVFINTLVL_t intLevel )
|
||||
<a name="l00285"></a>00285 {
|
||||
<a name="l00286"></a>00286 tc->INTCTRLA = ( tc->INTCTRLA & ~TC1_OVFINTLVL_gm ) | intLevel;
|
||||
<a name="l00287"></a>00287 }
|
||||
<a name="l00288"></a>00288
|
||||
<a name="l00289"></a>00289
|
||||
<a name="l00297"></a><a class="code" href="TC__driver_8h.html#7932285622e0f6f66821a24aa18d8892">00297</a> <span class="keywordtype">void</span> <a class="code" href="TC__driver_8c.html#7932285622e0f6f66821a24aa18d8892" title="Sets the Error interrupt level.">TC0_SetErrorIntLevel</a>( <span class="keyword">volatile</span> TC0_t * tc, TC_ERRINTLVL_t intLevel )
|
||||
<a name="l00298"></a>00298 {
|
||||
<a name="l00299"></a>00299 tc->INTCTRLA = ( tc->INTCTRLA & ~TC0_ERRINTLVL_gm ) | intLevel;
|
||||
<a name="l00300"></a>00300 }
|
||||
<a name="l00301"></a>00301
|
||||
<a name="l00302"></a>00302
|
||||
<a name="l00310"></a><a class="code" href="TC__driver_8h.html#a65e4c1ee730d914d555eeee8aee0503">00310</a> <span class="keywordtype">void</span> <a class="code" href="TC__driver_8c.html#a65e4c1ee730d914d555eeee8aee0503" title="Sets the Error interrupt level.">TC1_SetErrorIntLevel</a>( <span class="keyword">volatile</span> TC1_t * tc, TC_ERRINTLVL_t intLevel )
|
||||
<a name="l00311"></a>00311 {
|
||||
<a name="l00312"></a>00312 tc->INTCTRLA = ( tc->INTCTRLA & ~TC1_ERRINTLVL_gm ) | intLevel;
|
||||
<a name="l00313"></a>00313 }
|
||||
<a name="l00314"></a>00314
|
||||
<a name="l00315"></a>00315
|
||||
<a name="l00324"></a><a class="code" href="TC__driver_8h.html#9dc297c8345a7b55099ab0b63454e109">00324</a> <span class="keywordtype">void</span> <a class="code" href="TC__driver_8c.html#9dc297c8345a7b55099ab0b63454e109" title="Sets the interrupt level for compare/capture channel A interrupt.">TC0_SetCCAIntLevel</a>( <span class="keyword">volatile</span> TC0_t * tc, TC_CCAINTLVL_t intLevel )
|
||||
<a name="l00325"></a>00325 {
|
||||
<a name="l00326"></a>00326 tc->INTCTRLB = ( tc->INTCTRLB & ~TC0_CCAINTLVL_gm ) | intLevel;
|
||||
<a name="l00327"></a>00327 }
|
||||
<a name="l00328"></a>00328
|
||||
<a name="l00329"></a>00329
|
||||
<a name="l00338"></a><a class="code" href="TC__driver_8h.html#e26379528dcd7aa2c51407453e81b764">00338</a> <span class="keywordtype">void</span> <a class="code" href="TC__driver_8c.html#e26379528dcd7aa2c51407453e81b764" title="Sets the interrupt level for compare/capture channel A interrupt.">TC1_SetCCAIntLevel</a>( <span class="keyword">volatile</span> TC1_t * tc, TC_CCAINTLVL_t intLevel )
|
||||
<a name="l00339"></a>00339 {
|
||||
<a name="l00340"></a>00340 tc->INTCTRLB = ( tc->INTCTRLB & ~TC1_CCAINTLVL_gm ) | intLevel;
|
||||
<a name="l00341"></a>00341 }
|
||||
<a name="l00342"></a>00342
|
||||
<a name="l00343"></a>00343
|
||||
<a name="l00352"></a><a class="code" href="TC__driver_8h.html#0eb6006987f0c6c1227ae21303840380">00352</a> <span class="keywordtype">void</span> <a class="code" href="TC__driver_8c.html#0eb6006987f0c6c1227ae21303840380" title="Sets the interrupt level for compare/capture channel B interrupt.">TC0_SetCCBIntLevel</a>( <span class="keyword">volatile</span> TC0_t * tc, TC_CCBINTLVL_t intLevel )
|
||||
<a name="l00353"></a>00353 {
|
||||
<a name="l00354"></a>00354 tc->INTCTRLB = ( tc->INTCTRLB & ~TC0_CCBINTLVL_gm ) | intLevel;
|
||||
<a name="l00355"></a>00355 }
|
||||
<a name="l00356"></a>00356
|
||||
<a name="l00357"></a>00357
|
||||
<a name="l00366"></a><a class="code" href="TC__driver_8h.html#8ba5a300c68f0d88e0450aa95be0d76d">00366</a> <span class="keywordtype">void</span> <a class="code" href="TC__driver_8c.html#8ba5a300c68f0d88e0450aa95be0d76d" title="Sets the interrupt level for compare/capture channel B interrupt.">TC1_SetCCBIntLevel</a>( <span class="keyword">volatile</span> TC1_t * tc, TC_CCBINTLVL_t intLevel )
|
||||
<a name="l00367"></a>00367 {
|
||||
<a name="l00368"></a>00368 tc->INTCTRLB = ( tc->INTCTRLB & ~TC1_CCBINTLVL_gm ) | intLevel;
|
||||
<a name="l00369"></a>00369 }
|
||||
<a name="l00370"></a>00370
|
||||
<a name="l00371"></a>00371
|
||||
<a name="l00380"></a><a class="code" href="TC__driver_8h.html#1c1cbcd5f0dff77d207d95754ce9ff1f">00380</a> <span class="keywordtype">void</span> <a class="code" href="TC__driver_8c.html#1c1cbcd5f0dff77d207d95754ce9ff1f" title="Sets the interrupt level for compare/capture channel C interrupt.">TC0_SetCCCIntLevel</a>( <span class="keyword">volatile</span> TC0_t * tc, TC_CCCINTLVL_t intLevel )
|
||||
<a name="l00381"></a>00381 {
|
||||
<a name="l00382"></a>00382 tc->INTCTRLB = ( tc->INTCTRLB & ~TC0_CCCINTLVL_gm ) | intLevel;
|
||||
<a name="l00383"></a>00383 }
|
||||
<a name="l00384"></a>00384
|
||||
<a name="l00385"></a>00385
|
||||
<a name="l00394"></a><a class="code" href="TC__driver_8h.html#764c59955faaa6cd1463848330c6ea34">00394</a> <span class="keywordtype">void</span> <a class="code" href="TC__driver_8c.html#764c59955faaa6cd1463848330c6ea34" title="Sets the interrupt level for compare/capture channel D interrupt.">TC0_SetCCDIntLevel</a>( <span class="keyword">volatile</span> TC0_t * tc, TC_CCDINTLVL_t intLevel )
|
||||
<a name="l00395"></a>00395 {
|
||||
<a name="l00396"></a>00396 tc->INTCTRLB = ( tc->INTCTRLB & ~TC0_CCDINTLVL_gm ) | intLevel;
|
||||
<a name="l00397"></a>00397 }
|
||||
<a name="l00398"></a>00398
|
||||
<a name="l00399"></a>00399
|
||||
<a name="l00408"></a><a class="code" href="TC__driver_8h.html#d7b63210eec1da33632c95d26fe3fd02">00408</a> <span class="keywordtype">void</span> <a class="code" href="TC__driver_8c.html#d7b63210eec1da33632c95d26fe3fd02" title="Resets the Timer/Counter 0.">TC0_Reset</a>( <span class="keyword">volatile</span> TC0_t * tc )
|
||||
<a name="l00409"></a>00409 {
|
||||
<a name="l00410"></a>00410 <span class="comment">/* TC must be turned off before a Reset command. */</span>
|
||||
<a name="l00411"></a>00411 tc->CTRLA = ( tc->CTRLA & ~TC0_CLKSEL_gm ) | TC_CLKSEL_OFF_gc;
|
||||
<a name="l00412"></a>00412
|
||||
<a name="l00413"></a>00413 <span class="comment">/* Issue Reset command. */</span>
|
||||
<a name="l00414"></a>00414 tc->CTRLFSET = TC_CMD_RESET_gc;
|
||||
<a name="l00415"></a>00415 }
|
||||
<a name="l00416"></a>00416
|
||||
<a name="l00417"></a>00417
|
||||
<a name="l00426"></a><a class="code" href="TC__driver_8h.html#c6857a58e93965b3a74007c5c9952880">00426</a> <span class="keywordtype">void</span> <a class="code" href="TC__driver_8c.html#c6857a58e93965b3a74007c5c9952880" title="Resets the Timer/Counter 1.">TC1_Reset</a>( <span class="keyword">volatile</span> TC1_t * tc )
|
||||
<a name="l00427"></a>00427 {
|
||||
<a name="l00428"></a>00428 <span class="comment">/* TC must be turned off before a Reset command. */</span>
|
||||
<a name="l00429"></a>00429 tc->CTRLA = ( tc->CTRLA & ~TC1_CLKSEL_gm ) | TC_CLKSEL_OFF_gc;
|
||||
<a name="l00430"></a>00430
|
||||
<a name="l00431"></a>00431 <span class="comment">/* Issue Reset command. */</span>
|
||||
<a name="l00432"></a>00432 tc->CTRLFSET = TC_CMD_RESET_gc;
|
||||
<a name="l00433"></a>00433 }
|
||||
</pre></div></div>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
|
||||
<title>@DOC_TITLE@</title>
|
||||
<link href="doxygen.css" rel="stylesheet" type="text/css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<table width="100%" height="10%" bgcolor="#FFFFFF">
|
||||
<tr>
|
||||
<td colspan="6" height="1" background="blue.gif"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="6">
|
||||
<address style="align: right;"><small>
|
||||
Generated on Wed Apr 23 07:45:44 2008 for AVR1306 Using the XMEGA Timer/Counter by <a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border=0></a> 1.5.5</small></address>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,2 @@
|
||||
<area shape="rect" href="$avr__compiler_8h.html" title="This file implements some macros that makes the IAR C-compiler and avr-gcc work with..." alt="" coords="76,155,185,181">
|
||||
<area shape="rect" href="$TC__driver_8h.html" title="XMEGA Timer/Counter driver header file." alt="" coords="127,80,220,107">
|
||||
@@ -0,0 +1 @@
|
||||
f698cee9f30618884295dece710fa914
|
||||
@@ -0,0 +1,140 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
|
||||
<title>@DOC_TITLE@</title>
|
||||
<link href="doxygen.css" rel="stylesheet" type="text/css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<table width="100%" height="10%" bgcolor="#FFFFFF">
|
||||
<tr>
|
||||
<td colspan="2"><p><A href=http://www.atmel.com ><img src="atmel.jpg"/ border=0></A></p><br /></td>
|
||||
<td colspan="2"> <strong><font face="Helvetica" color="#000000" size="+3">Xmega Application Note</font></strong></td>
|
||||
<td colspan="2"><p><A href=http://www.atmel.com/products/AVR><img src="AVR_logo_blue.gif"/ border=0></A></p><br /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="6" height="1" background="blue.gif"></td>
|
||||
</tr>
|
||||
</table>
|
||||
<!-- Generated by Doxygen 1.5.5 -->
|
||||
<h1>TC_driver.h</h1><a href="TC__driver_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* This file has been prepared for Doxygen automatic documentation generation.*/</span>
|
||||
<a name="l00059"></a>00059 <span class="preprocessor">#ifndef TC_DRIVER_H</span>
|
||||
<a name="l00060"></a>00060 <span class="preprocessor"></span><span class="preprocessor">#define TC_DRIVER_H</span>
|
||||
<a name="l00061"></a>00061 <span class="preprocessor"></span>
|
||||
<a name="l00062"></a>00062 <span class="preprocessor">#include "<a class="code" href="avr__compiler_8h.html" title="This file implements some macros that makes the IAR C-compiler and avr-gcc work with...">avr_compiler.h</a>"</span>
|
||||
<a name="l00063"></a>00063
|
||||
<a name="l00064"></a>00064 <span class="comment">/* Definition of macros. */</span>
|
||||
<a name="l00065"></a>00065
|
||||
<a name="l00074"></a><a class="code" href="TC__driver_8h.html#4b1fa59d76f86ced01740b22278ba23b">00074</a> <span class="preprocessor">#define TC_EnableEventDelay( _tc ) ( (_tc)->CTRLD |= TC0_EVDLY_bm )</span>
|
||||
<a name="l00075"></a>00075 <span class="preprocessor"></span>
|
||||
<a name="l00080"></a><a class="code" href="TC__driver_8h.html#09a1d9fa80b12d69a5c6c54ac4acb568">00080</a> <span class="preprocessor">#define TC_DisableEventDelay( _tc ) ( (_tc)->CTRLD &= ~TC0_EVDLY_bm )</span>
|
||||
<a name="l00081"></a>00081 <span class="preprocessor"></span>
|
||||
<a name="l00090"></a><a class="code" href="TC__driver_8h.html#73684604998fb3a11524d2d3143bc5bf">00090</a> <span class="preprocessor">#define TC_LockCompareUpdate( _tc ) ( (_tc)->CTRLFSET = TC0_LUPD_bm )</span>
|
||||
<a name="l00091"></a>00091 <span class="preprocessor"></span>
|
||||
<a name="l00102"></a><a class="code" href="TC__driver_8h.html#5a969399e96e90ddd97ee94c487dcfe5">00102</a> <span class="preprocessor">#define TC_UnlockCompareUpdate( _tc ) ( (_tc)->CTRLFCLR = TC0_LUPD_bm )</span>
|
||||
<a name="l00103"></a>00103 <span class="preprocessor"></span>
|
||||
<a name="l00104"></a>00104
|
||||
<a name="l00114"></a><a class="code" href="TC__driver_8h.html#c585f9b311ce57ee16c1cd309e81aae2">00114</a> <span class="preprocessor">#define TC_ForceUpdate( _tc ) ( (_tc)->CTRLFSET = TC_CMD_UPDATE_gc )</span>
|
||||
<a name="l00115"></a>00115 <span class="preprocessor"></span>
|
||||
<a name="l00126"></a><a class="code" href="TC__driver_8h.html#0a837eeef0e057214725bfcd57688a7c">00126</a> <span class="preprocessor">#define TC_Restart( _tc ) ( (_tc)->CTRLFSET = TC_CMD_RESTART_gc )</span>
|
||||
<a name="l00127"></a>00127 <span class="preprocessor"></span>
|
||||
<a name="l00137"></a><a class="code" href="TC__driver_8h.html#baac6e289006eefa97dd4c1fe9d39464">00137</a> <span class="preprocessor">#define TC_SetCount( _tc, _count ) ( (_tc)->CNT = (_count) )</span>
|
||||
<a name="l00138"></a>00138 <span class="preprocessor"></span>
|
||||
<a name="l00148"></a><a class="code" href="TC__driver_8h.html#4faaf2813b83a03cd6d3720fa884bfe4">00148</a> <span class="preprocessor">#define TC_SetPeriod( _tc, _period ) ( (_tc)->PER = (_period) )</span>
|
||||
<a name="l00149"></a>00149 <span class="preprocessor"></span>
|
||||
<a name="l00158"></a><a class="code" href="TC__driver_8h.html#aebcc08be007b67a2d0b001e44d077b7">00158</a> <span class="preprocessor">#define TC_SetPeriodBuffered( _tc, _period ) ( (_tc)->PERBUF = (_period) )</span>
|
||||
<a name="l00159"></a>00159 <span class="preprocessor"></span>
|
||||
<a name="l00169"></a><a class="code" href="TC__driver_8h.html#11829e0c86eba6c2f20351060fa3c1b2">00169</a> <span class="preprocessor">#define TC_SetCompareA( _tc, _compareValue ) ( (_tc)->CCABUF = (_compareValue) )</span>
|
||||
<a name="l00170"></a>00170 <span class="preprocessor"></span>
|
||||
<a name="l00180"></a><a class="code" href="TC__driver_8h.html#fdb25320eb2c2d824aee058650b7e9f1">00180</a> <span class="preprocessor">#define TC_SetCompareB( _tc, _compareValue ) ( (_tc)->CCBBUF = (_compareValue) )</span>
|
||||
<a name="l00181"></a>00181 <span class="preprocessor"></span>
|
||||
<a name="l00193"></a><a class="code" href="TC__driver_8h.html#c68c401778ed8dea4c24706c48b1fe3e">00193</a> <span class="preprocessor">#define TC_SetCompareC( _tc, _compareValue ) ( (_tc)->CCCBUF = (_compareValue) )</span>
|
||||
<a name="l00194"></a>00194 <span class="preprocessor"></span>
|
||||
<a name="l00206"></a><a class="code" href="TC__driver_8h.html#eb6a2da8eb30b2e2457a4f4d959cc546">00206</a> <span class="preprocessor">#define TC_SetCompareD( _tc, _compareValue ) ( (_tc)->CCDBUF = (_compareValue) )</span>
|
||||
<a name="l00207"></a>00207 <span class="preprocessor"></span>
|
||||
<a name="l00216"></a><a class="code" href="TC__driver_8h.html#41ba6e4bbe21de7dfcc85146835858e9">00216</a> <span class="preprocessor">#define TC_GetOverflowFlag( _tc ) ( (_tc)->INTFLAGS & TC0_OVFIF_bm )</span>
|
||||
<a name="l00217"></a>00217 <span class="preprocessor"></span>
|
||||
<a name="l00224"></a><a class="code" href="TC__driver_8h.html#edc4d516e9f796432730cc7fa61e81d9">00224</a> <span class="preprocessor">#define TC_ClearOverflowFlag( _tc ) ( (_tc)->INTFLAGS = TC0_OVFIF_bm )</span>
|
||||
<a name="l00225"></a>00225 <span class="preprocessor"></span>
|
||||
<a name="l00234"></a><a class="code" href="TC__driver_8h.html#35d45f4d1b006672ac430901536347f5">00234</a> <span class="preprocessor">#define TC_GetErrorFlag( _tc ) ( (_tc)->INTFLAGS & TC0_ERRIF_bm )</span>
|
||||
<a name="l00235"></a>00235 <span class="preprocessor"></span>
|
||||
<a name="l00242"></a><a class="code" href="TC__driver_8h.html#da5a426aca38d12a362695f0941e460e">00242</a> <span class="preprocessor">#define TC_ClearErrorFlag( _tc ) ( (_tc)->INTFLAGS = TC0_ERRIF_bm )</span>
|
||||
<a name="l00243"></a>00243 <span class="preprocessor"></span>
|
||||
<a name="l00258"></a><a class="code" href="TC__driver_8h.html#5b1d20f74d1a3083b536f27017f45767">00258</a> <span class="preprocessor">#define TC_GetCCAFlag( _tc ) ( (_tc)->INTFLAGS & TC0_CCAIF_bm )</span>
|
||||
<a name="l00259"></a>00259 <span class="preprocessor"></span>
|
||||
<a name="l00264"></a><a class="code" href="TC__driver_8h.html#0ed6eaa40a0f5b5b3322ce48166bee16">00264</a> <span class="preprocessor">#define TC_ClearCCAFlag( _tc ) ( (_tc)->INTFLAGS = TC0_CCAIF_bm )</span>
|
||||
<a name="l00265"></a>00265 <span class="preprocessor"></span>
|
||||
<a name="l00280"></a><a class="code" href="TC__driver_8h.html#e126b7a72512efa058c21dfc1ad6c6e1">00280</a> <span class="preprocessor">#define TC_GetCCBFlag( _tc ) ( (_tc)->INTFLAGS & TC0_CCBIF_bm )</span>
|
||||
<a name="l00281"></a>00281 <span class="preprocessor"></span>
|
||||
<a name="l00286"></a><a class="code" href="TC__driver_8h.html#76d044a29d90a5ac7f28204b5eaae65c">00286</a> <span class="preprocessor">#define TC_ClearCCBFlag( _tc ) ( (_tc)->INTFLAGS = TC0_CCBIF_bm )</span>
|
||||
<a name="l00287"></a>00287 <span class="preprocessor"></span>
|
||||
<a name="l00304"></a><a class="code" href="TC__driver_8h.html#7497125c7b6c8ef02b8d75ba6b811254">00304</a> <span class="preprocessor">#define TC_GetCCCFlag( _tc ) ( (_tc)->INTFLAGS & TC0_CCCIF_bm )</span>
|
||||
<a name="l00305"></a>00305 <span class="preprocessor"></span>
|
||||
<a name="l00314"></a><a class="code" href="TC__driver_8h.html#548e3d1742703a2ca51a7a957302741b">00314</a> <span class="preprocessor">#define TC_ClearCCCFlag( _tc ) ( (_tc)->INTFLAGS = TC0_CCCIF_bm )</span>
|
||||
<a name="l00315"></a>00315 <span class="preprocessor"></span>
|
||||
<a name="l00332"></a><a class="code" href="TC__driver_8h.html#444c6e56839302d35cd1fdcdb7c41001">00332</a> <span class="preprocessor">#define TC_GetCCDFlag( _tc ) ( (_tc)->INTFLAGS & TC0_CCDIF_bm )</span>
|
||||
<a name="l00333"></a>00333 <span class="preprocessor"></span>
|
||||
<a name="l00342"></a><a class="code" href="TC__driver_8h.html#2e059c95fdd9b233a8d3c99ddf433b5c">00342</a> <span class="preprocessor">#define TC_ClearCCDFlag( _tc ) ( (_tc)->INTFLAGS = TC0_CCDIF_bm )</span>
|
||||
<a name="l00343"></a>00343 <span class="preprocessor"></span>
|
||||
<a name="l00344"></a>00344
|
||||
<a name="l00354"></a><a class="code" href="TC__driver_8h.html#047c98cc70b77b9133143155a575a2db">00354</a> <span class="preprocessor">#define TC_GetCaptureA( _tc ) ( (_tc)->CCA )</span>
|
||||
<a name="l00355"></a>00355 <span class="preprocessor"></span>
|
||||
<a name="l00365"></a><a class="code" href="TC__driver_8h.html#3eeb1ab0f3f2d536de4164628780fb78">00365</a> <span class="preprocessor">#define TC_GetCaptureB( _tc ) ( (_tc)->CCB )</span>
|
||||
<a name="l00366"></a>00366 <span class="preprocessor"></span>
|
||||
<a name="l00378"></a><a class="code" href="TC__driver_8h.html#72ef542e1bce10b16d89e3182750fc3c">00378</a> <span class="preprocessor">#define TC_GetCaptureC( _tc ) ( (_tc)->CCC )</span>
|
||||
<a name="l00379"></a>00379 <span class="preprocessor"></span>
|
||||
<a name="l00391"></a><a class="code" href="TC__driver_8h.html#e71f41fdf7aacb64d3b09609781669e5">00391</a> <span class="preprocessor">#define TC_GetCaptureD( _tc ) ( (_tc)->CCD )</span>
|
||||
<a name="l00392"></a>00392 <span class="preprocessor"></span>
|
||||
<a name="l00393"></a>00393
|
||||
<a name="l00394"></a>00394 <span class="comment">/* Prototyping of functions. Documentation can be found in source file. */</span>
|
||||
<a name="l00395"></a>00395
|
||||
<a name="l00396"></a>00396 <span class="keywordtype">void</span> <a class="code" href="TC__driver_8c.html#1a5b3ccf2b872dcdf8f4162e5cdc6e81" title="Configures clock source for the Timer/Counter 0.">TC0_ConfigClockSource</a>( <span class="keyword">volatile</span> TC0_t * tc, TC_CLKSEL_t clockSelection );
|
||||
<a name="l00397"></a>00397 <span class="keywordtype">void</span> <a class="code" href="TC__driver_8c.html#45e98ab822bfcd2e284c13fddac90f32" title="Configures the Waveform Generation Mode for the Timer/Counter 0.">TC0_ConfigWGM</a>( <span class="keyword">volatile</span> TC0_t * tc, TC_WGMODE_t wgm );
|
||||
<a name="l00398"></a>00398 <span class="keywordtype">void</span> <a class="code" href="TC__driver_8c.html#309a2ca4eaf39437b57ca13edb23b70b" title="Configures the Timer/Counter 0 for input capture operation.">TC0_ConfigInputCapture</a>( <span class="keyword">volatile</span> TC0_t * tc, TC_EVSEL_t eventSource );
|
||||
<a name="l00399"></a>00399 <span class="keywordtype">void</span> <a class="code" href="TC__driver_8c.html#e6b05576247ef4109e9249ea4f8e6b28" title="Enables compare/capture channels for Timer/Counter 0.">TC0_EnableCCChannels</a>( <span class="keyword">volatile</span> TC0_t * tc, uint8_t enableMask );
|
||||
<a name="l00400"></a>00400 <span class="keywordtype">void</span> <a class="code" href="TC__driver_8c.html#ec887336e135fc7f2c95532b7b2bee3f" title="Disables compare/capture channels on Timer/Counter 0.">TC0_DisableCCChannels</a>( <span class="keyword">volatile</span> TC0_t * tc, uint8_t disableMask );
|
||||
<a name="l00401"></a>00401 <span class="keywordtype">void</span> <a class="code" href="TC__driver_8c.html#5630e34078d4a93db2a655703c13c71a" title="Sets the overflow interrupt level.">TC0_SetOverflowIntLevel</a>( <span class="keyword">volatile</span> TC0_t * tc, TC_OVFINTLVL_t intLevel );
|
||||
<a name="l00402"></a>00402 <span class="keywordtype">void</span> <a class="code" href="TC__driver_8c.html#7932285622e0f6f66821a24aa18d8892" title="Sets the Error interrupt level.">TC0_SetErrorIntLevel</a>( <span class="keyword">volatile</span> TC0_t * tc, TC_ERRINTLVL_t intLevel );
|
||||
<a name="l00403"></a>00403 <span class="keywordtype">void</span> <a class="code" href="TC__driver_8c.html#9dc297c8345a7b55099ab0b63454e109" title="Sets the interrupt level for compare/capture channel A interrupt.">TC0_SetCCAIntLevel</a>( <span class="keyword">volatile</span> TC0_t * tc, TC_CCAINTLVL_t intLevel );
|
||||
<a name="l00404"></a>00404 <span class="keywordtype">void</span> <a class="code" href="TC__driver_8c.html#0eb6006987f0c6c1227ae21303840380" title="Sets the interrupt level for compare/capture channel B interrupt.">TC0_SetCCBIntLevel</a>( <span class="keyword">volatile</span> TC0_t * tc, TC_CCBINTLVL_t intLevel );
|
||||
<a name="l00405"></a>00405 <span class="keywordtype">void</span> <a class="code" href="TC__driver_8c.html#1c1cbcd5f0dff77d207d95754ce9ff1f" title="Sets the interrupt level for compare/capture channel C interrupt.">TC0_SetCCCIntLevel</a>( <span class="keyword">volatile</span> TC0_t * tc, TC_CCCINTLVL_t intLevel );
|
||||
<a name="l00406"></a>00406 <span class="keywordtype">void</span> <a class="code" href="TC__driver_8c.html#764c59955faaa6cd1463848330c6ea34" title="Sets the interrupt level for compare/capture channel D interrupt.">TC0_SetCCDIntLevel</a>( <span class="keyword">volatile</span> TC0_t * tc, TC_CCDINTLVL_t intLevel );
|
||||
<a name="l00407"></a>00407 <span class="keywordtype">void</span> <a class="code" href="TC__driver_8c.html#d7b63210eec1da33632c95d26fe3fd02" title="Resets the Timer/Counter 0.">TC0_Reset</a>( <span class="keyword">volatile</span> TC0_t * tc );
|
||||
<a name="l00408"></a>00408
|
||||
<a name="l00409"></a>00409 <span class="keywordtype">void</span> <a class="code" href="TC__driver_8c.html#ef27c3126f89d13b02732de352bff21f" title="Configures clock source for the Timer/Counter 1.">TC1_ConfigClockSource</a>( <span class="keyword">volatile</span> TC1_t * tc, TC_CLKSEL_t clockSelection );
|
||||
<a name="l00410"></a>00410 <span class="keywordtype">void</span> <a class="code" href="TC__driver_8c.html#ea811f24d3ebc34c561eb648f2952314" title="Configures the Waveform Generation Mode for the Timer/Counter 1.">TC1_ConfigWGM</a>( <span class="keyword">volatile</span> TC1_t * tc, TC_WGMODE_t wgm );
|
||||
<a name="l00411"></a>00411 <span class="keywordtype">void</span> <a class="code" href="TC__driver_8c.html#8d41d6b130f6fd3928e8198e9bf9512b" title="Configures the Timer/Counter 1 for input capture operation.">TC1_ConfigInputCapture</a>( <span class="keyword">volatile</span> TC1_t * tc, TC_EVSEL_t eventSource );
|
||||
<a name="l00412"></a>00412 <span class="keywordtype">void</span> <a class="code" href="TC__driver_8c.html#41d8a44ed53255f2bb991a2aab3bf031" title="Enables compare/capture channels for Timer/Counter 1.">TC1_EnableCCChannels</a>( <span class="keyword">volatile</span> TC1_t * tc, uint8_t enableMask );
|
||||
<a name="l00413"></a>00413 <span class="keywordtype">void</span> <a class="code" href="TC__driver_8c.html#0573753afe3df7200cd686d84e1fded6" title="Disables compare/capture channels on Timer/Counter 1.">TC1_DisableCCChannels</a>( <span class="keyword">volatile</span> TC1_t * tc, uint8_t disableMask );
|
||||
<a name="l00414"></a>00414 <span class="keywordtype">void</span> <a class="code" href="TC__driver_8c.html#a99bc1615bda1604c9ea7a738c1e595f" title="Sets the overflow interrupt level.">TC1_SetOverflowIntLevel</a>( <span class="keyword">volatile</span> TC1_t * tc, TC_OVFINTLVL_t intLevel );
|
||||
<a name="l00415"></a>00415 <span class="keywordtype">void</span> <a class="code" href="TC__driver_8c.html#a65e4c1ee730d914d555eeee8aee0503" title="Sets the Error interrupt level.">TC1_SetErrorIntLevel</a>( <span class="keyword">volatile</span> TC1_t * tc, TC_ERRINTLVL_t intLevel );
|
||||
<a name="l00416"></a>00416 <span class="keywordtype">void</span> <a class="code" href="TC__driver_8c.html#e26379528dcd7aa2c51407453e81b764" title="Sets the interrupt level for compare/capture channel A interrupt.">TC1_SetCCAIntLevel</a>( <span class="keyword">volatile</span> TC1_t * tc, TC_CCAINTLVL_t intLevel );
|
||||
<a name="l00417"></a>00417 <span class="keywordtype">void</span> <a class="code" href="TC__driver_8c.html#8ba5a300c68f0d88e0450aa95be0d76d" title="Sets the interrupt level for compare/capture channel B interrupt.">TC1_SetCCBIntLevel</a>( <span class="keyword">volatile</span> TC1_t * tc, TC_CCBINTLVL_t intLevel );
|
||||
<a name="l00418"></a>00418 <span class="keywordtype">void</span> <a class="code" href="TC__driver_8h.html#cbb8bcb56ffae6f884e49adbafd93128">TC1_SetCCCIntLevel</a>( <span class="keyword">volatile</span> TC1_t * tc, TC_CCCINTLVL_t intLevel );
|
||||
<a name="l00419"></a>00419 <span class="keywordtype">void</span> <a class="code" href="TC__driver_8h.html#3db14d65afb9ea1f2cf7131333be9451">TC1_SetCCDIntLevel</a>( <span class="keyword">volatile</span> TC1_t * tc, TC_CCDINTLVL_t intLevel );
|
||||
<a name="l00420"></a>00420 <span class="keywordtype">void</span> <a class="code" href="TC__driver_8c.html#c6857a58e93965b3a74007c5c9952880" title="Resets the Timer/Counter 1.">TC1_Reset</a>( <span class="keyword">volatile</span> TC1_t * tc );
|
||||
<a name="l00421"></a>00421
|
||||
<a name="l00422"></a>00422
|
||||
<a name="l00423"></a>00423 <span class="preprocessor">#endif</span>
|
||||
</pre></div></div>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
|
||||
<title>@DOC_TITLE@</title>
|
||||
<link href="doxygen.css" rel="stylesheet" type="text/css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<table width="100%" height="10%" bgcolor="#FFFFFF">
|
||||
<tr>
|
||||
<td colspan="6" height="1" background="blue.gif"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="6">
|
||||
<address style="align: right;"><small>
|
||||
Generated on Wed Apr 23 07:45:44 2008 for AVR1306 Using the XMEGA Timer/Counter by <a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border=0></a> 1.5.5</small></address>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,2 @@
|
||||
<area shape="rect" href="$TC__driver_8c.html" title="XMEGA Timer/Counter driver source file." alt="" coords="5,80,96,107">
|
||||
<area shape="rect" href="$TC__example_8c.html" title="XMEGA Timer/Counter example source file." alt="" coords="120,80,229,107">
|
||||
@@ -0,0 +1 @@
|
||||
1983c6dd644dcc6a4752213f5d968f41
|
||||
@@ -0,0 +1 @@
|
||||
<area shape="rect" href="$avr__compiler_8h.html" title="This file implements some macros that makes the IAR C-compiler and avr-gcc work with..." alt="" coords="76,80,185,107">
|
||||
@@ -0,0 +1 @@
|
||||
140179123767adb1967c7225fbd24476
|
||||
@@ -0,0 +1,306 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
|
||||
<title>@DOC_TITLE@</title>
|
||||
<link href="doxygen.css" rel="stylesheet" type="text/css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<table width="100%" height="10%" bgcolor="#FFFFFF">
|
||||
<tr>
|
||||
<td colspan="2"><p><A href=http://www.atmel.com ><img src="atmel.jpg"/ border=0></A></p><br /></td>
|
||||
<td colspan="2"> <strong><font face="Helvetica" color="#000000" size="+3">Xmega Application Note</font></strong></td>
|
||||
<td colspan="2"><p><A href=http://www.atmel.com/products/AVR><img src="AVR_logo_blue.gif"/ border=0></A></p><br /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="6" height="1" background="blue.gif"></td>
|
||||
</tr>
|
||||
</table>
|
||||
<!-- Generated by Doxygen 1.5.5 -->
|
||||
<h1>TC_example.c</h1><a href="TC__example_8c.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* This file has been prepared for Doxygen automatic documentation generation.*/</span>
|
||||
<a name="l00050"></a>00050 <span class="comment">/* Definition of the CPU clock speed and TC prescaler setting. */</span>
|
||||
<a name="l00051"></a><a class="code" href="TC__example_8c.html#43bafb28b29491ec7f871319b5a3b2f8">00051</a> <span class="preprocessor">#define F_CPU 2000000UL</span>
|
||||
<a name="l00052"></a><a class="code" href="TC__example_8c.html#945ebdbcd5f4e6a81f5ab930fd046cd5">00052</a> <span class="preprocessor"></span><span class="preprocessor">#define CPU_PRESCALER 1</span>
|
||||
<a name="l00053"></a>00053 <span class="preprocessor"></span>
|
||||
<a name="l00054"></a>00054 <span class="preprocessor">#include "<a class="code" href="avr__compiler_8h.html" title="This file implements some macros that makes the IAR C-compiler and avr-gcc work with...">avr_compiler.h</a>"</span>
|
||||
<a name="l00055"></a>00055 <span class="preprocessor">#include "<a class="code" href="TC__driver_8h.html" title="XMEGA Timer/Counter driver header file.">TC_driver.h</a>"</span>
|
||||
<a name="l00056"></a>00056
|
||||
<a name="l00057"></a>00057 <span class="comment">/* Prototyping of functions. */</span>
|
||||
<a name="l00058"></a>00058 <span class="keywordtype">void</span> <a class="code" href="TC__example_8c.html#b899c7aa870825aec068df494bbfd714" title="This example shows how to configure TCC0 for basic timer operation.">Example1</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00059"></a>00059 <span class="keywordtype">void</span> <a class="code" href="TC__example_8c.html#7d5465d0142c58a86789deec41d3436a" title="This function shows how to use the Input Capture functionality.">Example2</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00060"></a>00060 <span class="keywordtype">void</span> <a class="code" href="TC__example_8c.html#1678698677906bbe98f830ba470905a3" title="This example shows how to configure TCC0 for measurement of Frequency and Duty cycle...">Example3</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00061"></a>00061 <span class="keywordtype">void</span> <a class="code" href="TC__example_8c.html#6efa69f5cda8cc01efb9cb61701e5f54" title="This example shows how to configure TCC0 for pulse width modulation output with varying...">Example4</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00062"></a>00062 <span class="keywordtype">void</span> <a class="code" href="TC__example_8c.html#bda6c77ac6c320173195b6371eba5a5b" title="This example shows how to configure TCC0 to count events.">Example5</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00063"></a>00063 <span class="keywordtype">void</span> <a class="code" href="TC__example_8c.html#f66b2c4ef70a32b9596a9442439a4dc2" title="This example shows how to configure Timer/Counter for 32-bit counting with input...">Example6</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00064"></a>00064
|
||||
<a name="l00065"></a>00065
|
||||
<a name="l00066"></a>00066 <span class="comment">/* \brief This is the main function for executing one of the examples.</span>
|
||||
<a name="l00067"></a>00067 <span class="comment"> *</span>
|
||||
<a name="l00068"></a>00068 <span class="comment"> * Uncomment one of the function calls to show the example.</span>
|
||||
<a name="l00069"></a>00069 <span class="comment"> */</span>
|
||||
<a name="l00070"></a><a class="code" href="TC__example_8c.html#840291bc02cba5474a4cb46a9b9566fe">00070</a> <span class="keywordtype">int</span> <a class="code" href="TC__example_8c.html#840291bc02cba5474a4cb46a9b9566fe">main</a>( <span class="keywordtype">void</span> )
|
||||
<a name="l00071"></a>00071 {
|
||||
<a name="l00072"></a>00072 <a class="code" href="TC__example_8c.html#b899c7aa870825aec068df494bbfd714" title="This example shows how to configure TCC0 for basic timer operation.">Example1</a>();
|
||||
<a name="l00073"></a>00073 <span class="comment">/*Example2();*/</span>
|
||||
<a name="l00074"></a>00074 <span class="comment">/*Example3();*/</span>
|
||||
<a name="l00075"></a>00075 <span class="comment">/*Example4();*/</span>
|
||||
<a name="l00076"></a>00076 <span class="comment">/*Example5();*/</span>
|
||||
<a name="l00077"></a>00077 <span class="comment">/*Example6();*/</span>
|
||||
<a name="l00078"></a>00078 }
|
||||
<a name="l00079"></a>00079
|
||||
<a name="l00080"></a>00080
|
||||
<a name="l00086"></a><a class="code" href="TC__example_8c.html#b899c7aa870825aec068df494bbfd714">00086</a> <span class="keywordtype">void</span> <a class="code" href="TC__example_8c.html#b899c7aa870825aec068df494bbfd714" title="This example shows how to configure TCC0 for basic timer operation.">Example1</a>( <span class="keywordtype">void</span> )
|
||||
<a name="l00087"></a>00087 {
|
||||
<a name="l00088"></a>00088 <span class="comment">/* Set period/TOP value. */</span>
|
||||
<a name="l00089"></a>00089 <a class="code" href="TC__driver_8h.html#4faaf2813b83a03cd6d3720fa884bfe4" title="Sets the timer period.">TC_SetPeriod</a>( &TCC0, 0x1000 );
|
||||
<a name="l00090"></a>00090
|
||||
<a name="l00091"></a>00091 <span class="comment">/* Select clock source. */</span>
|
||||
<a name="l00092"></a>00092 <a class="code" href="TC__driver_8c.html#1a5b3ccf2b872dcdf8f4162e5cdc6e81" title="Configures clock source for the Timer/Counter 0.">TC0_ConfigClockSource</a>( &TCC0, TC_CLKSEL_DIV1_gc );
|
||||
<a name="l00093"></a>00093
|
||||
<a name="l00094"></a>00094 <span class="keywordflow">do</span> {
|
||||
<a name="l00095"></a>00095 <span class="comment">/* Wait while the timer counts. */</span>
|
||||
<a name="l00096"></a>00096 } <span class="keywordflow">while</span> (1);
|
||||
<a name="l00097"></a>00097 }
|
||||
<a name="l00098"></a>00098
|
||||
<a name="l00099"></a>00099
|
||||
<a name="l00106"></a><a class="code" href="TC__example_8c.html#7d5465d0142c58a86789deec41d3436a">00106</a> <span class="keywordtype">void</span> <a class="code" href="TC__example_8c.html#7d5465d0142c58a86789deec41d3436a" title="This function shows how to use the Input Capture functionality.">Example2</a>( <span class="keywordtype">void</span> )
|
||||
<a name="l00107"></a>00107 {
|
||||
<a name="l00108"></a>00108 uint16_t inputCaptureTime;
|
||||
<a name="l00109"></a>00109
|
||||
<a name="l00110"></a>00110 <span class="comment">/* Configure PC0 for input, triggered on falling edge. */</span>
|
||||
<a name="l00111"></a>00111 PORTC.PIN0CTRL = PORT_ISC_FALLING_gc;
|
||||
<a name="l00112"></a>00112 PORTC.DIRCLR = 0x01;
|
||||
<a name="l00113"></a>00113
|
||||
<a name="l00114"></a>00114 <span class="comment">/* Configure Port D for output. */</span>
|
||||
<a name="l00115"></a>00115 PORTD.DIRSET = 0xFF;
|
||||
<a name="l00116"></a>00116
|
||||
<a name="l00117"></a>00117 <span class="comment">/* Select PC0 as input to event channel 2. */</span>
|
||||
<a name="l00118"></a>00118 EVSYS.CH2MUX = EVSYS_CHMUX_PORTC_PIN0_gc;
|
||||
<a name="l00119"></a>00119
|
||||
<a name="l00120"></a>00120 <span class="comment">/* Configure TCC0 for Input Capture using event channel 2. */</span>
|
||||
<a name="l00121"></a>00121 <a class="code" href="TC__driver_8c.html#309a2ca4eaf39437b57ca13edb23b70b" title="Configures the Timer/Counter 0 for input capture operation.">TC0_ConfigInputCapture</a>( &TCC0, TC_EVSEL_CH2_gc );
|
||||
<a name="l00122"></a>00122
|
||||
<a name="l00123"></a>00123 <span class="comment">/* Enable Input Capture channel A. */</span>
|
||||
<a name="l00124"></a>00124 <a class="code" href="TC__driver_8c.html#e6b05576247ef4109e9249ea4f8e6b28" title="Enables compare/capture channels for Timer/Counter 0.">TC0_EnableCCChannels</a>( &TCC0, TC0_CCAEN_bm );
|
||||
<a name="l00125"></a>00125
|
||||
<a name="l00126"></a>00126 <span class="comment">/* Start timer by selecting a clock source. */</span>
|
||||
<a name="l00127"></a>00127 <a class="code" href="TC__driver_8c.html#1a5b3ccf2b872dcdf8f4162e5cdc6e81" title="Configures clock source for the Timer/Counter 0.">TC0_ConfigClockSource</a>( &TCC0, TC_CLKSEL_DIV1_gc );
|
||||
<a name="l00128"></a>00128
|
||||
<a name="l00129"></a>00129 <span class="keywordflow">do</span> {
|
||||
<a name="l00130"></a>00130 <span class="keywordflow">do</span> {
|
||||
<a name="l00131"></a>00131 <span class="comment">/* Wait for Input Capture. */</span>
|
||||
<a name="l00132"></a>00132 } <span class="keywordflow">while</span> ( <a class="code" href="TC__driver_8h.html#5b1d20f74d1a3083b536f27017f45767" title="Get the status for Compare or Capture channel A.">TC_GetCCAFlag</a>( &TCC0 ) == 0 );
|
||||
<a name="l00133"></a>00133
|
||||
<a name="l00134"></a>00134 inputCaptureTime = <a class="code" href="TC__driver_8h.html#047c98cc70b77b9133143155a575a2db" title="Reads the first available input capture value for channel A.">TC_GetCaptureA</a>( &TCC0 );
|
||||
<a name="l00135"></a>00135 PORTD.OUT = (uint8_t) (inputCaptureTime >> 8);
|
||||
<a name="l00136"></a>00136 } <span class="keywordflow">while</span> (1);
|
||||
<a name="l00137"></a>00137 }
|
||||
<a name="l00138"></a>00138
|
||||
<a name="l00139"></a>00139
|
||||
<a name="l00147"></a><a class="code" href="TC__example_8c.html#1678698677906bbe98f830ba470905a3">00147</a> <span class="keywordtype">void</span> <a class="code" href="TC__example_8c.html#1678698677906bbe98f830ba470905a3" title="This example shows how to configure TCC0 for measurement of Frequency and Duty cycle...">Example3</a>( <span class="keywordtype">void</span> )
|
||||
<a name="l00148"></a>00148 {
|
||||
<a name="l00149"></a>00149 <span class="comment">/* Configure PC0 for input, triggered on both edges. */</span>
|
||||
<a name="l00150"></a>00150 PORTC.PIN0CTRL = PORT_ISC_BOTHEDGES_gc;
|
||||
<a name="l00151"></a>00151 PORTC.DIRCLR = 0x01;
|
||||
<a name="l00152"></a>00152
|
||||
<a name="l00153"></a>00153 <span class="comment">/* Select PC0 as input to event channel 0. */</span>
|
||||
<a name="l00154"></a>00154 EVSYS.CH0MUX = EVSYS_CHMUX_PORTC_PIN0_gc;
|
||||
<a name="l00155"></a>00155
|
||||
<a name="l00156"></a>00156 <span class="comment">/* Configure TCC0 for Input Capture using event channel 2. */</span>
|
||||
<a name="l00157"></a>00157 <a class="code" href="TC__driver_8c.html#309a2ca4eaf39437b57ca13edb23b70b" title="Configures the Timer/Counter 0 for input capture operation.">TC0_ConfigInputCapture</a>( &TCC0, TC_EVSEL_CH0_gc );
|
||||
<a name="l00158"></a>00158
|
||||
<a name="l00159"></a>00159 <span class="comment">/* Enable Input "Capture or Compare" channel A. */</span>
|
||||
<a name="l00160"></a>00160 <a class="code" href="TC__driver_8c.html#e6b05576247ef4109e9249ea4f8e6b28" title="Enables compare/capture channels for Timer/Counter 0.">TC0_EnableCCChannels</a>( &TCC0, TC0_CCAEN_bm );
|
||||
<a name="l00161"></a>00161
|
||||
<a name="l00162"></a>00162 <span class="comment">/* Clear MSB of PER[H:L] to allow for propagation of edge polarity. */</span>
|
||||
<a name="l00163"></a>00163 <a class="code" href="TC__driver_8h.html#4faaf2813b83a03cd6d3720fa884bfe4" title="Sets the timer period.">TC_SetPeriod</a>( &TCC0, 0x7FFF );
|
||||
<a name="l00164"></a>00164
|
||||
<a name="l00165"></a>00165 <span class="comment">/* Start timer by selecting a clock source. */</span>
|
||||
<a name="l00166"></a>00166 <a class="code" href="TC__driver_8c.html#1a5b3ccf2b872dcdf8f4162e5cdc6e81" title="Configures clock source for the Timer/Counter 0.">TC0_ConfigClockSource</a>( &TCC0, TC_CLKSEL_DIV1_gc );
|
||||
<a name="l00167"></a>00167
|
||||
<a name="l00168"></a>00168 <span class="comment">/* Enable CCA interrupt. */</span>
|
||||
<a name="l00169"></a>00169 <a class="code" href="TC__driver_8c.html#9dc297c8345a7b55099ab0b63454e109" title="Sets the interrupt level for compare/capture channel A interrupt.">TC0_SetCCAIntLevel</a>( &TCC0, TC_CCAINTLVL_LO_gc );
|
||||
<a name="l00170"></a>00170 PMIC.CTRL |= PMIC_LOLVLEN_bm;
|
||||
<a name="l00171"></a>00171
|
||||
<a name="l00172"></a>00172 sei();
|
||||
<a name="l00173"></a>00173
|
||||
<a name="l00174"></a>00174 <span class="keywordflow">do</span> {
|
||||
<a name="l00175"></a>00175 <span class="comment">/* Wait while interrupt measure Frequency and Duty cycle. */</span>
|
||||
<a name="l00176"></a>00176 } <span class="keywordflow">while</span> (1);
|
||||
<a name="l00177"></a>00177 }
|
||||
<a name="l00178"></a>00178
|
||||
<a name="l00179"></a>00179
|
||||
<a name="l00180"></a><a class="code" href="TC__example_8c.html#0763252836531eeb42258e71bf9710be">00180</a> <a class="code" href="TC__example_8c.html#0763252836531eeb42258e71bf9710be">ISR</a>(TCC0_CCA_vect)
|
||||
<a name="l00181"></a>00181 {
|
||||
<a name="l00182"></a>00182 <span class="keyword">static</span> uint32_t frequency;
|
||||
<a name="l00183"></a>00183 <span class="keyword">static</span> uint32_t dutyCycle;
|
||||
<a name="l00184"></a>00184 <span class="keyword">static</span> uint16_t totalPeriod;
|
||||
<a name="l00185"></a>00185 <span class="keyword">static</span> uint16_t highPeriod;
|
||||
<a name="l00186"></a>00186
|
||||
<a name="l00187"></a>00187 uint16_t thisCapture = <a class="code" href="TC__driver_8h.html#047c98cc70b77b9133143155a575a2db" title="Reads the first available input capture value for channel A.">TC_GetCaptureA</a>( &TCC0 );
|
||||
<a name="l00188"></a>00188
|
||||
<a name="l00189"></a>00189 <span class="comment">/* Save total period based on rising edge and reset counter. */</span>
|
||||
<a name="l00190"></a>00190 <span class="keywordflow">if</span> ( thisCapture & 0x8000 ) {
|
||||
<a name="l00191"></a>00191 totalPeriod = thisCapture & 0x7FFF;
|
||||
<a name="l00192"></a>00192 <a class="code" href="TC__driver_8h.html#0a837eeef0e057214725bfcd57688a7c" title="Restart the Timer/Counter.">TC_Restart</a>( &TCC0 );
|
||||
<a name="l00193"></a>00193 }
|
||||
<a name="l00194"></a>00194 <span class="comment">/* Calculate duty cycle based on time from reset and falling edge. */</span>
|
||||
<a name="l00195"></a>00195 <span class="keywordflow">else</span> {
|
||||
<a name="l00196"></a>00196 highPeriod = thisCapture;
|
||||
<a name="l00197"></a>00197 }
|
||||
<a name="l00198"></a>00198
|
||||
<a name="l00199"></a>00199 dutyCycle = ( ( ( highPeriod * 100 ) / totalPeriod ) + dutyCycle ) / 2;
|
||||
<a name="l00200"></a>00200 frequency = ( ( ( <a class="code" href="avr__compiler_8h.html#43bafb28b29491ec7f871319b5a3b2f8" title="Define default CPU frequency, if this is not already defined.">F_CPU</a> / <a class="code" href="TC__example_8c.html#945ebdbcd5f4e6a81f5ab930fd046cd5">CPU_PRESCALER</a> ) / totalPeriod ) + frequency ) / 2;
|
||||
<a name="l00201"></a>00201 }
|
||||
<a name="l00202"></a>00202
|
||||
<a name="l00203"></a>00203
|
||||
<a name="l00210"></a><a class="code" href="TC__example_8c.html#6efa69f5cda8cc01efb9cb61701e5f54">00210</a> <span class="keywordtype">void</span> <a class="code" href="TC__example_8c.html#6efa69f5cda8cc01efb9cb61701e5f54" title="This example shows how to configure TCC0 for pulse width modulation output with varying...">Example4</a>( <span class="keywordtype">void</span> )
|
||||
<a name="l00211"></a>00211 {
|
||||
<a name="l00212"></a>00212 uint16_t compareValue = 0x0000;
|
||||
<a name="l00213"></a>00213
|
||||
<a name="l00214"></a>00214 <span class="comment">/* Enable output on PC0. */</span>
|
||||
<a name="l00215"></a>00215 PORTC.DIR = 0x01;
|
||||
<a name="l00216"></a>00216
|
||||
<a name="l00217"></a>00217 <span class="comment">/* Set the TC period. */</span>
|
||||
<a name="l00218"></a>00218 <a class="code" href="TC__driver_8h.html#4faaf2813b83a03cd6d3720fa884bfe4" title="Sets the timer period.">TC_SetPeriod</a>( &TCC0, 0xFFFF );
|
||||
<a name="l00219"></a>00219
|
||||
<a name="l00220"></a>00220 <span class="comment">/* Configure the TC for single slope mode. */</span>
|
||||
<a name="l00221"></a>00221 <a class="code" href="TC__driver_8c.html#45e98ab822bfcd2e284c13fddac90f32" title="Configures the Waveform Generation Mode for the Timer/Counter 0.">TC0_ConfigWGM</a>( &TCC0, TC_WGMODE_SS_gc );
|
||||
<a name="l00222"></a>00222
|
||||
<a name="l00223"></a>00223 <span class="comment">/* Enable Compare channel A. */</span>
|
||||
<a name="l00224"></a>00224 <a class="code" href="TC__driver_8c.html#e6b05576247ef4109e9249ea4f8e6b28" title="Enables compare/capture channels for Timer/Counter 0.">TC0_EnableCCChannels</a>( &TCC0, TC0_CCAEN_bm );
|
||||
<a name="l00225"></a>00225
|
||||
<a name="l00226"></a>00226 <span class="comment">/* Start timer by selecting a clock source. */</span>
|
||||
<a name="l00227"></a>00227 <a class="code" href="TC__driver_8c.html#1a5b3ccf2b872dcdf8f4162e5cdc6e81" title="Configures clock source for the Timer/Counter 0.">TC0_ConfigClockSource</a>( &TCC0, TC_CLKSEL_DIV1_gc );
|
||||
<a name="l00228"></a>00228
|
||||
<a name="l00229"></a>00229 <span class="keywordflow">do</span> {
|
||||
<a name="l00230"></a>00230 <span class="comment">/* Calculate new compare value. */</span>
|
||||
<a name="l00231"></a>00231 compareValue += 32;
|
||||
<a name="l00232"></a>00232
|
||||
<a name="l00233"></a>00233 <span class="comment">/* Output new compare value. */</span>
|
||||
<a name="l00234"></a>00234 <a class="code" href="TC__driver_8h.html#11829e0c86eba6c2f20351060fa3c1b2" title="Set new compare value for compare channel A. ( Double buffered ).">TC_SetCompareA</a>( &TCC0, compareValue );
|
||||
<a name="l00235"></a>00235
|
||||
<a name="l00236"></a>00236 <span class="keywordflow">do</span> {
|
||||
<a name="l00237"></a>00237 <span class="comment">/* Wait for the new compare value to be latched</span>
|
||||
<a name="l00238"></a>00238 <span class="comment"> * from CCABUF[H:L] to CCA[H:L]. This happens at</span>
|
||||
<a name="l00239"></a>00239 <span class="comment"> * TC overflow (UPDATE ).</span>
|
||||
<a name="l00240"></a>00240 <span class="comment"> */</span>
|
||||
<a name="l00241"></a>00241 } <span class="keywordflow">while</span>( <a class="code" href="TC__driver_8h.html#41ba6e4bbe21de7dfcc85146835858e9" title="Test whether an overflow has occurred.">TC_GetOverflowFlag</a>( &TCC0 ) == 0 );
|
||||
<a name="l00242"></a>00242
|
||||
<a name="l00243"></a>00243 <span class="comment">/* Clear overflow flag. */</span>
|
||||
<a name="l00244"></a>00244 <a class="code" href="TC__driver_8h.html#edc4d516e9f796432730cc7fa61e81d9" title="Clears the Timer/Counter overflow flag.">TC_ClearOverflowFlag</a>( &TCC0 );
|
||||
<a name="l00245"></a>00245
|
||||
<a name="l00246"></a>00246 } <span class="keywordflow">while</span> (1);
|
||||
<a name="l00247"></a>00247 }
|
||||
<a name="l00248"></a>00248
|
||||
<a name="l00249"></a>00249
|
||||
<a name="l00259"></a><a class="code" href="TC__example_8c.html#bda6c77ac6c320173195b6371eba5a5b">00259</a> <span class="keywordtype">void</span> <a class="code" href="TC__example_8c.html#bda6c77ac6c320173195b6371eba5a5b" title="This example shows how to configure TCC0 to count events.">Example5</a>( <span class="keywordtype">void</span> )
|
||||
<a name="l00260"></a>00260 {
|
||||
<a name="l00261"></a>00261 <span class="comment">/* Configure PORTC as input on PC0, sense on falling edge. */</span>
|
||||
<a name="l00262"></a>00262 PORTC.PIN0CTRL = PORT_ISC_RISING_gc;
|
||||
<a name="l00263"></a>00263 PORTC.DIRCLR = 0x01;
|
||||
<a name="l00264"></a>00264
|
||||
<a name="l00265"></a>00265 <span class="comment">/* Configure PORTD as output on PD0. */</span>
|
||||
<a name="l00266"></a>00266 PORTD.DIRSET = 0x01;
|
||||
<a name="l00267"></a>00267
|
||||
<a name="l00268"></a>00268 <span class="comment">/* Select PC0 as input to event channel 0, enable filtering. */</span>
|
||||
<a name="l00269"></a>00269 EVSYS.CH0MUX = EVSYS_CHMUX_PORTC_PIN0_gc;
|
||||
<a name="l00270"></a>00270 EVSYS.CH0CTRL = EVSYS_DIGFILT_8SAMPLES_gc;
|
||||
<a name="l00271"></a>00271
|
||||
<a name="l00272"></a>00272 <span class="comment">/* Set period ( TOP value ). */</span>
|
||||
<a name="l00273"></a>00273 <a class="code" href="TC__driver_8h.html#4faaf2813b83a03cd6d3720fa884bfe4" title="Sets the timer period.">TC_SetPeriod</a>( &TCC0, 4 );
|
||||
<a name="l00274"></a>00274
|
||||
<a name="l00275"></a>00275 <span class="comment">/* Enable overflow interrupt at low level */</span>
|
||||
<a name="l00276"></a>00276 <a class="code" href="TC__driver_8c.html#5630e34078d4a93db2a655703c13c71a" title="Sets the overflow interrupt level.">TC0_SetOverflowIntLevel</a>( &TCC0, TC_OVFINTLVL_LO_gc );
|
||||
<a name="l00277"></a>00277 PMIC.CTRL |= PMIC_LOLVLEN_bm;
|
||||
<a name="l00278"></a>00278
|
||||
<a name="l00279"></a>00279 sei();
|
||||
<a name="l00280"></a>00280
|
||||
<a name="l00281"></a>00281 <span class="comment">/* Start Timer/Counter. */</span>
|
||||
<a name="l00282"></a>00282 <a class="code" href="TC__driver_8c.html#1a5b3ccf2b872dcdf8f4162e5cdc6e81" title="Configures clock source for the Timer/Counter 0.">TC0_ConfigClockSource</a>( &TCC0, TC_CLKSEL_EVCH0_gc );
|
||||
<a name="l00283"></a>00283
|
||||
<a name="l00284"></a>00284 <span class="keywordflow">do</span> {
|
||||
<a name="l00285"></a>00285 <span class="comment">/* Wait for user input. */</span>
|
||||
<a name="l00286"></a>00286 } <span class="keywordflow">while</span> (1);
|
||||
<a name="l00287"></a>00287 }
|
||||
<a name="l00288"></a>00288
|
||||
<a name="l00289"></a>00289
|
||||
<a name="l00290"></a><a class="code" href="TC__example_8c.html#04b2181bef53144f030b82c4d88a7bc8">00290</a> <a class="code" href="TC__example_8c.html#0763252836531eeb42258e71bf9710be">ISR</a>(TCC0_OVF_vect)
|
||||
<a name="l00291"></a>00291 {
|
||||
<a name="l00292"></a>00292 <span class="comment">/* Toggle PD0 output after 5 switch presses. */</span>
|
||||
<a name="l00293"></a>00293 PORTD.OUTTGL = 0x01;
|
||||
<a name="l00294"></a>00294 }
|
||||
<a name="l00295"></a>00295
|
||||
<a name="l00296"></a>00296
|
||||
<a name="l00309"></a><a class="code" href="TC__example_8c.html#f66b2c4ef70a32b9596a9442439a4dc2">00309</a> <span class="keywordtype">void</span> <a class="code" href="TC__example_8c.html#f66b2c4ef70a32b9596a9442439a4dc2" title="This example shows how to configure Timer/Counter for 32-bit counting with input...">Example6</a>( <span class="keywordtype">void</span> )
|
||||
<a name="l00310"></a>00310 {
|
||||
<a name="l00311"></a>00311 uint32_t inputCaptureTime;
|
||||
<a name="l00312"></a>00312
|
||||
<a name="l00313"></a>00313 <span class="comment">/* Configure PC0 for input, triggered on falling edge. */</span>
|
||||
<a name="l00314"></a>00314 PORTC.PIN0CTRL = PORT_ISC_FALLING_gc;
|
||||
<a name="l00315"></a>00315 PORTC.DIRCLR = 0x01;
|
||||
<a name="l00316"></a>00316
|
||||
<a name="l00317"></a>00317 <span class="comment">/* Configure PORTD as output. */</span>
|
||||
<a name="l00318"></a>00318 PORTD.DIRSET = 0xFF;
|
||||
<a name="l00319"></a>00319
|
||||
<a name="l00320"></a>00320 <span class="comment">/* Use PC0 as multiplexer input for event channel 1. */</span>
|
||||
<a name="l00321"></a>00321 EVSYS.CH1MUX = EVSYS_CHMUX_PORTC_PIN0_gc;
|
||||
<a name="l00322"></a>00322
|
||||
<a name="l00323"></a>00323 <span class="comment">/* Use TCC0 overflow as input for event channel 0. */</span>
|
||||
<a name="l00324"></a>00324 EVSYS.CH0MUX = EVSYS_CHMUX_TCC0_OVF_gc;
|
||||
<a name="l00325"></a>00325
|
||||
<a name="l00326"></a>00326 <span class="comment">/* Configure TCC0 and TCC1 for input capture with event channel 1 as</span>
|
||||
<a name="l00327"></a>00327 <span class="comment"> * trigger source.</span>
|
||||
<a name="l00328"></a>00328 <span class="comment"> */</span>
|
||||
<a name="l00329"></a>00329 <a class="code" href="TC__driver_8c.html#309a2ca4eaf39437b57ca13edb23b70b" title="Configures the Timer/Counter 0 for input capture operation.">TC0_ConfigInputCapture</a>( &TCC0, TC_EVSEL_CH1_gc );
|
||||
<a name="l00330"></a>00330 <a class="code" href="TC__driver_8c.html#8d41d6b130f6fd3928e8198e9bf9512b" title="Configures the Timer/Counter 1 for input capture operation.">TC1_ConfigInputCapture</a>( &TCC1, TC_EVSEL_CH1_gc );
|
||||
<a name="l00331"></a>00331
|
||||
<a name="l00332"></a>00332 <span class="comment">/* Enable event delay on TCC1. */</span>
|
||||
<a name="l00333"></a>00333 <a class="code" href="TC__driver_8h.html#4b1fa59d76f86ced01740b22278ba23b" title="Enables the event delay for this TC.">TC_EnableEventDelay</a>( &TCC1 );
|
||||
<a name="l00334"></a>00334
|
||||
<a name="l00335"></a>00335 <span class="comment">/* Enable input capture channel A on TCC0 and TCC1 */</span>
|
||||
<a name="l00336"></a>00336 <a class="code" href="TC__driver_8c.html#e6b05576247ef4109e9249ea4f8e6b28" title="Enables compare/capture channels for Timer/Counter 0.">TC0_EnableCCChannels</a>( &TCC0, TC0_CCAEN_bm );
|
||||
<a name="l00337"></a>00337 <a class="code" href="TC__driver_8c.html#41d8a44ed53255f2bb991a2aab3bf031" title="Enables compare/capture channels for Timer/Counter 1.">TC1_EnableCCChannels</a>( &TCC1, TC1_CCAEN_bm );
|
||||
<a name="l00338"></a>00338
|
||||
<a name="l00339"></a>00339 <span class="comment">/* Use event channel 0 as clock source for TCC1. */</span>
|
||||
<a name="l00340"></a>00340 <a class="code" href="TC__driver_8c.html#ef27c3126f89d13b02732de352bff21f" title="Configures clock source for the Timer/Counter 1.">TC1_ConfigClockSource</a>( &TCC1, TC_CLKSEL_EVCH0_gc );
|
||||
<a name="l00341"></a>00341
|
||||
<a name="l00342"></a>00342 <span class="comment">/* Select system clock as TCC0 clock source. */</span>
|
||||
<a name="l00343"></a>00343 <a class="code" href="TC__driver_8c.html#1a5b3ccf2b872dcdf8f4162e5cdc6e81" title="Configures clock source for the Timer/Counter 0.">TC0_ConfigClockSource</a>( &TCC0, TC_CLKSEL_DIV1_gc );
|
||||
<a name="l00344"></a>00344
|
||||
<a name="l00345"></a>00345 <span class="keywordflow">do</span> {
|
||||
<a name="l00346"></a>00346 <span class="keywordflow">do</span> {
|
||||
<a name="l00347"></a>00347 <span class="comment">/* Wait for Input Capture. */</span>
|
||||
<a name="l00348"></a>00348 } <span class="keywordflow">while</span> ( <a class="code" href="TC__driver_8h.html#5b1d20f74d1a3083b536f27017f45767" title="Get the status for Compare or Capture channel A.">TC_GetCCAFlag</a>( &TCC0 ) == 0 );
|
||||
<a name="l00349"></a>00349
|
||||
<a name="l00350"></a>00350 uint16_t highWord = <a class="code" href="TC__driver_8h.html#047c98cc70b77b9133143155a575a2db" title="Reads the first available input capture value for channel A.">TC_GetCaptureA</a>( &TCC1 );
|
||||
<a name="l00351"></a>00351 uint16_t lowWord = <a class="code" href="TC__driver_8h.html#047c98cc70b77b9133143155a575a2db" title="Reads the first available input capture value for channel A.">TC_GetCaptureA</a>( &TCC0 );
|
||||
<a name="l00352"></a>00352 inputCaptureTime = ( (uint32_t) highWord << 16 ) | lowWord;
|
||||
<a name="l00353"></a>00353
|
||||
<a name="l00354"></a>00354 PORTD.OUT = (uint8_t) (inputCaptureTime >> 24);
|
||||
<a name="l00355"></a>00355
|
||||
<a name="l00356"></a>00356 } <span class="keywordflow">while</span> (1);
|
||||
<a name="l00357"></a>00357
|
||||
<a name="l00358"></a>00358 }
|
||||
</pre></div></div>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
|
||||
<title>@DOC_TITLE@</title>
|
||||
<link href="doxygen.css" rel="stylesheet" type="text/css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<table width="100%" height="10%" bgcolor="#FFFFFF">
|
||||
<tr>
|
||||
<td colspan="6" height="1" background="blue.gif"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="6">
|
||||
<address style="align: right;"><small>
|
||||
Generated on Wed Apr 23 07:45:44 2008 for AVR1306 Using the XMEGA Timer/Counter by <a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border=0></a> 1.5.5</small></address>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
@@ -0,0 +1,677 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
|
||||
<title>@DOC_TITLE@</title>
|
||||
<link href="doxygen.css" rel="stylesheet" type="text/css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<table width="100%" height="10%" bgcolor="#FFFFFF">
|
||||
<tr>
|
||||
<td colspan="2"><p><A href=http://www.atmel.com ><img src="atmel.jpg"/ border=0></A></p><br /></td>
|
||||
<td colspan="2"> <strong><font face="Helvetica" color="#000000" size="+3">Xmega Application Note</font></strong></td>
|
||||
<td colspan="2"><p><A href=http://www.atmel.com/products/AVR><img src="AVR_logo_blue.gif"/ border=0></A></p><br /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="6" height="1" background="blue.gif"></td>
|
||||
</tr>
|
||||
</table>
|
||||
<!-- Generated by Doxygen 1.5.5 -->
|
||||
<div class="contents">
|
||||
<h1>TC_example.c File Reference</h1><hr><a name="_details"></a><h2>Detailed Description</h2>
|
||||
XMEGA Timer/Counter example source file.
|
||||
<p>
|
||||
This file contains an example application that demonstrates the Timer/ Counter driver.<p>
|
||||
<dl class="user" compact><dt><b>Application note:</b></dt><dd>AVR1306: Using the XMEGA Timer/Counter</dd></dl>
|
||||
<dl class="user" compact><dt><b>Documentation</b></dt><dd>For comprehensive code documentation, supported compilers, compiler settings and supported devices see readme.html</dd></dl>
|
||||
<dl class="author" compact><dt><b>Author:</b></dt><dd>Atmel Corporation: <a href="http://www.atmel.com">http://www.atmel.com</a> <br>
|
||||
Support email: <a href="mailto:avr@atmel.com">avr@atmel.com</a></dd></dl>
|
||||
<dl class="rcs" compact><dt><b>Revision</b></dt><dd>1569 </dd></dl>
|
||||
<dl class="rcs" compact><dt><b>Date</b></dt><dd>2008-04-22 13:03:43 +0200 (ti, 22 apr 2008) </dd></dl>
|
||||
<br>
|
||||
<p>
|
||||
Copyright (c) 2008, Atmel Corporation All rights reserved.<p>
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:<p>
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.<p>
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.<p>
|
||||
3. The name of ATMEL may not be used to endorse or promote products derived from this software without specific prior written permission.<p>
|
||||
THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
<p>Definition in file <a class="el" href="TC__example_8c-source.html">TC_example.c</a>.</p>
|
||||
|
||||
<p>
|
||||
<code>#include "<a class="el" href="avr__compiler_8h-source.html">avr_compiler.h</a>"</code><br>
|
||||
<code>#include "<a class="el" href="TC__driver_8h-source.html">TC_driver.h</a>"</code><br>
|
||||
|
||||
<p>
|
||||
<div class="dynheader">
|
||||
Include dependency graph for TC_example.c:</div>
|
||||
<div class="dynsection">
|
||||
<p><center><img src="TC__example_8c__incl.png" border="0" usemap="#TC_example.c_map" alt=""></center>
|
||||
<map name="TC_example.c_map">
|
||||
<area shape="rect" href="avr__compiler_8h.html" title="This file implements some macros that makes the IAR C-compiler and avr-gcc work with..." alt="" coords="76,155,185,181"><area shape="rect" href="TC__driver_8h.html" title="XMEGA Timer/Counter driver header file." alt="" coords="127,80,220,107"></map>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
<a href="TC__example_8c-source.html">Go to the source code of this file.</a><table border="0" cellpadding="0" cellspacing="0">
|
||||
<tr><td></td></tr>
|
||||
<tr><td colspan="2"><br><h2>Defines</h2></td></tr>
|
||||
<tr><td class="memItemLeft" nowrap align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="TC__example_8c.html#945ebdbcd5f4e6a81f5ab930fd046cd5">CPU_PRESCALER</a> 1</td></tr>
|
||||
|
||||
<tr><td class="memItemLeft" nowrap align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="TC__example_8c.html#43bafb28b29491ec7f871319b5a3b2f8">F_CPU</a> 2000000UL</td></tr>
|
||||
|
||||
<tr><td colspan="2"><br><h2>Functions</h2></td></tr>
|
||||
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="TC__example_8c.html#b899c7aa870825aec068df494bbfd714">Example1</a> (void)</td></tr>
|
||||
|
||||
<tr><td class="mdescLeft"> </td><td class="mdescRight">This example shows how to configure TCC0 for basic timer operation. <a href="#b899c7aa870825aec068df494bbfd714"></a><br></td></tr>
|
||||
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="TC__example_8c.html#7d5465d0142c58a86789deec41d3436a">Example2</a> (void)</td></tr>
|
||||
|
||||
<tr><td class="mdescLeft"> </td><td class="mdescRight">This function shows how to use the Input Capture functionality. <a href="#7d5465d0142c58a86789deec41d3436a"></a><br></td></tr>
|
||||
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="TC__example_8c.html#1678698677906bbe98f830ba470905a3">Example3</a> (void)</td></tr>
|
||||
|
||||
<tr><td class="mdescLeft"> </td><td class="mdescRight">This example shows how to configure TCC0 for measurement of Frequency and Duty cycle of a signal applied to PC0. <a href="#1678698677906bbe98f830ba470905a3"></a><br></td></tr>
|
||||
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="TC__example_8c.html#6efa69f5cda8cc01efb9cb61701e5f54">Example4</a> (void)</td></tr>
|
||||
|
||||
<tr><td class="mdescLeft"> </td><td class="mdescRight">This example shows how to configure TCC0 for pulse width modulation output with varying duty cycle on channel A. <a href="#6efa69f5cda8cc01efb9cb61701e5f54"></a><br></td></tr>
|
||||
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="TC__example_8c.html#bda6c77ac6c320173195b6371eba5a5b">Example5</a> (void)</td></tr>
|
||||
|
||||
<tr><td class="mdescLeft"> </td><td class="mdescRight">This example shows how to configure TCC0 to count events. <a href="#bda6c77ac6c320173195b6371eba5a5b"></a><br></td></tr>
|
||||
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="TC__example_8c.html#f66b2c4ef70a32b9596a9442439a4dc2">Example6</a> (void)</td></tr>
|
||||
|
||||
<tr><td class="mdescLeft"> </td><td class="mdescRight">This example shows how to configure Timer/Counter for 32-bit counting with input capture. <a href="#f66b2c4ef70a32b9596a9442439a4dc2"></a><br></td></tr>
|
||||
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="TC__example_8c.html#04b2181bef53144f030b82c4d88a7bc8">ISR</a> (TCC0_OVF_vect)</td></tr>
|
||||
|
||||
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="TC__example_8c.html#0763252836531eeb42258e71bf9710be">ISR</a> (TCC0_CCA_vect)</td></tr>
|
||||
|
||||
<tr><td class="memItemLeft" nowrap align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="TC__example_8c.html#840291bc02cba5474a4cb46a9b9566fe">main</a> (void)</td></tr>
|
||||
|
||||
</table>
|
||||
<hr><h2>Define Documentation</h2>
|
||||
<a class="anchor" name="945ebdbcd5f4e6a81f5ab930fd046cd5"></a><!-- doxytag: member="TC_example.c::CPU_PRESCALER" ref="945ebdbcd5f4e6a81f5ab930fd046cd5" args="" -->
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">#define CPU_PRESCALER 1 </td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="memdoc">
|
||||
|
||||
<p>
|
||||
|
||||
<p>Definition at line <a class="el" href="TC__example_8c-source.html#l00052">52</a> of file <a class="el" href="TC__example_8c-source.html">TC_example.c</a>.</p>
|
||||
|
||||
<p>Referenced by <a class="el" href="TC__example_8c-source.html#l00180">ISR()</a>.</p>
|
||||
|
||||
</div>
|
||||
</div><p>
|
||||
<a class="anchor" name="43bafb28b29491ec7f871319b5a3b2f8"></a><!-- doxytag: member="TC_example.c::F_CPU" ref="43bafb28b29491ec7f871319b5a3b2f8" args="" -->
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">#define F_CPU 2000000UL </td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="memdoc">
|
||||
|
||||
<p>
|
||||
|
||||
<p>Definition at line <a class="el" href="TC__example_8c-source.html#l00051">51</a> of file <a class="el" href="TC__example_8c-source.html">TC_example.c</a>.</p>
|
||||
|
||||
</div>
|
||||
</div><p>
|
||||
<hr><h2>Function Documentation</h2>
|
||||
<a class="anchor" name="b899c7aa870825aec068df494bbfd714"></a><!-- doxytag: member="TC_example.c::Example1" ref="b899c7aa870825aec068df494bbfd714" args="(void)" -->
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">void Example1 </td>
|
||||
<td>(</td>
|
||||
<td class="paramtype">void </td>
|
||||
<td class="paramname"> </td>
|
||||
<td> ) </td>
|
||||
<td width="100%"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="memdoc">
|
||||
|
||||
<p>
|
||||
This example shows how to configure TCC0 for basic timer operation.
|
||||
<p>
|
||||
This function implements example 1, "Basic Timer/Counter Operation" from the "Getting Started" section of application note AVR1306.
|
||||
<p>Definition at line <a class="el" href="TC__example_8c-source.html#l00086">86</a> of file <a class="el" href="TC__example_8c-source.html">TC_example.c</a>.</p>
|
||||
|
||||
<p>References <a class="el" href="TC__driver_8c-source.html#l00079">TC0_ConfigClockSource()</a>, and <a class="el" href="TC__driver_8h-source.html#l00148">TC_SetPeriod</a>.</p>
|
||||
|
||||
<p>Referenced by <a class="el" href="TC__example_8c-source.html#l00070">main()</a>.</p>
|
||||
<div class="fragment"><pre class="fragment"><a name="l00087"></a>00087 {
|
||||
<a name="l00088"></a>00088 <span class="comment">/* Set period/TOP value. */</span>
|
||||
<a name="l00089"></a>00089 <a class="code" href="TC__driver_8h.html#4faaf2813b83a03cd6d3720fa884bfe4" title="Sets the timer period.">TC_SetPeriod</a>( &TCC0, 0x1000 );
|
||||
<a name="l00090"></a>00090
|
||||
<a name="l00091"></a>00091 <span class="comment">/* Select clock source. */</span>
|
||||
<a name="l00092"></a>00092 <a class="code" href="TC__driver_8c.html#1a5b3ccf2b872dcdf8f4162e5cdc6e81" title="Configures clock source for the Timer/Counter 0.">TC0_ConfigClockSource</a>( &TCC0, TC_CLKSEL_DIV1_gc );
|
||||
<a name="l00093"></a>00093
|
||||
<a name="l00094"></a>00094 <span class="keywordflow">do</span> {
|
||||
<a name="l00095"></a>00095 <span class="comment">/* Wait while the timer counts. */</span>
|
||||
<a name="l00096"></a>00096 } <span class="keywordflow">while</span> (1);
|
||||
<a name="l00097"></a>00097 }
|
||||
</pre></div>
|
||||
<p>
|
||||
|
||||
<p>
|
||||
<div class="dynheader">
|
||||
Here is the call graph for this function:</div>
|
||||
<div class="dynsection">
|
||||
<p><center><img src="TC__example_8c_b899c7aa870825aec068df494bbfd714_cgraph.png" border="0" usemap="#TC__example_8c_b899c7aa870825aec068df494bbfd714_cgraph_map" alt=""></center>
|
||||
<map name="TC__example_8c_b899c7aa870825aec068df494bbfd714_cgraph_map">
|
||||
<area shape="rect" href="TC__driver_8c.html#1a5b3ccf2b872dcdf8f4162e5cdc6e81" title="Configures clock source for the Timer/Counter 0." alt="" coords="136,5,307,32"></map>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div><p>
|
||||
<a class="anchor" name="7d5465d0142c58a86789deec41d3436a"></a><!-- doxytag: member="TC_example.c::Example2" ref="7d5465d0142c58a86789deec41d3436a" args="(void)" -->
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">void Example2 </td>
|
||||
<td>(</td>
|
||||
<td class="paramtype">void </td>
|
||||
<td class="paramname"> </td>
|
||||
<td> ) </td>
|
||||
<td width="100%"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="memdoc">
|
||||
|
||||
<p>
|
||||
This function shows how to use the Input Capture functionality.
|
||||
<p>
|
||||
This function implements example 2, "Using the Input Capture Functionality" from the "Getting Started" section of application note AVR1306.
|
||||
<p>Definition at line <a class="el" href="TC__example_8c-source.html#l00106">106</a> of file <a class="el" href="TC__example_8c-source.html">TC_example.c</a>.</p>
|
||||
|
||||
<p>References <a class="el" href="TC__driver_8c-source.html#l00079">TC0_ConfigClockSource()</a>, <a class="el" href="TC__driver_8c-source.html#l00137">TC0_ConfigInputCapture()</a>, <a class="el" href="TC__driver_8c-source.html#l00182">TC0_EnableCCChannels()</a>, <a class="el" href="TC__driver_8h-source.html#l00354">TC_GetCaptureA</a>, and <a class="el" href="TC__driver_8h-source.html#l00258">TC_GetCCAFlag</a>.</p>
|
||||
<div class="fragment"><pre class="fragment"><a name="l00107"></a>00107 {
|
||||
<a name="l00108"></a>00108 uint16_t inputCaptureTime;
|
||||
<a name="l00109"></a>00109
|
||||
<a name="l00110"></a>00110 <span class="comment">/* Configure PC0 for input, triggered on falling edge. */</span>
|
||||
<a name="l00111"></a>00111 PORTC.PIN0CTRL = PORT_ISC_FALLING_gc;
|
||||
<a name="l00112"></a>00112 PORTC.DIRCLR = 0x01;
|
||||
<a name="l00113"></a>00113
|
||||
<a name="l00114"></a>00114 <span class="comment">/* Configure Port D for output. */</span>
|
||||
<a name="l00115"></a>00115 PORTD.DIRSET = 0xFF;
|
||||
<a name="l00116"></a>00116
|
||||
<a name="l00117"></a>00117 <span class="comment">/* Select PC0 as input to event channel 2. */</span>
|
||||
<a name="l00118"></a>00118 EVSYS.CH2MUX = EVSYS_CHMUX_PORTC_PIN0_gc;
|
||||
<a name="l00119"></a>00119
|
||||
<a name="l00120"></a>00120 <span class="comment">/* Configure TCC0 for Input Capture using event channel 2. */</span>
|
||||
<a name="l00121"></a>00121 <a class="code" href="TC__driver_8c.html#309a2ca4eaf39437b57ca13edb23b70b" title="Configures the Timer/Counter 0 for input capture operation.">TC0_ConfigInputCapture</a>( &TCC0, TC_EVSEL_CH2_gc );
|
||||
<a name="l00122"></a>00122
|
||||
<a name="l00123"></a>00123 <span class="comment">/* Enable Input Capture channel A. */</span>
|
||||
<a name="l00124"></a>00124 <a class="code" href="TC__driver_8c.html#e6b05576247ef4109e9249ea4f8e6b28" title="Enables compare/capture channels for Timer/Counter 0.">TC0_EnableCCChannels</a>( &TCC0, TC0_CCAEN_bm );
|
||||
<a name="l00125"></a>00125
|
||||
<a name="l00126"></a>00126 <span class="comment">/* Start timer by selecting a clock source. */</span>
|
||||
<a name="l00127"></a>00127 <a class="code" href="TC__driver_8c.html#1a5b3ccf2b872dcdf8f4162e5cdc6e81" title="Configures clock source for the Timer/Counter 0.">TC0_ConfigClockSource</a>( &TCC0, TC_CLKSEL_DIV1_gc );
|
||||
<a name="l00128"></a>00128
|
||||
<a name="l00129"></a>00129 <span class="keywordflow">do</span> {
|
||||
<a name="l00130"></a>00130 <span class="keywordflow">do</span> {
|
||||
<a name="l00131"></a>00131 <span class="comment">/* Wait for Input Capture. */</span>
|
||||
<a name="l00132"></a>00132 } <span class="keywordflow">while</span> ( <a class="code" href="TC__driver_8h.html#5b1d20f74d1a3083b536f27017f45767" title="Get the status for Compare or Capture channel A.">TC_GetCCAFlag</a>( &TCC0 ) == 0 );
|
||||
<a name="l00133"></a>00133
|
||||
<a name="l00134"></a>00134 inputCaptureTime = <a class="code" href="TC__driver_8h.html#047c98cc70b77b9133143155a575a2db" title="Reads the first available input capture value for channel A.">TC_GetCaptureA</a>( &TCC0 );
|
||||
<a name="l00135"></a>00135 PORTD.OUT = (uint8_t) (inputCaptureTime >> 8);
|
||||
<a name="l00136"></a>00136 } <span class="keywordflow">while</span> (1);
|
||||
<a name="l00137"></a>00137 }
|
||||
</pre></div>
|
||||
<p>
|
||||
|
||||
<p>
|
||||
<div class="dynheader">
|
||||
Here is the call graph for this function:</div>
|
||||
<div class="dynsection">
|
||||
<p><center><img src="TC__example_8c_7d5465d0142c58a86789deec41d3436a_cgraph.png" border="0" usemap="#TC__example_8c_7d5465d0142c58a86789deec41d3436a_cgraph_map" alt=""></center>
|
||||
<map name="TC__example_8c_7d5465d0142c58a86789deec41d3436a_cgraph_map">
|
||||
<area shape="rect" href="TC__driver_8c.html#1a5b3ccf2b872dcdf8f4162e5cdc6e81" title="Configures clock source for the Timer/Counter 0." alt="" coords="137,5,308,32"><area shape="rect" href="TC__driver_8c.html#309a2ca4eaf39437b57ca13edb23b70b" title="Configures the Timer/Counter 0 for input capture operation." alt="" coords="137,56,308,83"><area shape="rect" href="TC__driver_8c.html#e6b05576247ef4109e9249ea4f8e6b28" title="Enables compare/capture channels for Timer/Counter 0." alt="" coords="137,107,308,133"></map>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div><p>
|
||||
<a class="anchor" name="1678698677906bbe98f830ba470905a3"></a><!-- doxytag: member="TC_example.c::Example3" ref="1678698677906bbe98f830ba470905a3" args="(void)" -->
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">void Example3 </td>
|
||||
<td>(</td>
|
||||
<td class="paramtype">void </td>
|
||||
<td class="paramname"> </td>
|
||||
<td> ) </td>
|
||||
<td width="100%"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="memdoc">
|
||||
|
||||
<p>
|
||||
This example shows how to configure TCC0 for measurement of Frequency and Duty cycle of a signal applied to PC0.
|
||||
<p>
|
||||
This function implements example 3, "Using Input Capture to Calculate Frequency and Duty Cycle of a Signal" from the "Getting Started" section of application note AVR1306.
|
||||
<p>Definition at line <a class="el" href="TC__example_8c-source.html#l00147">147</a> of file <a class="el" href="TC__example_8c-source.html">TC_example.c</a>.</p>
|
||||
|
||||
<p>References <a class="el" href="TC__driver_8c-source.html#l00079">TC0_ConfigClockSource()</a>, <a class="el" href="TC__driver_8c-source.html#l00137">TC0_ConfigInputCapture()</a>, <a class="el" href="TC__driver_8c-source.html#l00182">TC0_EnableCCChannels()</a>, <a class="el" href="TC__driver_8c-source.html#l00324">TC0_SetCCAIntLevel()</a>, and <a class="el" href="TC__driver_8h-source.html#l00148">TC_SetPeriod</a>.</p>
|
||||
<div class="fragment"><pre class="fragment"><a name="l00148"></a>00148 {
|
||||
<a name="l00149"></a>00149 <span class="comment">/* Configure PC0 for input, triggered on both edges. */</span>
|
||||
<a name="l00150"></a>00150 PORTC.PIN0CTRL = PORT_ISC_BOTHEDGES_gc;
|
||||
<a name="l00151"></a>00151 PORTC.DIRCLR = 0x01;
|
||||
<a name="l00152"></a>00152
|
||||
<a name="l00153"></a>00153 <span class="comment">/* Select PC0 as input to event channel 0. */</span>
|
||||
<a name="l00154"></a>00154 EVSYS.CH0MUX = EVSYS_CHMUX_PORTC_PIN0_gc;
|
||||
<a name="l00155"></a>00155
|
||||
<a name="l00156"></a>00156 <span class="comment">/* Configure TCC0 for Input Capture using event channel 2. */</span>
|
||||
<a name="l00157"></a>00157 <a class="code" href="TC__driver_8c.html#309a2ca4eaf39437b57ca13edb23b70b" title="Configures the Timer/Counter 0 for input capture operation.">TC0_ConfigInputCapture</a>( &TCC0, TC_EVSEL_CH0_gc );
|
||||
<a name="l00158"></a>00158
|
||||
<a name="l00159"></a>00159 <span class="comment">/* Enable Input "Capture or Compare" channel A. */</span>
|
||||
<a name="l00160"></a>00160 <a class="code" href="TC__driver_8c.html#e6b05576247ef4109e9249ea4f8e6b28" title="Enables compare/capture channels for Timer/Counter 0.">TC0_EnableCCChannels</a>( &TCC0, TC0_CCAEN_bm );
|
||||
<a name="l00161"></a>00161
|
||||
<a name="l00162"></a>00162 <span class="comment">/* Clear MSB of PER[H:L] to allow for propagation of edge polarity. */</span>
|
||||
<a name="l00163"></a>00163 <a class="code" href="TC__driver_8h.html#4faaf2813b83a03cd6d3720fa884bfe4" title="Sets the timer period.">TC_SetPeriod</a>( &TCC0, 0x7FFF );
|
||||
<a name="l00164"></a>00164
|
||||
<a name="l00165"></a>00165 <span class="comment">/* Start timer by selecting a clock source. */</span>
|
||||
<a name="l00166"></a>00166 <a class="code" href="TC__driver_8c.html#1a5b3ccf2b872dcdf8f4162e5cdc6e81" title="Configures clock source for the Timer/Counter 0.">TC0_ConfigClockSource</a>( &TCC0, TC_CLKSEL_DIV1_gc );
|
||||
<a name="l00167"></a>00167
|
||||
<a name="l00168"></a>00168 <span class="comment">/* Enable CCA interrupt. */</span>
|
||||
<a name="l00169"></a>00169 <a class="code" href="TC__driver_8c.html#9dc297c8345a7b55099ab0b63454e109" title="Sets the interrupt level for compare/capture channel A interrupt.">TC0_SetCCAIntLevel</a>( &TCC0, TC_CCAINTLVL_LO_gc );
|
||||
<a name="l00170"></a>00170 PMIC.CTRL |= PMIC_LOLVLEN_bm;
|
||||
<a name="l00171"></a>00171
|
||||
<a name="l00172"></a>00172 sei();
|
||||
<a name="l00173"></a>00173
|
||||
<a name="l00174"></a>00174 <span class="keywordflow">do</span> {
|
||||
<a name="l00175"></a>00175 <span class="comment">/* Wait while interrupt measure Frequency and Duty cycle. */</span>
|
||||
<a name="l00176"></a>00176 } <span class="keywordflow">while</span> (1);
|
||||
<a name="l00177"></a>00177 }
|
||||
</pre></div>
|
||||
<p>
|
||||
|
||||
<p>
|
||||
<div class="dynheader">
|
||||
Here is the call graph for this function:</div>
|
||||
<div class="dynsection">
|
||||
<p><center><img src="TC__example_8c_1678698677906bbe98f830ba470905a3_cgraph.png" border="0" usemap="#TC__example_8c_1678698677906bbe98f830ba470905a3_cgraph_map" alt=""></center>
|
||||
<map name="TC__example_8c_1678698677906bbe98f830ba470905a3_cgraph_map">
|
||||
<area shape="rect" href="TC__driver_8c.html#1a5b3ccf2b872dcdf8f4162e5cdc6e81" title="Configures clock source for the Timer/Counter 0." alt="" coords="137,5,308,32"><area shape="rect" href="TC__driver_8c.html#309a2ca4eaf39437b57ca13edb23b70b" title="Configures the Timer/Counter 0 for input capture operation." alt="" coords="137,56,308,83"><area shape="rect" href="TC__driver_8c.html#e6b05576247ef4109e9249ea4f8e6b28" title="Enables compare/capture channels for Timer/Counter 0." alt="" coords="137,107,308,133"><area shape="rect" href="TC__driver_8c.html#9dc297c8345a7b55099ab0b63454e109" title="Sets the interrupt level for compare/capture channel A interrupt." alt="" coords="148,157,297,184"></map>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div><p>
|
||||
<a class="anchor" name="6efa69f5cda8cc01efb9cb61701e5f54"></a><!-- doxytag: member="TC_example.c::Example4" ref="6efa69f5cda8cc01efb9cb61701e5f54" args="(void)" -->
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">void Example4 </td>
|
||||
<td>(</td>
|
||||
<td class="paramtype">void </td>
|
||||
<td class="paramname"> </td>
|
||||
<td> ) </td>
|
||||
<td width="100%"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="memdoc">
|
||||
|
||||
<p>
|
||||
This example shows how to configure TCC0 for pulse width modulation output with varying duty cycle on channel A.
|
||||
<p>
|
||||
This function implements example 4, "Using a Timer/Counter for PWM Generation" from the "Getting Started" section of application note AVR1306.
|
||||
<p>Definition at line <a class="el" href="TC__example_8c-source.html#l00210">210</a> of file <a class="el" href="TC__example_8c-source.html">TC_example.c</a>.</p>
|
||||
|
||||
<p>References <a class="el" href="TC__driver_8c-source.html#l00079">TC0_ConfigClockSource()</a>, <a class="el" href="TC__driver_8c-source.html#l00106">TC0_ConfigWGM()</a>, <a class="el" href="TC__driver_8c-source.html#l00182">TC0_EnableCCChannels()</a>, <a class="el" href="TC__driver_8h-source.html#l00224">TC_ClearOverflowFlag</a>, <a class="el" href="TC__driver_8h-source.html#l00216">TC_GetOverflowFlag</a>, <a class="el" href="TC__driver_8h-source.html#l00169">TC_SetCompareA</a>, and <a class="el" href="TC__driver_8h-source.html#l00148">TC_SetPeriod</a>.</p>
|
||||
<div class="fragment"><pre class="fragment"><a name="l00211"></a>00211 {
|
||||
<a name="l00212"></a>00212 uint16_t compareValue = 0x0000;
|
||||
<a name="l00213"></a>00213
|
||||
<a name="l00214"></a>00214 <span class="comment">/* Enable output on PC0. */</span>
|
||||
<a name="l00215"></a>00215 PORTC.DIR = 0x01;
|
||||
<a name="l00216"></a>00216
|
||||
<a name="l00217"></a>00217 <span class="comment">/* Set the TC period. */</span>
|
||||
<a name="l00218"></a>00218 <a class="code" href="TC__driver_8h.html#4faaf2813b83a03cd6d3720fa884bfe4" title="Sets the timer period.">TC_SetPeriod</a>( &TCC0, 0xFFFF );
|
||||
<a name="l00219"></a>00219
|
||||
<a name="l00220"></a>00220 <span class="comment">/* Configure the TC for single slope mode. */</span>
|
||||
<a name="l00221"></a>00221 <a class="code" href="TC__driver_8c.html#45e98ab822bfcd2e284c13fddac90f32" title="Configures the Waveform Generation Mode for the Timer/Counter 0.">TC0_ConfigWGM</a>( &TCC0, TC_WGMODE_SS_gc );
|
||||
<a name="l00222"></a>00222
|
||||
<a name="l00223"></a>00223 <span class="comment">/* Enable Compare channel A. */</span>
|
||||
<a name="l00224"></a>00224 <a class="code" href="TC__driver_8c.html#e6b05576247ef4109e9249ea4f8e6b28" title="Enables compare/capture channels for Timer/Counter 0.">TC0_EnableCCChannels</a>( &TCC0, TC0_CCAEN_bm );
|
||||
<a name="l00225"></a>00225
|
||||
<a name="l00226"></a>00226 <span class="comment">/* Start timer by selecting a clock source. */</span>
|
||||
<a name="l00227"></a>00227 <a class="code" href="TC__driver_8c.html#1a5b3ccf2b872dcdf8f4162e5cdc6e81" title="Configures clock source for the Timer/Counter 0.">TC0_ConfigClockSource</a>( &TCC0, TC_CLKSEL_DIV1_gc );
|
||||
<a name="l00228"></a>00228
|
||||
<a name="l00229"></a>00229 <span class="keywordflow">do</span> {
|
||||
<a name="l00230"></a>00230 <span class="comment">/* Calculate new compare value. */</span>
|
||||
<a name="l00231"></a>00231 compareValue += 32;
|
||||
<a name="l00232"></a>00232
|
||||
<a name="l00233"></a>00233 <span class="comment">/* Output new compare value. */</span>
|
||||
<a name="l00234"></a>00234 <a class="code" href="TC__driver_8h.html#11829e0c86eba6c2f20351060fa3c1b2" title="Set new compare value for compare channel A. ( Double buffered ).">TC_SetCompareA</a>( &TCC0, compareValue );
|
||||
<a name="l00235"></a>00235
|
||||
<a name="l00236"></a>00236 <span class="keywordflow">do</span> {
|
||||
<a name="l00237"></a>00237 <span class="comment">/* Wait for the new compare value to be latched</span>
|
||||
<a name="l00238"></a>00238 <span class="comment"> * from CCABUF[H:L] to CCA[H:L]. This happens at</span>
|
||||
<a name="l00239"></a>00239 <span class="comment"> * TC overflow (UPDATE ).</span>
|
||||
<a name="l00240"></a>00240 <span class="comment"> */</span>
|
||||
<a name="l00241"></a>00241 } <span class="keywordflow">while</span>( <a class="code" href="TC__driver_8h.html#41ba6e4bbe21de7dfcc85146835858e9" title="Test whether an overflow has occurred.">TC_GetOverflowFlag</a>( &TCC0 ) == 0 );
|
||||
<a name="l00242"></a>00242
|
||||
<a name="l00243"></a>00243 <span class="comment">/* Clear overflow flag. */</span>
|
||||
<a name="l00244"></a>00244 <a class="code" href="TC__driver_8h.html#edc4d516e9f796432730cc7fa61e81d9" title="Clears the Timer/Counter overflow flag.">TC_ClearOverflowFlag</a>( &TCC0 );
|
||||
<a name="l00245"></a>00245
|
||||
<a name="l00246"></a>00246 } <span class="keywordflow">while</span> (1);
|
||||
<a name="l00247"></a>00247 }
|
||||
</pre></div>
|
||||
<p>
|
||||
|
||||
<p>
|
||||
<div class="dynheader">
|
||||
Here is the call graph for this function:</div>
|
||||
<div class="dynsection">
|
||||
<p><center><img src="TC__example_8c_6efa69f5cda8cc01efb9cb61701e5f54_cgraph.png" border="0" usemap="#TC__example_8c_6efa69f5cda8cc01efb9cb61701e5f54_cgraph_map" alt=""></center>
|
||||
<map name="TC__example_8c_6efa69f5cda8cc01efb9cb61701e5f54_cgraph_map">
|
||||
<area shape="rect" href="TC__driver_8c.html#1a5b3ccf2b872dcdf8f4162e5cdc6e81" title="Configures clock source for the Timer/Counter 0." alt="" coords="137,5,308,32"><area shape="rect" href="TC__driver_8c.html#45e98ab822bfcd2e284c13fddac90f32" title="Configures the Waveform Generation Mode for the Timer/Counter 0." alt="" coords="159,56,287,83"><area shape="rect" href="TC__driver_8c.html#e6b05576247ef4109e9249ea4f8e6b28" title="Enables compare/capture channels for Timer/Counter 0." alt="" coords="137,107,308,133"></map>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div><p>
|
||||
<a class="anchor" name="bda6c77ac6c320173195b6371eba5a5b"></a><!-- doxytag: member="TC_example.c::Example5" ref="bda6c77ac6c320173195b6371eba5a5b" args="(void)" -->
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">void Example5 </td>
|
||||
<td>(</td>
|
||||
<td class="paramtype">void </td>
|
||||
<td class="paramname"> </td>
|
||||
<td> ) </td>
|
||||
<td width="100%"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="memdoc">
|
||||
|
||||
<p>
|
||||
This example shows how to configure TCC0 to count events.
|
||||
<p>
|
||||
This function implements example 5, "Event Counting" from the "Getting Started" section of application note AVR1306.<p>
|
||||
This example shows how to configure TCC0 to count the number of switch presses for a switch connected to PC0. PD0 is used as output and will be toggled for every 5 switch presses on PC0.
|
||||
<p>Definition at line <a class="el" href="TC__example_8c-source.html#l00259">259</a> of file <a class="el" href="TC__example_8c-source.html">TC_example.c</a>.</p>
|
||||
|
||||
<p>References <a class="el" href="TC__driver_8c-source.html#l00079">TC0_ConfigClockSource()</a>, <a class="el" href="TC__driver_8c-source.html#l00271">TC0_SetOverflowIntLevel()</a>, and <a class="el" href="TC__driver_8h-source.html#l00148">TC_SetPeriod</a>.</p>
|
||||
<div class="fragment"><pre class="fragment"><a name="l00260"></a>00260 {
|
||||
<a name="l00261"></a>00261 <span class="comment">/* Configure PORTC as input on PC0, sense on falling edge. */</span>
|
||||
<a name="l00262"></a>00262 PORTC.PIN0CTRL = PORT_ISC_RISING_gc;
|
||||
<a name="l00263"></a>00263 PORTC.DIRCLR = 0x01;
|
||||
<a name="l00264"></a>00264
|
||||
<a name="l00265"></a>00265 <span class="comment">/* Configure PORTD as output on PD0. */</span>
|
||||
<a name="l00266"></a>00266 PORTD.DIRSET = 0x01;
|
||||
<a name="l00267"></a>00267
|
||||
<a name="l00268"></a>00268 <span class="comment">/* Select PC0 as input to event channel 0, enable filtering. */</span>
|
||||
<a name="l00269"></a>00269 EVSYS.CH0MUX = EVSYS_CHMUX_PORTC_PIN0_gc;
|
||||
<a name="l00270"></a>00270 EVSYS.CH0CTRL = EVSYS_DIGFILT_8SAMPLES_gc;
|
||||
<a name="l00271"></a>00271
|
||||
<a name="l00272"></a>00272 <span class="comment">/* Set period ( TOP value ). */</span>
|
||||
<a name="l00273"></a>00273 <a class="code" href="TC__driver_8h.html#4faaf2813b83a03cd6d3720fa884bfe4" title="Sets the timer period.">TC_SetPeriod</a>( &TCC0, 4 );
|
||||
<a name="l00274"></a>00274
|
||||
<a name="l00275"></a>00275 <span class="comment">/* Enable overflow interrupt at low level */</span>
|
||||
<a name="l00276"></a>00276 <a class="code" href="TC__driver_8c.html#5630e34078d4a93db2a655703c13c71a" title="Sets the overflow interrupt level.">TC0_SetOverflowIntLevel</a>( &TCC0, TC_OVFINTLVL_LO_gc );
|
||||
<a name="l00277"></a>00277 PMIC.CTRL |= PMIC_LOLVLEN_bm;
|
||||
<a name="l00278"></a>00278
|
||||
<a name="l00279"></a>00279 sei();
|
||||
<a name="l00280"></a>00280
|
||||
<a name="l00281"></a>00281 <span class="comment">/* Start Timer/Counter. */</span>
|
||||
<a name="l00282"></a>00282 <a class="code" href="TC__driver_8c.html#1a5b3ccf2b872dcdf8f4162e5cdc6e81" title="Configures clock source for the Timer/Counter 0.">TC0_ConfigClockSource</a>( &TCC0, TC_CLKSEL_EVCH0_gc );
|
||||
<a name="l00283"></a>00283
|
||||
<a name="l00284"></a>00284 <span class="keywordflow">do</span> {
|
||||
<a name="l00285"></a>00285 <span class="comment">/* Wait for user input. */</span>
|
||||
<a name="l00286"></a>00286 } <span class="keywordflow">while</span> (1);
|
||||
<a name="l00287"></a>00287 }
|
||||
</pre></div>
|
||||
<p>
|
||||
|
||||
<p>
|
||||
<div class="dynheader">
|
||||
Here is the call graph for this function:</div>
|
||||
<div class="dynsection">
|
||||
<p><center><img src="TC__example_8c_bda6c77ac6c320173195b6371eba5a5b_cgraph.png" border="0" usemap="#TC__example_8c_bda6c77ac6c320173195b6371eba5a5b_cgraph_map" alt=""></center>
|
||||
<map name="TC__example_8c_bda6c77ac6c320173195b6371eba5a5b_cgraph_map">
|
||||
<area shape="rect" href="TC__driver_8c.html#1a5b3ccf2b872dcdf8f4162e5cdc6e81" title="Configures clock source for the Timer/Counter 0." alt="" coords="139,5,309,32"><area shape="rect" href="TC__driver_8c.html#5630e34078d4a93db2a655703c13c71a" title="Sets the overflow interrupt level." alt="" coords="136,56,312,83"></map>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div><p>
|
||||
<a class="anchor" name="f66b2c4ef70a32b9596a9442439a4dc2"></a><!-- doxytag: member="TC_example.c::Example6" ref="f66b2c4ef70a32b9596a9442439a4dc2" args="(void)" -->
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">void Example6 </td>
|
||||
<td>(</td>
|
||||
<td class="paramtype">void </td>
|
||||
<td class="paramname"> </td>
|
||||
<td> ) </td>
|
||||
<td width="100%"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="memdoc">
|
||||
|
||||
<p>
|
||||
This example shows how to configure Timer/Counter for 32-bit counting with input capture.
|
||||
<p>
|
||||
This function implements example 6, "Setting up a 32-bit Timer/Counter With Input Capture" from the "Getting Started" section of application note AVR1306.<p>
|
||||
This example shows how to configure TCC0 and TCC1 for 32-bit Timer/Counter operation with input capture. The overflow from TCC0 is routed through event channel 0 to TCC1. An input capture is triggered by a falling edge on PC0, routed through event channel 1.
|
||||
<p>Definition at line <a class="el" href="TC__example_8c-source.html#l00309">309</a> of file <a class="el" href="TC__example_8c-source.html">TC_example.c</a>.</p>
|
||||
|
||||
<p>References <a class="el" href="TC__driver_8c-source.html#l00079">TC0_ConfigClockSource()</a>, <a class="el" href="TC__driver_8c-source.html#l00137">TC0_ConfigInputCapture()</a>, <a class="el" href="TC__driver_8c-source.html#l00182">TC0_EnableCCChannels()</a>, <a class="el" href="TC__driver_8c-source.html#l00092">TC1_ConfigClockSource()</a>, <a class="el" href="TC__driver_8c-source.html#l00156">TC1_ConfigInputCapture()</a>, <a class="el" href="TC__driver_8c-source.html#l00207">TC1_EnableCCChannels()</a>, <a class="el" href="TC__driver_8h-source.html#l00074">TC_EnableEventDelay</a>, <a class="el" href="TC__driver_8h-source.html#l00354">TC_GetCaptureA</a>, and <a class="el" href="TC__driver_8h-source.html#l00258">TC_GetCCAFlag</a>.</p>
|
||||
<div class="fragment"><pre class="fragment"><a name="l00310"></a>00310 {
|
||||
<a name="l00311"></a>00311 uint32_t inputCaptureTime;
|
||||
<a name="l00312"></a>00312
|
||||
<a name="l00313"></a>00313 <span class="comment">/* Configure PC0 for input, triggered on falling edge. */</span>
|
||||
<a name="l00314"></a>00314 PORTC.PIN0CTRL = PORT_ISC_FALLING_gc;
|
||||
<a name="l00315"></a>00315 PORTC.DIRCLR = 0x01;
|
||||
<a name="l00316"></a>00316
|
||||
<a name="l00317"></a>00317 <span class="comment">/* Configure PORTD as output. */</span>
|
||||
<a name="l00318"></a>00318 PORTD.DIRSET = 0xFF;
|
||||
<a name="l00319"></a>00319
|
||||
<a name="l00320"></a>00320 <span class="comment">/* Use PC0 as multiplexer input for event channel 1. */</span>
|
||||
<a name="l00321"></a>00321 EVSYS.CH1MUX = EVSYS_CHMUX_PORTC_PIN0_gc;
|
||||
<a name="l00322"></a>00322
|
||||
<a name="l00323"></a>00323 <span class="comment">/* Use TCC0 overflow as input for event channel 0. */</span>
|
||||
<a name="l00324"></a>00324 EVSYS.CH0MUX = EVSYS_CHMUX_TCC0_OVF_gc;
|
||||
<a name="l00325"></a>00325
|
||||
<a name="l00326"></a>00326 <span class="comment">/* Configure TCC0 and TCC1 for input capture with event channel 1 as</span>
|
||||
<a name="l00327"></a>00327 <span class="comment"> * trigger source.</span>
|
||||
<a name="l00328"></a>00328 <span class="comment"> */</span>
|
||||
<a name="l00329"></a>00329 <a class="code" href="TC__driver_8c.html#309a2ca4eaf39437b57ca13edb23b70b" title="Configures the Timer/Counter 0 for input capture operation.">TC0_ConfigInputCapture</a>( &TCC0, TC_EVSEL_CH1_gc );
|
||||
<a name="l00330"></a>00330 <a class="code" href="TC__driver_8c.html#8d41d6b130f6fd3928e8198e9bf9512b" title="Configures the Timer/Counter 1 for input capture operation.">TC1_ConfigInputCapture</a>( &TCC1, TC_EVSEL_CH1_gc );
|
||||
<a name="l00331"></a>00331
|
||||
<a name="l00332"></a>00332 <span class="comment">/* Enable event delay on TCC1. */</span>
|
||||
<a name="l00333"></a>00333 <a class="code" href="TC__driver_8h.html#4b1fa59d76f86ced01740b22278ba23b" title="Enables the event delay for this TC.">TC_EnableEventDelay</a>( &TCC1 );
|
||||
<a name="l00334"></a>00334
|
||||
<a name="l00335"></a>00335 <span class="comment">/* Enable input capture channel A on TCC0 and TCC1 */</span>
|
||||
<a name="l00336"></a>00336 <a class="code" href="TC__driver_8c.html#e6b05576247ef4109e9249ea4f8e6b28" title="Enables compare/capture channels for Timer/Counter 0.">TC0_EnableCCChannels</a>( &TCC0, TC0_CCAEN_bm );
|
||||
<a name="l00337"></a>00337 <a class="code" href="TC__driver_8c.html#41d8a44ed53255f2bb991a2aab3bf031" title="Enables compare/capture channels for Timer/Counter 1.">TC1_EnableCCChannels</a>( &TCC1, TC1_CCAEN_bm );
|
||||
<a name="l00338"></a>00338
|
||||
<a name="l00339"></a>00339 <span class="comment">/* Use event channel 0 as clock source for TCC1. */</span>
|
||||
<a name="l00340"></a>00340 <a class="code" href="TC__driver_8c.html#ef27c3126f89d13b02732de352bff21f" title="Configures clock source for the Timer/Counter 1.">TC1_ConfigClockSource</a>( &TCC1, TC_CLKSEL_EVCH0_gc );
|
||||
<a name="l00341"></a>00341
|
||||
<a name="l00342"></a>00342 <span class="comment">/* Select system clock as TCC0 clock source. */</span>
|
||||
<a name="l00343"></a>00343 <a class="code" href="TC__driver_8c.html#1a5b3ccf2b872dcdf8f4162e5cdc6e81" title="Configures clock source for the Timer/Counter 0.">TC0_ConfigClockSource</a>( &TCC0, TC_CLKSEL_DIV1_gc );
|
||||
<a name="l00344"></a>00344
|
||||
<a name="l00345"></a>00345 <span class="keywordflow">do</span> {
|
||||
<a name="l00346"></a>00346 <span class="keywordflow">do</span> {
|
||||
<a name="l00347"></a>00347 <span class="comment">/* Wait for Input Capture. */</span>
|
||||
<a name="l00348"></a>00348 } <span class="keywordflow">while</span> ( <a class="code" href="TC__driver_8h.html#5b1d20f74d1a3083b536f27017f45767" title="Get the status for Compare or Capture channel A.">TC_GetCCAFlag</a>( &TCC0 ) == 0 );
|
||||
<a name="l00349"></a>00349
|
||||
<a name="l00350"></a>00350 uint16_t highWord = <a class="code" href="TC__driver_8h.html#047c98cc70b77b9133143155a575a2db" title="Reads the first available input capture value for channel A.">TC_GetCaptureA</a>( &TCC1 );
|
||||
<a name="l00351"></a>00351 uint16_t lowWord = <a class="code" href="TC__driver_8h.html#047c98cc70b77b9133143155a575a2db" title="Reads the first available input capture value for channel A.">TC_GetCaptureA</a>( &TCC0 );
|
||||
<a name="l00352"></a>00352 inputCaptureTime = ( (uint32_t) highWord << 16 ) | lowWord;
|
||||
<a name="l00353"></a>00353
|
||||
<a name="l00354"></a>00354 PORTD.OUT = (uint8_t) (inputCaptureTime >> 24);
|
||||
<a name="l00355"></a>00355
|
||||
<a name="l00356"></a>00356 } <span class="keywordflow">while</span> (1);
|
||||
<a name="l00357"></a>00357
|
||||
<a name="l00358"></a>00358 }
|
||||
</pre></div>
|
||||
<p>
|
||||
|
||||
<p>
|
||||
<div class="dynheader">
|
||||
Here is the call graph for this function:</div>
|
||||
<div class="dynsection">
|
||||
<p><center><img src="TC__example_8c_f66b2c4ef70a32b9596a9442439a4dc2_cgraph.png" border="0" usemap="#TC__example_8c_f66b2c4ef70a32b9596a9442439a4dc2_cgraph_map" alt=""></center>
|
||||
<map name="TC__example_8c_f66b2c4ef70a32b9596a9442439a4dc2_cgraph_map">
|
||||
<area shape="rect" href="TC__driver_8c.html#1a5b3ccf2b872dcdf8f4162e5cdc6e81" title="Configures clock source for the Timer/Counter 0." alt="" coords="137,5,308,32"><area shape="rect" href="TC__driver_8c.html#309a2ca4eaf39437b57ca13edb23b70b" title="Configures the Timer/Counter 0 for input capture operation." alt="" coords="137,56,308,83"><area shape="rect" href="TC__driver_8c.html#e6b05576247ef4109e9249ea4f8e6b28" title="Enables compare/capture channels for Timer/Counter 0." alt="" coords="137,107,308,133"><area shape="rect" href="TC__driver_8c.html#ef27c3126f89d13b02732de352bff21f" title="Configures clock source for the Timer/Counter 1." alt="" coords="137,157,308,184"><area shape="rect" href="TC__driver_8c.html#8d41d6b130f6fd3928e8198e9bf9512b" title="Configures the Timer/Counter 1 for input capture operation." alt="" coords="137,208,308,235"><area shape="rect" href="TC__driver_8c.html#41d8a44ed53255f2bb991a2aab3bf031" title="Enables compare/capture channels for Timer/Counter 1." alt="" coords="137,259,308,285"></map>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div><p>
|
||||
<a class="anchor" name="04b2181bef53144f030b82c4d88a7bc8"></a><!-- doxytag: member="TC_example.c::ISR" ref="04b2181bef53144f030b82c4d88a7bc8" args="(TCC0_OVF_vect)" -->
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">ISR </td>
|
||||
<td>(</td>
|
||||
<td class="paramtype">TCC0_OVF_vect </td>
|
||||
<td class="paramname"> </td>
|
||||
<td> ) </td>
|
||||
<td width="100%"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="memdoc">
|
||||
|
||||
<p>
|
||||
|
||||
<p>Definition at line <a class="el" href="TC__example_8c-source.html#l00290">290</a> of file <a class="el" href="TC__example_8c-source.html">TC_example.c</a>.</p>
|
||||
<div class="fragment"><pre class="fragment"><a name="l00291"></a>00291 {
|
||||
<a name="l00292"></a>00292 <span class="comment">/* Toggle PD0 output after 5 switch presses. */</span>
|
||||
<a name="l00293"></a>00293 PORTD.OUTTGL = 0x01;
|
||||
<a name="l00294"></a>00294 }
|
||||
</pre></div>
|
||||
<p>
|
||||
|
||||
</div>
|
||||
</div><p>
|
||||
<a class="anchor" name="0763252836531eeb42258e71bf9710be"></a><!-- doxytag: member="TC_example.c::ISR" ref="0763252836531eeb42258e71bf9710be" args="(TCC0_CCA_vect)" -->
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">ISR </td>
|
||||
<td>(</td>
|
||||
<td class="paramtype">TCC0_CCA_vect </td>
|
||||
<td class="paramname"> </td>
|
||||
<td> ) </td>
|
||||
<td width="100%"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="memdoc">
|
||||
|
||||
<p>
|
||||
|
||||
<p>Definition at line <a class="el" href="TC__example_8c-source.html#l00180">180</a> of file <a class="el" href="TC__example_8c-source.html">TC_example.c</a>.</p>
|
||||
|
||||
<p>References <a class="el" href="TC__example_8c-source.html#l00052">CPU_PRESCALER</a>, <a class="el" href="avr__compiler_8h-source.html#l00050">F_CPU</a>, <a class="el" href="TC__driver_8h-source.html#l00354">TC_GetCaptureA</a>, and <a class="el" href="TC__driver_8h-source.html#l00126">TC_Restart</a>.</p>
|
||||
<div class="fragment"><pre class="fragment"><a name="l00181"></a>00181 {
|
||||
<a name="l00182"></a>00182 <span class="keyword">static</span> uint32_t frequency;
|
||||
<a name="l00183"></a>00183 <span class="keyword">static</span> uint32_t dutyCycle;
|
||||
<a name="l00184"></a>00184 <span class="keyword">static</span> uint16_t totalPeriod;
|
||||
<a name="l00185"></a>00185 <span class="keyword">static</span> uint16_t highPeriod;
|
||||
<a name="l00186"></a>00186
|
||||
<a name="l00187"></a>00187 uint16_t thisCapture = <a class="code" href="TC__driver_8h.html#047c98cc70b77b9133143155a575a2db" title="Reads the first available input capture value for channel A.">TC_GetCaptureA</a>( &TCC0 );
|
||||
<a name="l00188"></a>00188
|
||||
<a name="l00189"></a>00189 <span class="comment">/* Save total period based on rising edge and reset counter. */</span>
|
||||
<a name="l00190"></a>00190 <span class="keywordflow">if</span> ( thisCapture & 0x8000 ) {
|
||||
<a name="l00191"></a>00191 totalPeriod = thisCapture & 0x7FFF;
|
||||
<a name="l00192"></a>00192 <a class="code" href="TC__driver_8h.html#0a837eeef0e057214725bfcd57688a7c" title="Restart the Timer/Counter.">TC_Restart</a>( &TCC0 );
|
||||
<a name="l00193"></a>00193 }
|
||||
<a name="l00194"></a>00194 <span class="comment">/* Calculate duty cycle based on time from reset and falling edge. */</span>
|
||||
<a name="l00195"></a>00195 <span class="keywordflow">else</span> {
|
||||
<a name="l00196"></a>00196 highPeriod = thisCapture;
|
||||
<a name="l00197"></a>00197 }
|
||||
<a name="l00198"></a>00198
|
||||
<a name="l00199"></a>00199 dutyCycle = ( ( ( highPeriod * 100 ) / totalPeriod ) + dutyCycle ) / 2;
|
||||
<a name="l00200"></a>00200 frequency = ( ( ( <a class="code" href="avr__compiler_8h.html#43bafb28b29491ec7f871319b5a3b2f8" title="Define default CPU frequency, if this is not already defined.">F_CPU</a> / <a class="code" href="TC__example_8c.html#945ebdbcd5f4e6a81f5ab930fd046cd5">CPU_PRESCALER</a> ) / totalPeriod ) + frequency ) / 2;
|
||||
<a name="l00201"></a>00201 }
|
||||
</pre></div>
|
||||
<p>
|
||||
|
||||
</div>
|
||||
</div><p>
|
||||
<a class="anchor" name="840291bc02cba5474a4cb46a9b9566fe"></a><!-- doxytag: member="TC_example.c::main" ref="840291bc02cba5474a4cb46a9b9566fe" args="(void)" -->
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">int main </td>
|
||||
<td>(</td>
|
||||
<td class="paramtype">void </td>
|
||||
<td class="paramname"> </td>
|
||||
<td> ) </td>
|
||||
<td width="100%"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="memdoc">
|
||||
|
||||
<p>
|
||||
|
||||
<p>Definition at line <a class="el" href="TC__example_8c-source.html#l00070">70</a> of file <a class="el" href="TC__example_8c-source.html">TC_example.c</a>.</p>
|
||||
|
||||
<p>References <a class="el" href="TC__example_8c-source.html#l00086">Example1()</a>.</p>
|
||||
<div class="fragment"><pre class="fragment"><a name="l00071"></a>00071 {
|
||||
<a name="l00072"></a>00072 <a class="code" href="TC__example_8c.html#b899c7aa870825aec068df494bbfd714" title="This example shows how to configure TCC0 for basic timer operation.">Example1</a>();
|
||||
<a name="l00073"></a>00073 <span class="comment">/*Example2();*/</span>
|
||||
<a name="l00074"></a>00074 <span class="comment">/*Example3();*/</span>
|
||||
<a name="l00075"></a>00075 <span class="comment">/*Example4();*/</span>
|
||||
<a name="l00076"></a>00076 <span class="comment">/*Example5();*/</span>
|
||||
<a name="l00077"></a>00077 <span class="comment">/*Example6();*/</span>
|
||||
<a name="l00078"></a>00078 }
|
||||
</pre></div>
|
||||
<p>
|
||||
|
||||
<p>
|
||||
<div class="dynheader">
|
||||
Here is the call graph for this function:</div>
|
||||
<div class="dynsection">
|
||||
<p><center><img src="TC__example_8c_840291bc02cba5474a4cb46a9b9566fe_cgraph.png" border="0" usemap="#TC__example_8c_840291bc02cba5474a4cb46a9b9566fe_cgraph_map" alt=""></center>
|
||||
<map name="TC__example_8c_840291bc02cba5474a4cb46a9b9566fe_cgraph_map">
|
||||
<area shape="rect" href="TC__example_8c.html#b899c7aa870825aec068df494bbfd714" title="This example shows how to configure TCC0 for basic timer operation." alt="" coords="105,5,185,32"><area shape="rect" href="TC__driver_8c.html#1a5b3ccf2b872dcdf8f4162e5cdc6e81" title="Configures clock source for the Timer/Counter 0." alt="" coords="235,5,405,32"></map>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div><p>
|
||||
</div>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
|
||||
<title>@DOC_TITLE@</title>
|
||||
<link href="doxygen.css" rel="stylesheet" type="text/css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<table width="100%" height="10%" bgcolor="#FFFFFF">
|
||||
<tr>
|
||||
<td colspan="6" height="1" background="blue.gif"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="6">
|
||||
<address style="align: right;"><small>
|
||||
Generated on Wed Apr 23 07:45:46 2008 for AVR1306 Using the XMEGA Timer/Counter by <a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border=0></a> 1.5.5</small></address>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
@@ -0,0 +1,4 @@
|
||||
<area shape="rect" href="$TC__driver_8c.html#1a5b3ccf2b872dcdf8f4162e5cdc6e81" title="Configures clock source for the Timer/Counter 0." alt="" coords="137,5,308,32">
|
||||
<area shape="rect" href="$TC__driver_8c.html#309a2ca4eaf39437b57ca13edb23b70b" title="Configures the Timer/Counter 0 for input capture operation." alt="" coords="137,56,308,83">
|
||||
<area shape="rect" href="$TC__driver_8c.html#e6b05576247ef4109e9249ea4f8e6b28" title="Enables compare/capture channels for Timer/Counter 0." alt="" coords="137,107,308,133">
|
||||
<area shape="rect" href="$TC__driver_8c.html#9dc297c8345a7b55099ab0b63454e109" title="Sets the interrupt level for compare/capture channel A interrupt." alt="" coords="148,157,297,184">
|
||||
@@ -0,0 +1 @@
|
||||
8d05a8f0f9d6557ae0d2ef9760457b77
|
||||
@@ -0,0 +1,3 @@
|
||||
<area shape="rect" href="$TC__driver_8c.html#1a5b3ccf2b872dcdf8f4162e5cdc6e81" title="Configures clock source for the Timer/Counter 0." alt="" coords="137,5,308,32">
|
||||
<area shape="rect" href="$TC__driver_8c.html#45e98ab822bfcd2e284c13fddac90f32" title="Configures the Waveform Generation Mode for the Timer/Counter 0." alt="" coords="159,56,287,83">
|
||||
<area shape="rect" href="$TC__driver_8c.html#e6b05576247ef4109e9249ea4f8e6b28" title="Enables compare/capture channels for Timer/Counter 0." alt="" coords="137,107,308,133">
|
||||
@@ -0,0 +1 @@
|
||||
47ecb9fbe16c1eaef066ff284a53690c
|
||||
@@ -0,0 +1,3 @@
|
||||
<area shape="rect" href="$TC__driver_8c.html#1a5b3ccf2b872dcdf8f4162e5cdc6e81" title="Configures clock source for the Timer/Counter 0." alt="" coords="137,5,308,32">
|
||||
<area shape="rect" href="$TC__driver_8c.html#309a2ca4eaf39437b57ca13edb23b70b" title="Configures the Timer/Counter 0 for input capture operation." alt="" coords="137,56,308,83">
|
||||
<area shape="rect" href="$TC__driver_8c.html#e6b05576247ef4109e9249ea4f8e6b28" title="Enables compare/capture channels for Timer/Counter 0." alt="" coords="137,107,308,133">
|
||||
@@ -0,0 +1 @@
|
||||
41a898fd2eff09783920a290f4dbeead
|
||||
@@ -0,0 +1,2 @@
|
||||
<area shape="rect" href="$TC__example_8c.html#b899c7aa870825aec068df494bbfd714" title="This example shows how to configure TCC0 for basic timer operation." alt="" coords="105,5,185,32">
|
||||
<area shape="rect" href="$TC__driver_8c.html#1a5b3ccf2b872dcdf8f4162e5cdc6e81" title="Configures clock source for the Timer/Counter 0." alt="" coords="235,5,405,32">
|
||||
@@ -0,0 +1 @@
|
||||
8d19d971a1517fe2b573ddead93f8609
|
||||
@@ -0,0 +1,2 @@
|
||||
<area shape="rect" href="$avr__compiler_8h.html" title="This file implements some macros that makes the IAR C-compiler and avr-gcc work with..." alt="" coords="76,155,185,181">
|
||||
<area shape="rect" href="$TC__driver_8h.html" title="XMEGA Timer/Counter driver header file." alt="" coords="127,80,220,107">
|
||||
@@ -0,0 +1 @@
|
||||
5f3b03c566d487e6b99baad2f83787cb
|
||||
@@ -0,0 +1 @@
|
||||
<area shape="rect" href="$TC__driver_8c.html#1a5b3ccf2b872dcdf8f4162e5cdc6e81" title="Configures clock source for the Timer/Counter 0." alt="" coords="136,5,307,32">
|
||||
@@ -0,0 +1 @@
|
||||
e773b6d3619794c953d719b73b0004a3
|
||||
@@ -0,0 +1,2 @@
|
||||
<area shape="rect" href="$TC__driver_8c.html#1a5b3ccf2b872dcdf8f4162e5cdc6e81" title="Configures clock source for the Timer/Counter 0." alt="" coords="139,5,309,32">
|
||||
<area shape="rect" href="$TC__driver_8c.html#5630e34078d4a93db2a655703c13c71a" title="Sets the overflow interrupt level." alt="" coords="136,56,312,83">
|
||||
@@ -0,0 +1 @@
|
||||
e603f6761dc931a43a0787804638c4a2
|
||||
@@ -0,0 +1,6 @@
|
||||
<area shape="rect" href="$TC__driver_8c.html#1a5b3ccf2b872dcdf8f4162e5cdc6e81" title="Configures clock source for the Timer/Counter 0." alt="" coords="137,5,308,32">
|
||||
<area shape="rect" href="$TC__driver_8c.html#309a2ca4eaf39437b57ca13edb23b70b" title="Configures the Timer/Counter 0 for input capture operation." alt="" coords="137,56,308,83">
|
||||
<area shape="rect" href="$TC__driver_8c.html#e6b05576247ef4109e9249ea4f8e6b28" title="Enables compare/capture channels for Timer/Counter 0." alt="" coords="137,107,308,133">
|
||||
<area shape="rect" href="$TC__driver_8c.html#ef27c3126f89d13b02732de352bff21f" title="Configures clock source for the Timer/Counter 1." alt="" coords="137,157,308,184">
|
||||
<area shape="rect" href="$TC__driver_8c.html#8d41d6b130f6fd3928e8198e9bf9512b" title="Configures the Timer/Counter 1 for input capture operation." alt="" coords="137,208,308,235">
|
||||
<area shape="rect" href="$TC__driver_8c.html#41d8a44ed53255f2bb991a2aab3bf031" title="Enables compare/capture channels for Timer/Counter 1." alt="" coords="137,259,308,285">
|
||||
@@ -0,0 +1 @@
|
||||
05628a12508f9ca818ca8b47bd25609c
|
||||
@@ -0,0 +1,21 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
|
||||
<title>@DOC_TITLE@</title>
|
||||
<link href="$relpath$doxygen.css" rel="stylesheet" type="text/css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<table width="100%" height="10%" bgcolor="#FFFFFF">
|
||||
<tr>
|
||||
<td colspan="6" height="1" background="blue.gif"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="6">
|
||||
<address style="align: right;"><small>
|
||||
Generated on $datetime for $projectname by <a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border=0></a> $doxygenversion</small></address>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
@@ -0,0 +1,18 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
|
||||
<title>@DOC_TITLE@</title>
|
||||
<link href="$relpath$doxygen.css" rel="stylesheet" type="text/css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<table width="100%" height="10%" bgcolor="#FFFFFF">
|
||||
<tr>
|
||||
<td colspan="2"><p><A href=http://www.atmel.com ><img src="atmel.jpg"/ border=0></A></p><br /></td>
|
||||
<td colspan="2"> <strong><font face="Helvetica" color="#000000" size="+3">Xmega Application Note</font></strong></td>
|
||||
<td colspan="2"><p><A href=http://www.atmel.com/products/AVR><img src="AVR_logo_blue.gif"/ border=0></A></p><br /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="6" height="1" background="blue.gif"></td>
|
||||
</tr>
|
||||
</table>
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 32 KiB |
@@ -0,0 +1,121 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
|
||||
<title>@DOC_TITLE@</title>
|
||||
<link href="doxygen.css" rel="stylesheet" type="text/css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<table width="100%" height="10%" bgcolor="#FFFFFF">
|
||||
<tr>
|
||||
<td colspan="2"><p><A href=http://www.atmel.com ><img src="atmel.jpg"/ border=0></A></p><br /></td>
|
||||
<td colspan="2"> <strong><font face="Helvetica" color="#000000" size="+3">Xmega Application Note</font></strong></td>
|
||||
<td colspan="2"><p><A href=http://www.atmel.com/products/AVR><img src="AVR_logo_blue.gif"/ border=0></A></p><br /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="6" height="1" background="blue.gif"></td>
|
||||
</tr>
|
||||
</table>
|
||||
<!-- Generated by Doxygen 1.5.5 -->
|
||||
<h1>avr_compiler.h</h1><a href="avr__compiler_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* This file has been prepared for Doxygen automatic documentation generation.*/</span>
|
||||
<a name="l00045"></a>00045 <span class="preprocessor">#ifndef COMPILER_AVR_H</span>
|
||||
<a name="l00046"></a>00046 <span class="preprocessor"></span><span class="preprocessor">#define COMPILER_AVR_H</span>
|
||||
<a name="l00047"></a>00047 <span class="preprocessor"></span>
|
||||
<a name="l00048"></a>00048 <span class="preprocessor">#ifndef F_CPU</span>
|
||||
<a name="l00049"></a>00049 <span class="preprocessor"></span>
|
||||
<a name="l00050"></a><a class="code" href="avr__compiler_8h.html#43bafb28b29491ec7f871319b5a3b2f8">00050</a> <span class="preprocessor">#define F_CPU 2000000UL</span>
|
||||
<a name="l00051"></a>00051 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
|
||||
<a name="l00052"></a>00052 <span class="preprocessor"></span>
|
||||
<a name="l00053"></a>00053 <span class="preprocessor">#include <stdint.h></span>
|
||||
<a name="l00054"></a>00054 <span class="preprocessor">#include <stdbool.h></span>
|
||||
<a name="l00055"></a>00055 <span class="preprocessor">#include <stdlib.h></span>
|
||||
<a name="l00056"></a>00056
|
||||
<a name="l00058"></a><a class="code" href="avr__compiler_8h.html#0a4fb62f9e69209c9c8c8e34ebb3df6f">00058</a> <span class="preprocessor">#define AVR_ENTER_CRITICAL_REGION( ) uint8_t volatile saved_sreg = SREG; \</span>
|
||||
<a name="l00059"></a>00059 <span class="preprocessor"> cli();</span>
|
||||
<a name="l00060"></a>00060 <span class="preprocessor"></span>
|
||||
<a name="l00064"></a><a class="code" href="avr__compiler_8h.html#770b47b04eec57748be0826a3d23503b">00064</a> <span class="preprocessor">#define AVR_LEAVE_CRITICAL_REGION( ) SREG = saved_sreg;</span>
|
||||
<a name="l00065"></a>00065 <span class="preprocessor"></span>
|
||||
<a name="l00066"></a>00066 <span class="preprocessor">#if defined( __ICCAVR__ )</span>
|
||||
<a name="l00067"></a>00067 <span class="preprocessor"></span>
|
||||
<a name="l00068"></a>00068 <span class="preprocessor">#include <inavr.h></span>
|
||||
<a name="l00069"></a>00069 <span class="preprocessor">#include <ioavr.h></span>
|
||||
<a name="l00070"></a>00070 <span class="preprocessor">#include <intrinsics.h></span>
|
||||
<a name="l00071"></a>00071 <span class="preprocessor">#include <pgmspace.h></span>
|
||||
<a name="l00072"></a>00072
|
||||
<a name="l00073"></a>00073 <span class="preprocessor">#ifndef __HAS_ELPM__</span>
|
||||
<a name="l00074"></a>00074 <span class="preprocessor"></span><span class="preprocessor">#define _MEMATTR __flash</span>
|
||||
<a name="l00075"></a>00075 <span class="preprocessor"></span><span class="preprocessor">#else </span><span class="comment">/* __HAS_ELPM__ */</span>
|
||||
<a name="l00076"></a>00076 <span class="preprocessor">#define _MEMATTR __farflash</span>
|
||||
<a name="l00077"></a>00077 <span class="preprocessor"></span><span class="preprocessor">#endif </span><span class="comment">/* __HAS_ELPM__ */</span>
|
||||
<a name="l00078"></a>00078
|
||||
<a name="l00089"></a>00089 <span class="preprocessor">#define delay_us( us ) ( __delay_cycles( ( F_CPU / 1000000UL ) * ( us ) ) )</span>
|
||||
<a name="l00090"></a>00090 <span class="preprocessor"></span>
|
||||
<a name="l00104"></a>00104 <span class="preprocessor">#define PRAGMA(x) _Pragma( #x )</span>
|
||||
<a name="l00105"></a>00105 <span class="preprocessor"></span><span class="preprocessor">#define ISR(vec) PRAGMA( vector=vec ) __interrupt void handler_##vec(void)</span>
|
||||
<a name="l00106"></a>00106 <span class="preprocessor"></span><span class="preprocessor">#define sei( ) (__enable_interrupt( ))</span>
|
||||
<a name="l00107"></a>00107 <span class="preprocessor"></span><span class="preprocessor">#define cli( ) (__disable_interrupt( ))</span>
|
||||
<a name="l00108"></a>00108 <span class="preprocessor"></span>
|
||||
<a name="l00110"></a>00110 <span class="preprocessor">#define nop( ) (__no_operation())</span>
|
||||
<a name="l00111"></a>00111 <span class="preprocessor"></span>
|
||||
<a name="l00113"></a>00113 <span class="preprocessor">#define watchdog_reset( ) (__watchdog_reset( ))</span>
|
||||
<a name="l00114"></a>00114 <span class="preprocessor"></span>
|
||||
<a name="l00115"></a>00115
|
||||
<a name="l00116"></a>00116 <span class="preprocessor">#define INLINE PRAGMA( inline=forced ) static</span>
|
||||
<a name="l00117"></a>00117 <span class="preprocessor"></span>
|
||||
<a name="l00118"></a>00118 <span class="preprocessor">#define FLASH_DECLARE(x) _MEMATTR x</span>
|
||||
<a name="l00119"></a>00119 <span class="preprocessor"></span><span class="preprocessor">#define FLASH_STRING(x) ((_MEMATTR const char *)(x))</span>
|
||||
<a name="l00120"></a>00120 <span class="preprocessor"></span><span class="preprocessor">#define FLASH_STRING_T char const _MEMATTR *</span>
|
||||
<a name="l00121"></a>00121 <span class="preprocessor"></span><span class="preprocessor">#define FLASH_BYTE_ARRAY_T uint8_t const _MEMATTR *</span>
|
||||
<a name="l00122"></a>00122 <span class="preprocessor"></span><span class="preprocessor">#define PGM_READ_BYTE(x) *(x)</span>
|
||||
<a name="l00123"></a>00123 <span class="preprocessor"></span><span class="preprocessor">#define PGM_READ_WORD(x) *(x)</span>
|
||||
<a name="l00124"></a>00124 <span class="preprocessor"></span>
|
||||
<a name="l00125"></a>00125 <span class="preprocessor">#define SHORTENUM </span>
|
||||
<a name="l00126"></a>00126 <span class="preprocessor"></span>
|
||||
<a name="l00127"></a>00127 <span class="preprocessor">#elif defined( __GNUC__ )</span>
|
||||
<a name="l00128"></a>00128 <span class="preprocessor"></span>
|
||||
<a name="l00129"></a>00129 <span class="preprocessor">#include <avr/io.h></span>
|
||||
<a name="l00130"></a>00130 <span class="preprocessor">#include <avr/interrupt.h></span>
|
||||
<a name="l00131"></a>00131 <span class="preprocessor">#include <avr/pgmspace.h></span>
|
||||
<a name="l00132"></a>00132 <span class="preprocessor">#include <util/delay.h></span>
|
||||
<a name="l00133"></a>00133
|
||||
<a name="l00135"></a>00135 <span class="preprocessor">#define delay_us( us ) (_delay_us( us ))</span>
|
||||
<a name="l00136"></a>00136 <span class="preprocessor"></span>
|
||||
<a name="l00137"></a>00137 <span class="preprocessor">#define INLINE static inline</span>
|
||||
<a name="l00138"></a>00138 <span class="preprocessor"></span>
|
||||
<a name="l00140"></a>00140 <span class="preprocessor">#define nop() do { __asm__ __volatile__ ("nop"); } while (0)</span>
|
||||
<a name="l00141"></a>00141 <span class="preprocessor"></span>
|
||||
<a name="l00142"></a>00142 <span class="preprocessor">#define MAIN_TASK_PROLOGUE int</span>
|
||||
<a name="l00143"></a>00143 <span class="preprocessor"></span>
|
||||
<a name="l00144"></a>00144
|
||||
<a name="l00145"></a>00145 <span class="preprocessor">#define MAIN_TASK_EPILOGUE() return -1;</span>
|
||||
<a name="l00146"></a>00146 <span class="preprocessor"></span>
|
||||
<a name="l00147"></a>00147 <span class="preprocessor">#define SHORTENUM __attribute__ ((packed))</span>
|
||||
<a name="l00148"></a>00148 <span class="preprocessor"></span>
|
||||
<a name="l00149"></a>00149 <span class="preprocessor">#else</span>
|
||||
<a name="l00150"></a>00150 <span class="preprocessor"></span><span class="preprocessor">#error Compiler not supported.</span>
|
||||
<a name="l00151"></a>00151 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
|
||||
<a name="l00152"></a>00152 <span class="preprocessor"></span>
|
||||
<a name="l00153"></a>00153 <span class="preprocessor">#endif</span>
|
||||
<a name="l00154"></a>00154 <span class="preprocessor"></span>
|
||||
</pre></div></div>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
|
||||
<title>@DOC_TITLE@</title>
|
||||
<link href="doxygen.css" rel="stylesheet" type="text/css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<table width="100%" height="10%" bgcolor="#FFFFFF">
|
||||
<tr>
|
||||
<td colspan="6" height="1" background="blue.gif"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="6">
|
||||
<address style="align: right;"><small>
|
||||
Generated on Wed Apr 23 07:45:44 2008 for AVR1306 Using the XMEGA Timer/Counter by <a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border=0></a> 1.5.5</small></address>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
@@ -0,0 +1,167 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
|
||||
<title>@DOC_TITLE@</title>
|
||||
<link href="doxygen.css" rel="stylesheet" type="text/css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<table width="100%" height="10%" bgcolor="#FFFFFF">
|
||||
<tr>
|
||||
<td colspan="2"><p><A href=http://www.atmel.com ><img src="atmel.jpg"/ border=0></A></p><br /></td>
|
||||
<td colspan="2"> <strong><font face="Helvetica" color="#000000" size="+3">Xmega Application Note</font></strong></td>
|
||||
<td colspan="2"><p><A href=http://www.atmel.com/products/AVR><img src="AVR_logo_blue.gif"/ border=0></A></p><br /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="6" height="1" background="blue.gif"></td>
|
||||
</tr>
|
||||
</table>
|
||||
<!-- Generated by Doxygen 1.5.5 -->
|
||||
<div class="contents">
|
||||
<h1>avr_compiler.h File Reference</h1><hr><a name="_details"></a><h2>Detailed Description</h2>
|
||||
This file implements some macros that makes the IAR C-compiler and avr-gcc work with the same code base for the AVR architecture.
|
||||
<p>
|
||||
<dl class="user" compact><dt><b>Documentation</b></dt><dd>For comprehensive code documentation, supported compilers, compiler settings and supported devices see readme.html</dd></dl>
|
||||
<dl class="author" compact><dt><b>Author:</b></dt><dd>Atmel Corporation: <a href="http://www.atmel.com">http://www.atmel.com</a> <br>
|
||||
Support email: <a href="mailto:avr@atmel.com">avr@atmel.com</a></dd></dl>
|
||||
<dl class="rcs" compact><dt><b>Revision</b></dt><dd>613 </dd></dl>
|
||||
<dl class="rcs" compact><dt><b>Date</b></dt><dd>2006-04-07 14:40:07 +0200 (fr, 07 apr 2006) </dd></dl>
|
||||
<br>
|
||||
<p>
|
||||
Copyright (c) 2008, Atmel Corporation All rights reserved.<p>
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:<p>
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.<p>
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.<p>
|
||||
3. The name of ATMEL may not be used to endorse or promote products derived from this software without specific prior written permission.<p>
|
||||
THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
<p>Definition in file <a class="el" href="avr__compiler_8h-source.html">avr_compiler.h</a>.</p>
|
||||
|
||||
<p>
|
||||
<code>#include <stdint.h></code><br>
|
||||
<code>#include <stdbool.h></code><br>
|
||||
<code>#include <stdlib.h></code><br>
|
||||
|
||||
<p>
|
||||
<div class="dynheader">
|
||||
Include dependency graph for avr_compiler.h:</div>
|
||||
<div class="dynsection">
|
||||
<p><center><img src="avr__compiler_8h__incl.png" border="0" usemap="#avr_compiler.h_map" alt=""></center>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
<div class="dynheader">
|
||||
This graph shows which files directly or indirectly include this file:</div>
|
||||
<div class="dynsection">
|
||||
<p><center><img src="avr__compiler_8h__dep__incl.png" border="0" usemap="#avr_compiler.hdep_map" alt=""></center>
|
||||
<map name="avr_compiler.hdep_map">
|
||||
<area shape="rect" href="TC__driver_8c.html" title="XMEGA Timer/Counter driver source file." alt="" coords="5,155,96,181"><area shape="rect" href="TC__driver_8h.html" title="XMEGA Timer/Counter driver header file." alt="" coords="77,80,171,107"><area shape="rect" href="TC__example_8c.html" title="XMEGA Timer/Counter example source file." alt="" coords="141,155,251,181"></map>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
<a href="avr__compiler_8h-source.html">Go to the source code of this file.</a><table border="0" cellpadding="0" cellspacing="0">
|
||||
<tr><td></td></tr>
|
||||
<tr><td colspan="2"><br><h2>Defines</h2></td></tr>
|
||||
<tr><td class="memItemLeft" nowrap align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="avr__compiler_8h.html#0a4fb62f9e69209c9c8c8e34ebb3df6f">AVR_ENTER_CRITICAL_REGION</a>()</td></tr>
|
||||
|
||||
<tr><td class="mdescLeft"> </td><td class="mdescRight">This macro will protect the following code from interrupts. <a href="#0a4fb62f9e69209c9c8c8e34ebb3df6f"></a><br></td></tr>
|
||||
<tr><td class="memItemLeft" nowrap align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="avr__compiler_8h.html#770b47b04eec57748be0826a3d23503b">AVR_LEAVE_CRITICAL_REGION</a>() SREG = saved_sreg;</td></tr>
|
||||
|
||||
<tr><td class="mdescLeft"> </td><td class="mdescRight">This macro must always be used in conjunction with AVR_ENTER_CRITICAL_REGION so the interrupts are enabled again. <a href="#770b47b04eec57748be0826a3d23503b"></a><br></td></tr>
|
||||
<tr><td class="memItemLeft" nowrap align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="avr__compiler_8h.html#43bafb28b29491ec7f871319b5a3b2f8">F_CPU</a> 2000000UL</td></tr>
|
||||
|
||||
<tr><td class="mdescLeft"> </td><td class="mdescRight">Define default CPU frequency, if this is not already defined. <a href="#43bafb28b29491ec7f871319b5a3b2f8"></a><br></td></tr>
|
||||
</table>
|
||||
<hr><h2>Define Documentation</h2>
|
||||
<a class="anchor" name="0a4fb62f9e69209c9c8c8e34ebb3df6f"></a><!-- doxytag: member="avr_compiler.h::AVR_ENTER_CRITICAL_REGION" ref="0a4fb62f9e69209c9c8c8e34ebb3df6f" args="()" -->
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">#define AVR_ENTER_CRITICAL_REGION </td>
|
||||
<td>(</td>
|
||||
</td>
|
||||
<td class="paramname"> </td>
|
||||
<td> ) </td>
|
||||
<td width="100%"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="memdoc">
|
||||
|
||||
<p>
|
||||
<b>Value:</b><div class="fragment"><pre class="fragment">uint8_t <span class="keyword">volatile</span> saved_sreg = SREG; \
|
||||
cli();
|
||||
</pre></div>This macro will protect the following code from interrupts.
|
||||
<p>
|
||||
|
||||
<p>Definition at line <a class="el" href="avr__compiler_8h-source.html#l00058">58</a> of file <a class="el" href="avr__compiler_8h-source.html">avr_compiler.h</a>.</p>
|
||||
|
||||
</div>
|
||||
</div><p>
|
||||
<a class="anchor" name="770b47b04eec57748be0826a3d23503b"></a><!-- doxytag: member="avr_compiler.h::AVR_LEAVE_CRITICAL_REGION" ref="770b47b04eec57748be0826a3d23503b" args="()" -->
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">#define AVR_LEAVE_CRITICAL_REGION </td>
|
||||
<td>(</td>
|
||||
</td>
|
||||
<td class="paramname"> </td>
|
||||
<td> ) </td>
|
||||
<td width="100%"> SREG = saved_sreg;</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="memdoc">
|
||||
|
||||
<p>
|
||||
This macro must always be used in conjunction with AVR_ENTER_CRITICAL_REGION so the interrupts are enabled again.
|
||||
<p>
|
||||
|
||||
<p>Definition at line <a class="el" href="avr__compiler_8h-source.html#l00064">64</a> of file <a class="el" href="avr__compiler_8h-source.html">avr_compiler.h</a>.</p>
|
||||
|
||||
</div>
|
||||
</div><p>
|
||||
<a class="anchor" name="43bafb28b29491ec7f871319b5a3b2f8"></a><!-- doxytag: member="avr_compiler.h::F_CPU" ref="43bafb28b29491ec7f871319b5a3b2f8" args="" -->
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">#define F_CPU 2000000UL </td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="memdoc">
|
||||
|
||||
<p>
|
||||
Define default CPU frequency, if this is not already defined.
|
||||
<p>
|
||||
|
||||
<p>Definition at line <a class="el" href="avr__compiler_8h-source.html#l00050">50</a> of file <a class="el" href="avr__compiler_8h-source.html">avr_compiler.h</a>.</p>
|
||||
|
||||
<p>Referenced by <a class="el" href="TC__example_8c-source.html#l00180">ISR()</a>.</p>
|
||||
|
||||
</div>
|
||||
</div><p>
|
||||
</div>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
|
||||
<title>@DOC_TITLE@</title>
|
||||
<link href="doxygen.css" rel="stylesheet" type="text/css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<table width="100%" height="10%" bgcolor="#FFFFFF">
|
||||
<tr>
|
||||
<td colspan="6" height="1" background="blue.gif"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="6">
|
||||
<address style="align: right;"><small>
|
||||
Generated on Wed Apr 23 07:45:45 2008 for AVR1306 Using the XMEGA Timer/Counter by <a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border=0></a> 1.5.5</small></address>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
@@ -0,0 +1,3 @@
|
||||
<area shape="rect" href="$TC__driver_8c.html" title="XMEGA Timer/Counter driver source file." alt="" coords="5,155,96,181">
|
||||
<area shape="rect" href="$TC__driver_8h.html" title="XMEGA Timer/Counter driver header file." alt="" coords="77,80,171,107">
|
||||
<area shape="rect" href="$TC__example_8c.html" title="XMEGA Timer/Counter example source file." alt="" coords="141,155,251,181">
|
||||
@@ -0,0 +1 @@
|
||||
5515486e80a18b406b2757543b1e5455
|
||||
@@ -0,0 +1 @@
|
||||
c7ffa5a6b3036679dbade9f1f77f333c
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 43 B |
@@ -0,0 +1,42 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
|
||||
<title>@DOC_TITLE@</title>
|
||||
<link href="doxygen.css" rel="stylesheet" type="text/css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<table width="100%" height="10%" bgcolor="#FFFFFF">
|
||||
<tr>
|
||||
<td colspan="2"><p><A href=http://www.atmel.com ><img src="atmel.jpg"/ border=0></A></p><br /></td>
|
||||
<td colspan="2"> <strong><font face="Helvetica" color="#000000" size="+3">Xmega Application Note</font></strong></td>
|
||||
<td colspan="2"><p><A href=http://www.atmel.com/products/AVR><img src="AVR_logo_blue.gif"/ border=0></A></p><br /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="6" height="1" background="blue.gif"></td>
|
||||
</tr>
|
||||
</table>
|
||||
<!-- Generated by Doxygen 1.5.5 -->
|
||||
<h1>documentation.h</h1><a href="documentation_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* Doxygen documentation mainpage ********************************************/</span>
|
||||
</pre></div></div>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
|
||||
<title>@DOC_TITLE@</title>
|
||||
<link href="doxygen.css" rel="stylesheet" type="text/css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<table width="100%" height="10%" bgcolor="#FFFFFF">
|
||||
<tr>
|
||||
<td colspan="6" height="1" background="blue.gif"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="6">
|
||||
<address style="align: right;"><small>
|
||||
Generated on Wed Apr 23 07:45:44 2008 for AVR1306 Using the XMEGA Timer/Counter by <a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border=0></a> 1.5.5</small></address>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
@@ -0,0 +1,49 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
|
||||
<title>@DOC_TITLE@</title>
|
||||
<link href="doxygen.css" rel="stylesheet" type="text/css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<table width="100%" height="10%" bgcolor="#FFFFFF">
|
||||
<tr>
|
||||
<td colspan="2"><p><A href=http://www.atmel.com ><img src="atmel.jpg"/ border=0></A></p><br /></td>
|
||||
<td colspan="2"> <strong><font face="Helvetica" color="#000000" size="+3">Xmega Application Note</font></strong></td>
|
||||
<td colspan="2"><p><A href=http://www.atmel.com/products/AVR><img src="AVR_logo_blue.gif"/ border=0></A></p><br /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="6" height="1" background="blue.gif"></td>
|
||||
</tr>
|
||||
</table>
|
||||
<!-- Generated by Doxygen 1.5.5 -->
|
||||
<div class="contents">
|
||||
<h1>documentation.h File Reference</h1>
|
||||
<p>
|
||||
|
||||
<p>
|
||||
<a href="documentation_8h-source.html">Go to the source code of this file.</a><table border="0" cellpadding="0" cellspacing="0">
|
||||
<tr><td></td></tr>
|
||||
</table>
|
||||
</div>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
|
||||
<title>@DOC_TITLE@</title>
|
||||
<link href="doxygen.css" rel="stylesheet" type="text/css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<table width="100%" height="10%" bgcolor="#FFFFFF">
|
||||
<tr>
|
||||
<td colspan="6" height="1" background="blue.gif"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="6">
|
||||
<address style="align: right;"><small>
|
||||
Generated on Wed Apr 23 07:45:45 2008 for AVR1306 Using the XMEGA Timer/Counter by <a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border=0></a> 1.5.5</small></address>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
@@ -0,0 +1,433 @@
|
||||
BODY,H1,H2,H3,H4,H5,H6,P,CENTER,TD,TH,UL,DL,DIV {
|
||||
font-family: Geneva, Arial, Helvetica, sans-serif;
|
||||
}
|
||||
BODY,TD {
|
||||
font-size: 90%;
|
||||
}
|
||||
H1 {
|
||||
text-align: center;
|
||||
font-size: 160%;
|
||||
}
|
||||
H2 {
|
||||
font-size: 120%;
|
||||
}
|
||||
H3 {
|
||||
font-size: 100%;
|
||||
}
|
||||
CAPTION {
|
||||
font-weight: bold
|
||||
}
|
||||
DIV.qindex {
|
||||
width: 100%;
|
||||
background-color: #e8eef2;
|
||||
border: 1px solid #84b0c7;
|
||||
text-align: center;
|
||||
margin: 2px;
|
||||
padding: 2px;
|
||||
line-height: 140%;
|
||||
}
|
||||
DIV.navpath {
|
||||
width: 100%;
|
||||
background-color: #e8eef2;
|
||||
border: 1px solid #84b0c7;
|
||||
text-align: center;
|
||||
margin: 2px;
|
||||
padding: 2px;
|
||||
line-height: 140%;
|
||||
}
|
||||
DIV.navtab {
|
||||
background-color: #e8eef2;
|
||||
border: 1px solid #84b0c7;
|
||||
text-align: center;
|
||||
margin: 2px;
|
||||
margin-right: 15px;
|
||||
padding: 2px;
|
||||
}
|
||||
TD.navtab {
|
||||
font-size: 70%;
|
||||
}
|
||||
A.qindex {
|
||||
text-decoration: none;
|
||||
font-weight: bold;
|
||||
color: #1A419D;
|
||||
}
|
||||
A.qindex:visited {
|
||||
text-decoration: none;
|
||||
font-weight: bold;
|
||||
color: #1A419D
|
||||
}
|
||||
A.qindex:hover {
|
||||
text-decoration: none;
|
||||
background-color: #ddddff;
|
||||
}
|
||||
A.qindexHL {
|
||||
text-decoration: none;
|
||||
font-weight: bold;
|
||||
background-color: #6666cc;
|
||||
color: #ffffff;
|
||||
border: 1px double #9295C2;
|
||||
}
|
||||
A.qindexHL:hover {
|
||||
text-decoration: none;
|
||||
background-color: #6666cc;
|
||||
color: #ffffff;
|
||||
}
|
||||
A.qindexHL:visited {
|
||||
text-decoration: none;
|
||||
background-color: #6666cc;
|
||||
color: #ffffff
|
||||
}
|
||||
A.el {
|
||||
text-decoration: none;
|
||||
font-weight: bold
|
||||
}
|
||||
A.elRef {
|
||||
font-weight: bold
|
||||
}
|
||||
A.code:link {
|
||||
text-decoration: none;
|
||||
font-weight: normal;
|
||||
color: #0000FF
|
||||
}
|
||||
A.code:visited {
|
||||
text-decoration: none;
|
||||
font-weight: normal;
|
||||
color: #0000FF
|
||||
}
|
||||
A.codeRef:link {
|
||||
font-weight: normal;
|
||||
color: #0000FF
|
||||
}
|
||||
A.codeRef:visited {
|
||||
font-weight: normal;
|
||||
color: #0000FF
|
||||
}
|
||||
A:hover {
|
||||
text-decoration: none;
|
||||
background-color: #f2f2ff
|
||||
}
|
||||
DL.el {
|
||||
margin-left: -1cm
|
||||
}
|
||||
.fragment {
|
||||
font-family: monospace, fixed;
|
||||
font-size: 95%;
|
||||
}
|
||||
PRE.fragment {
|
||||
border: 1px solid #CCCCCC;
|
||||
background-color: #f5f5f5;
|
||||
margin-top: 4px;
|
||||
margin-bottom: 4px;
|
||||
margin-left: 2px;
|
||||
margin-right: 8px;
|
||||
padding-left: 6px;
|
||||
padding-right: 6px;
|
||||
padding-top: 4px;
|
||||
padding-bottom: 4px;
|
||||
}
|
||||
DIV.ah {
|
||||
background-color: black;
|
||||
font-weight: bold;
|
||||
color: #ffffff;
|
||||
margin-bottom: 3px;
|
||||
margin-top: 3px
|
||||
}
|
||||
|
||||
DIV.groupHeader {
|
||||
margin-left: 16px;
|
||||
margin-top: 12px;
|
||||
margin-bottom: 6px;
|
||||
font-weight: bold;
|
||||
}
|
||||
DIV.groupText {
|
||||
margin-left: 16px;
|
||||
font-style: italic;
|
||||
font-size: 90%
|
||||
}
|
||||
BODY {
|
||||
background: white;
|
||||
color: black;
|
||||
margin-right: 20px;
|
||||
margin-left: 20px;
|
||||
}
|
||||
TD.indexkey {
|
||||
background-color: #e8eef2;
|
||||
font-weight: bold;
|
||||
padding-right : 10px;
|
||||
padding-top : 2px;
|
||||
padding-left : 10px;
|
||||
padding-bottom : 2px;
|
||||
margin-left : 0px;
|
||||
margin-right : 0px;
|
||||
margin-top : 2px;
|
||||
margin-bottom : 2px;
|
||||
border: 1px solid #CCCCCC;
|
||||
}
|
||||
TD.indexvalue {
|
||||
background-color: #e8eef2;
|
||||
font-style: italic;
|
||||
padding-right : 10px;
|
||||
padding-top : 2px;
|
||||
padding-left : 10px;
|
||||
padding-bottom : 2px;
|
||||
margin-left : 0px;
|
||||
margin-right : 0px;
|
||||
margin-top : 2px;
|
||||
margin-bottom : 2px;
|
||||
border: 1px solid #CCCCCC;
|
||||
}
|
||||
TR.memlist {
|
||||
background-color: #f0f0f0;
|
||||
}
|
||||
P.formulaDsp {
|
||||
text-align: center;
|
||||
}
|
||||
IMG.formulaDsp {
|
||||
}
|
||||
IMG.formulaInl {
|
||||
vertical-align: middle;
|
||||
}
|
||||
SPAN.keyword { color: #008000 }
|
||||
SPAN.keywordtype { color: #604020 }
|
||||
SPAN.keywordflow { color: #e08000 }
|
||||
SPAN.comment { color: #800000 }
|
||||
SPAN.preprocessor { color: #806020 }
|
||||
SPAN.stringliteral { color: #002080 }
|
||||
SPAN.charliteral { color: #008080 }
|
||||
SPAN.vhdldigit { color: #ff00ff }
|
||||
SPAN.vhdlchar { color: #000000 }
|
||||
SPAN.vhdlkeyword { color: #700070 }
|
||||
SPAN.vhdllogic { color: #ff0000 }
|
||||
|
||||
.mdescLeft {
|
||||
padding: 0px 8px 4px 8px;
|
||||
font-size: 80%;
|
||||
font-style: italic;
|
||||
background-color: #FAFAFA;
|
||||
border-top: 1px none #E0E0E0;
|
||||
border-right: 1px none #E0E0E0;
|
||||
border-bottom: 1px none #E0E0E0;
|
||||
border-left: 1px none #E0E0E0;
|
||||
margin: 0px;
|
||||
}
|
||||
.mdescRight {
|
||||
padding: 0px 8px 4px 8px;
|
||||
font-size: 80%;
|
||||
font-style: italic;
|
||||
background-color: #FAFAFA;
|
||||
border-top: 1px none #E0E0E0;
|
||||
border-right: 1px none #E0E0E0;
|
||||
border-bottom: 1px none #E0E0E0;
|
||||
border-left: 1px none #E0E0E0;
|
||||
margin: 0px;
|
||||
}
|
||||
.memItemLeft {
|
||||
padding: 1px 0px 0px 8px;
|
||||
margin: 4px;
|
||||
border-top-width: 1px;
|
||||
border-right-width: 1px;
|
||||
border-bottom-width: 1px;
|
||||
border-left-width: 1px;
|
||||
border-top-color: #E0E0E0;
|
||||
border-right-color: #E0E0E0;
|
||||
border-bottom-color: #E0E0E0;
|
||||
border-left-color: #E0E0E0;
|
||||
border-top-style: solid;
|
||||
border-right-style: none;
|
||||
border-bottom-style: none;
|
||||
border-left-style: none;
|
||||
background-color: #FAFAFA;
|
||||
font-size: 80%;
|
||||
}
|
||||
.memItemRight {
|
||||
padding: 1px 8px 0px 8px;
|
||||
margin: 4px;
|
||||
border-top-width: 1px;
|
||||
border-right-width: 1px;
|
||||
border-bottom-width: 1px;
|
||||
border-left-width: 1px;
|
||||
border-top-color: #E0E0E0;
|
||||
border-right-color: #E0E0E0;
|
||||
border-bottom-color: #E0E0E0;
|
||||
border-left-color: #E0E0E0;
|
||||
border-top-style: solid;
|
||||
border-right-style: none;
|
||||
border-bottom-style: none;
|
||||
border-left-style: none;
|
||||
background-color: #FAFAFA;
|
||||
font-size: 80%;
|
||||
}
|
||||
.memTemplItemLeft {
|
||||
padding: 1px 0px 0px 8px;
|
||||
margin: 4px;
|
||||
border-top-width: 1px;
|
||||
border-right-width: 1px;
|
||||
border-bottom-width: 1px;
|
||||
border-left-width: 1px;
|
||||
border-top-color: #E0E0E0;
|
||||
border-right-color: #E0E0E0;
|
||||
border-bottom-color: #E0E0E0;
|
||||
border-left-color: #E0E0E0;
|
||||
border-top-style: none;
|
||||
border-right-style: none;
|
||||
border-bottom-style: none;
|
||||
border-left-style: none;
|
||||
background-color: #FAFAFA;
|
||||
font-size: 80%;
|
||||
}
|
||||
.memTemplItemRight {
|
||||
padding: 1px 8px 0px 8px;
|
||||
margin: 4px;
|
||||
border-top-width: 1px;
|
||||
border-right-width: 1px;
|
||||
border-bottom-width: 1px;
|
||||
border-left-width: 1px;
|
||||
border-top-color: #E0E0E0;
|
||||
border-right-color: #E0E0E0;
|
||||
border-bottom-color: #E0E0E0;
|
||||
border-left-color: #E0E0E0;
|
||||
border-top-style: none;
|
||||
border-right-style: none;
|
||||
border-bottom-style: none;
|
||||
border-left-style: none;
|
||||
background-color: #FAFAFA;
|
||||
font-size: 80%;
|
||||
}
|
||||
.memTemplParams {
|
||||
padding: 1px 0px 0px 8px;
|
||||
margin: 4px;
|
||||
border-top-width: 1px;
|
||||
border-right-width: 1px;
|
||||
border-bottom-width: 1px;
|
||||
border-left-width: 1px;
|
||||
border-top-color: #E0E0E0;
|
||||
border-right-color: #E0E0E0;
|
||||
border-bottom-color: #E0E0E0;
|
||||
border-left-color: #E0E0E0;
|
||||
border-top-style: solid;
|
||||
border-right-style: none;
|
||||
border-bottom-style: none;
|
||||
border-left-style: none;
|
||||
color: #606060;
|
||||
background-color: #FAFAFA;
|
||||
font-size: 80%;
|
||||
}
|
||||
.search {
|
||||
color: #003399;
|
||||
font-weight: bold;
|
||||
}
|
||||
FORM.search {
|
||||
margin-bottom: 0px;
|
||||
margin-top: 0px;
|
||||
}
|
||||
INPUT.search {
|
||||
font-size: 75%;
|
||||
color: #000080;
|
||||
font-weight: normal;
|
||||
background-color: #e8eef2;
|
||||
}
|
||||
TD.tiny {
|
||||
font-size: 75%;
|
||||
}
|
||||
a {
|
||||
color: #1A41A8;
|
||||
}
|
||||
a:visited {
|
||||
color: #2A3798;
|
||||
}
|
||||
.dirtab {
|
||||
padding: 4px;
|
||||
border-collapse: collapse;
|
||||
border: 1px solid #84b0c7;
|
||||
}
|
||||
TH.dirtab {
|
||||
background: #e8eef2;
|
||||
font-weight: bold;
|
||||
}
|
||||
HR {
|
||||
height: 1px;
|
||||
border: none;
|
||||
border-top: 1px solid black;
|
||||
}
|
||||
|
||||
/* Style for detailed member documentation */
|
||||
.memtemplate {
|
||||
font-size: 80%;
|
||||
color: #606060;
|
||||
font-weight: normal;
|
||||
margin-left: 3px;
|
||||
}
|
||||
.memnav {
|
||||
background-color: #e8eef2;
|
||||
border: 1px solid #84b0c7;
|
||||
text-align: center;
|
||||
margin: 2px;
|
||||
margin-right: 15px;
|
||||
padding: 2px;
|
||||
}
|
||||
.memitem {
|
||||
padding: 4px;
|
||||
background-color: #eef3f5;
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
border-color: #dedeee;
|
||||
-moz-border-radius: 8px 8px 8px 8px;
|
||||
}
|
||||
.memname {
|
||||
white-space: nowrap;
|
||||
font-weight: bold;
|
||||
}
|
||||
.memdoc{
|
||||
padding-left: 10px;
|
||||
}
|
||||
.memproto {
|
||||
background-color: #d5e1e8;
|
||||
width: 100%;
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
border-color: #84b0c7;
|
||||
font-weight: bold;
|
||||
-moz-border-radius: 8px 8px 8px 8px;
|
||||
}
|
||||
.paramkey {
|
||||
text-align: right;
|
||||
}
|
||||
.paramtype {
|
||||
white-space: nowrap;
|
||||
}
|
||||
.paramname {
|
||||
color: #602020;
|
||||
font-style: italic;
|
||||
white-space: nowrap;
|
||||
}
|
||||
/* End Styling for detailed member documentation */
|
||||
|
||||
/* for the tree view */
|
||||
.ftvtree {
|
||||
font-family: sans-serif;
|
||||
margin:0.5em;
|
||||
}
|
||||
.directory {
|
||||
font-size: 9pt;
|
||||
font-weight: bold;
|
||||
}
|
||||
.directory h3 {
|
||||
margin: 0px;
|
||||
margin-top: 1em;
|
||||
font-size: 11pt;
|
||||
}
|
||||
.directory > h3 {
|
||||
margin-top: 0;
|
||||
}
|
||||
.directory p {
|
||||
margin: 0px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.directory div {
|
||||
display: none;
|
||||
margin: 0px;
|
||||
}
|
||||
.directory img {
|
||||
vertical-align: -30%;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
|
||||
<title>@DOC_TITLE@</title>
|
||||
<link href="doxygen.css" rel="stylesheet" type="text/css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<table width="100%" height="10%" bgcolor="#FFFFFF">
|
||||
<tr>
|
||||
<td colspan="2"><p><A href=http://www.atmel.com ><img src="atmel.jpg"/ border=0></A></p><br /></td>
|
||||
<td colspan="2"> <strong><font face="Helvetica" color="#000000" size="+3">Xmega Application Note</font></strong></td>
|
||||
<td colspan="2"><p><A href=http://www.atmel.com/products/AVR><img src="AVR_logo_blue.gif"/ border=0></A></p><br /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="6" height="1" background="blue.gif"></td>
|
||||
</tr>
|
||||
</table>
|
||||
<!-- Generated by Doxygen 1.5.5 -->
|
||||
<div class="contents">
|
||||
<h1>File List</h1>Here is a list of all files with brief descriptions:<table>
|
||||
<tr><td class="indexkey"><a class="el" href="avr__compiler_8h.html">avr_compiler.h</a> <a href="avr__compiler_8h-source.html">[code]</a></td><td class="indexvalue">This file implements some macros that makes the IAR C-compiler and avr-gcc work with the same code base for the AVR architecture </td></tr>
|
||||
<tr><td class="indexkey"><a class="el" href="documentation_8h.html">documentation.h</a> <a href="documentation_8h-source.html">[code]</a></td><td class="indexvalue"></td></tr>
|
||||
<tr><td class="indexkey"><a class="el" href="TC__driver_8c.html">TC_driver.c</a> <a href="TC__driver_8c-source.html">[code]</a></td><td class="indexvalue">XMEGA Timer/Counter driver source file </td></tr>
|
||||
<tr><td class="indexkey"><a class="el" href="TC__driver_8h.html">TC_driver.h</a> <a href="TC__driver_8h-source.html">[code]</a></td><td class="indexvalue">XMEGA Timer/Counter driver header file </td></tr>
|
||||
<tr><td class="indexkey"><a class="el" href="TC__example_8c.html">TC_example.c</a> <a href="TC__example_8c-source.html">[code]</a></td><td class="indexvalue">XMEGA Timer/Counter example source file </td></tr>
|
||||
</table>
|
||||
</div>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
|
||||
<title>@DOC_TITLE@</title>
|
||||
<link href="doxygen.css" rel="stylesheet" type="text/css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<table width="100%" height="10%" bgcolor="#FFFFFF">
|
||||
<tr>
|
||||
<td colspan="6" height="1" background="blue.gif"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="6">
|
||||
<address style="align: right;"><small>
|
||||
Generated on Wed Apr 23 07:45:46 2008 for AVR1306 Using the XMEGA Timer/Counter by <a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border=0></a> 1.5.5</small></address>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
@@ -0,0 +1,231 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
|
||||
<title>@DOC_TITLE@</title>
|
||||
<link href="doxygen.css" rel="stylesheet" type="text/css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<table width="100%" height="10%" bgcolor="#FFFFFF">
|
||||
<tr>
|
||||
<td colspan="2"><p><A href=http://www.atmel.com ><img src="atmel.jpg"/ border=0></A></p><br /></td>
|
||||
<td colspan="2"> <strong><font face="Helvetica" color="#000000" size="+3">Xmega Application Note</font></strong></td>
|
||||
<td colspan="2"><p><A href=http://www.atmel.com/products/AVR><img src="AVR_logo_blue.gif"/ border=0></A></p><br /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="6" height="1" background="blue.gif"></td>
|
||||
</tr>
|
||||
</table>
|
||||
<!-- Generated by Doxygen 1.5.5 -->
|
||||
<div class="tabs">
|
||||
<ul>
|
||||
<li class="current"><a href="globals.html"><span>All</span></a></li>
|
||||
<li><a href="globals_func.html"><span>Functions</span></a></li>
|
||||
<li><a href="globals_defs.html"><span>Defines</span></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="tabs">
|
||||
<ul>
|
||||
<li><a href="#index_a"><span>a</span></a></li>
|
||||
<li><a href="#index_c"><span>c</span></a></li>
|
||||
<li><a href="#index_e"><span>e</span></a></li>
|
||||
<li><a href="#index_f"><span>f</span></a></li>
|
||||
<li><a href="#index_i"><span>i</span></a></li>
|
||||
<li><a href="#index_m"><span>m</span></a></li>
|
||||
<li><a href="#index_t"><span>t</span></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
<div class="contents">
|
||||
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:
|
||||
<p>
|
||||
<h3><a class="anchor" name="index_a">- a -</a></h3><ul>
|
||||
<li>AVR_ENTER_CRITICAL_REGION
|
||||
: <a class="el" href="avr__compiler_8h.html#0a4fb62f9e69209c9c8c8e34ebb3df6f">avr_compiler.h</a>
|
||||
<li>AVR_LEAVE_CRITICAL_REGION
|
||||
: <a class="el" href="avr__compiler_8h.html#770b47b04eec57748be0826a3d23503b">avr_compiler.h</a>
|
||||
</ul>
|
||||
<h3><a class="anchor" name="index_c">- c -</a></h3><ul>
|
||||
<li>CPU_PRESCALER
|
||||
: <a class="el" href="TC__example_8c.html#945ebdbcd5f4e6a81f5ab930fd046cd5">TC_example.c</a>
|
||||
</ul>
|
||||
<h3><a class="anchor" name="index_e">- e -</a></h3><ul>
|
||||
<li>Example1()
|
||||
: <a class="el" href="TC__example_8c.html#b899c7aa870825aec068df494bbfd714">TC_example.c</a>
|
||||
<li>Example2()
|
||||
: <a class="el" href="TC__example_8c.html#7d5465d0142c58a86789deec41d3436a">TC_example.c</a>
|
||||
<li>Example3()
|
||||
: <a class="el" href="TC__example_8c.html#1678698677906bbe98f830ba470905a3">TC_example.c</a>
|
||||
<li>Example4()
|
||||
: <a class="el" href="TC__example_8c.html#6efa69f5cda8cc01efb9cb61701e5f54">TC_example.c</a>
|
||||
<li>Example5()
|
||||
: <a class="el" href="TC__example_8c.html#bda6c77ac6c320173195b6371eba5a5b">TC_example.c</a>
|
||||
<li>Example6()
|
||||
: <a class="el" href="TC__example_8c.html#f66b2c4ef70a32b9596a9442439a4dc2">TC_example.c</a>
|
||||
</ul>
|
||||
<h3><a class="anchor" name="index_f">- f -</a></h3><ul>
|
||||
<li>F_CPU
|
||||
: <a class="el" href="avr__compiler_8h.html#43bafb28b29491ec7f871319b5a3b2f8">avr_compiler.h</a>
|
||||
, <a class="el" href="TC__example_8c.html#43bafb28b29491ec7f871319b5a3b2f8">TC_example.c</a>
|
||||
</ul>
|
||||
<h3><a class="anchor" name="index_i">- i -</a></h3><ul>
|
||||
<li>ISR()
|
||||
: <a class="el" href="TC__example_8c.html#0763252836531eeb42258e71bf9710be">TC_example.c</a>
|
||||
</ul>
|
||||
<h3><a class="anchor" name="index_m">- m -</a></h3><ul>
|
||||
<li>main()
|
||||
: <a class="el" href="TC__example_8c.html#840291bc02cba5474a4cb46a9b9566fe">TC_example.c</a>
|
||||
</ul>
|
||||
<h3><a class="anchor" name="index_t">- t -</a></h3><ul>
|
||||
<li>TC0_ConfigClockSource()
|
||||
: <a class="el" href="TC__driver_8c.html#1a5b3ccf2b872dcdf8f4162e5cdc6e81">TC_driver.c</a>
|
||||
, <a class="el" href="TC__driver_8h.html#1a5b3ccf2b872dcdf8f4162e5cdc6e81">TC_driver.h</a>
|
||||
<li>TC0_ConfigInputCapture()
|
||||
: <a class="el" href="TC__driver_8h.html#309a2ca4eaf39437b57ca13edb23b70b">TC_driver.h</a>
|
||||
, <a class="el" href="TC__driver_8c.html#309a2ca4eaf39437b57ca13edb23b70b">TC_driver.c</a>
|
||||
<li>TC0_ConfigWGM()
|
||||
: <a class="el" href="TC__driver_8c.html#45e98ab822bfcd2e284c13fddac90f32">TC_driver.c</a>
|
||||
, <a class="el" href="TC__driver_8h.html#45e98ab822bfcd2e284c13fddac90f32">TC_driver.h</a>
|
||||
<li>TC0_DisableCCChannels()
|
||||
: <a class="el" href="TC__driver_8h.html#ec887336e135fc7f2c95532b7b2bee3f">TC_driver.h</a>
|
||||
, <a class="el" href="TC__driver_8c.html#ec887336e135fc7f2c95532b7b2bee3f">TC_driver.c</a>
|
||||
<li>TC0_EnableCCChannels()
|
||||
: <a class="el" href="TC__driver_8c.html#e6b05576247ef4109e9249ea4f8e6b28">TC_driver.c</a>
|
||||
, <a class="el" href="TC__driver_8h.html#e6b05576247ef4109e9249ea4f8e6b28">TC_driver.h</a>
|
||||
<li>TC0_Reset()
|
||||
: <a class="el" href="TC__driver_8c.html#d7b63210eec1da33632c95d26fe3fd02">TC_driver.c</a>
|
||||
, <a class="el" href="TC__driver_8h.html#d7b63210eec1da33632c95d26fe3fd02">TC_driver.h</a>
|
||||
<li>TC0_SetCCAIntLevel()
|
||||
: <a class="el" href="TC__driver_8c.html#9dc297c8345a7b55099ab0b63454e109">TC_driver.c</a>
|
||||
, <a class="el" href="TC__driver_8h.html#9dc297c8345a7b55099ab0b63454e109">TC_driver.h</a>
|
||||
<li>TC0_SetCCBIntLevel()
|
||||
: <a class="el" href="TC__driver_8h.html#0eb6006987f0c6c1227ae21303840380">TC_driver.h</a>
|
||||
, <a class="el" href="TC__driver_8c.html#0eb6006987f0c6c1227ae21303840380">TC_driver.c</a>
|
||||
<li>TC0_SetCCCIntLevel()
|
||||
: <a class="el" href="TC__driver_8c.html#1c1cbcd5f0dff77d207d95754ce9ff1f">TC_driver.c</a>
|
||||
, <a class="el" href="TC__driver_8h.html#1c1cbcd5f0dff77d207d95754ce9ff1f">TC_driver.h</a>
|
||||
<li>TC0_SetCCDIntLevel()
|
||||
: <a class="el" href="TC__driver_8c.html#764c59955faaa6cd1463848330c6ea34">TC_driver.c</a>
|
||||
, <a class="el" href="TC__driver_8h.html#764c59955faaa6cd1463848330c6ea34">TC_driver.h</a>
|
||||
<li>TC0_SetErrorIntLevel()
|
||||
: <a class="el" href="TC__driver_8c.html#7932285622e0f6f66821a24aa18d8892">TC_driver.c</a>
|
||||
, <a class="el" href="TC__driver_8h.html#7932285622e0f6f66821a24aa18d8892">TC_driver.h</a>
|
||||
<li>TC0_SetOverflowIntLevel()
|
||||
: <a class="el" href="TC__driver_8c.html#5630e34078d4a93db2a655703c13c71a">TC_driver.c</a>
|
||||
, <a class="el" href="TC__driver_8h.html#5630e34078d4a93db2a655703c13c71a">TC_driver.h</a>
|
||||
<li>TC1_ConfigClockSource()
|
||||
: <a class="el" href="TC__driver_8c.html#ef27c3126f89d13b02732de352bff21f">TC_driver.c</a>
|
||||
, <a class="el" href="TC__driver_8h.html#ef27c3126f89d13b02732de352bff21f">TC_driver.h</a>
|
||||
<li>TC1_ConfigInputCapture()
|
||||
: <a class="el" href="TC__driver_8c.html#8d41d6b130f6fd3928e8198e9bf9512b">TC_driver.c</a>
|
||||
, <a class="el" href="TC__driver_8h.html#8d41d6b130f6fd3928e8198e9bf9512b">TC_driver.h</a>
|
||||
<li>TC1_ConfigWGM()
|
||||
: <a class="el" href="TC__driver_8c.html#ea811f24d3ebc34c561eb648f2952314">TC_driver.c</a>
|
||||
, <a class="el" href="TC__driver_8h.html#ea811f24d3ebc34c561eb648f2952314">TC_driver.h</a>
|
||||
<li>TC1_DisableCCChannels()
|
||||
: <a class="el" href="TC__driver_8h.html#0573753afe3df7200cd686d84e1fded6">TC_driver.h</a>
|
||||
, <a class="el" href="TC__driver_8c.html#0573753afe3df7200cd686d84e1fded6">TC_driver.c</a>
|
||||
<li>TC1_EnableCCChannels()
|
||||
: <a class="el" href="TC__driver_8c.html#41d8a44ed53255f2bb991a2aab3bf031">TC_driver.c</a>
|
||||
, <a class="el" href="TC__driver_8h.html#41d8a44ed53255f2bb991a2aab3bf031">TC_driver.h</a>
|
||||
<li>TC1_Reset()
|
||||
: <a class="el" href="TC__driver_8c.html#c6857a58e93965b3a74007c5c9952880">TC_driver.c</a>
|
||||
, <a class="el" href="TC__driver_8h.html#c6857a58e93965b3a74007c5c9952880">TC_driver.h</a>
|
||||
<li>TC1_SetCCAIntLevel()
|
||||
: <a class="el" href="TC__driver_8c.html#e26379528dcd7aa2c51407453e81b764">TC_driver.c</a>
|
||||
, <a class="el" href="TC__driver_8h.html#e26379528dcd7aa2c51407453e81b764">TC_driver.h</a>
|
||||
<li>TC1_SetCCBIntLevel()
|
||||
: <a class="el" href="TC__driver_8c.html#8ba5a300c68f0d88e0450aa95be0d76d">TC_driver.c</a>
|
||||
, <a class="el" href="TC__driver_8h.html#8ba5a300c68f0d88e0450aa95be0d76d">TC_driver.h</a>
|
||||
<li>TC1_SetCCCIntLevel()
|
||||
: <a class="el" href="TC__driver_8h.html#cbb8bcb56ffae6f884e49adbafd93128">TC_driver.h</a>
|
||||
<li>TC1_SetCCDIntLevel()
|
||||
: <a class="el" href="TC__driver_8h.html#3db14d65afb9ea1f2cf7131333be9451">TC_driver.h</a>
|
||||
<li>TC1_SetErrorIntLevel()
|
||||
: <a class="el" href="TC__driver_8c.html#a65e4c1ee730d914d555eeee8aee0503">TC_driver.c</a>
|
||||
, <a class="el" href="TC__driver_8h.html#a65e4c1ee730d914d555eeee8aee0503">TC_driver.h</a>
|
||||
<li>TC1_SetOverflowIntLevel()
|
||||
: <a class="el" href="TC__driver_8c.html#a99bc1615bda1604c9ea7a738c1e595f">TC_driver.c</a>
|
||||
, <a class="el" href="TC__driver_8h.html#a99bc1615bda1604c9ea7a738c1e595f">TC_driver.h</a>
|
||||
<li>TC_ClearCCAFlag
|
||||
: <a class="el" href="TC__driver_8h.html#0ed6eaa40a0f5b5b3322ce48166bee16">TC_driver.h</a>
|
||||
<li>TC_ClearCCBFlag
|
||||
: <a class="el" href="TC__driver_8h.html#76d044a29d90a5ac7f28204b5eaae65c">TC_driver.h</a>
|
||||
<li>TC_ClearCCCFlag
|
||||
: <a class="el" href="TC__driver_8h.html#548e3d1742703a2ca51a7a957302741b">TC_driver.h</a>
|
||||
<li>TC_ClearCCDFlag
|
||||
: <a class="el" href="TC__driver_8h.html#2e059c95fdd9b233a8d3c99ddf433b5c">TC_driver.h</a>
|
||||
<li>TC_ClearErrorFlag
|
||||
: <a class="el" href="TC__driver_8h.html#da5a426aca38d12a362695f0941e460e">TC_driver.h</a>
|
||||
<li>TC_ClearOverflowFlag
|
||||
: <a class="el" href="TC__driver_8h.html#edc4d516e9f796432730cc7fa61e81d9">TC_driver.h</a>
|
||||
<li>TC_DisableEventDelay
|
||||
: <a class="el" href="TC__driver_8h.html#09a1d9fa80b12d69a5c6c54ac4acb568">TC_driver.h</a>
|
||||
<li>TC_EnableEventDelay
|
||||
: <a class="el" href="TC__driver_8h.html#4b1fa59d76f86ced01740b22278ba23b">TC_driver.h</a>
|
||||
<li>TC_ForceUpdate
|
||||
: <a class="el" href="TC__driver_8h.html#c585f9b311ce57ee16c1cd309e81aae2">TC_driver.h</a>
|
||||
<li>TC_GetCaptureA
|
||||
: <a class="el" href="TC__driver_8h.html#047c98cc70b77b9133143155a575a2db">TC_driver.h</a>
|
||||
<li>TC_GetCaptureB
|
||||
: <a class="el" href="TC__driver_8h.html#3eeb1ab0f3f2d536de4164628780fb78">TC_driver.h</a>
|
||||
<li>TC_GetCaptureC
|
||||
: <a class="el" href="TC__driver_8h.html#72ef542e1bce10b16d89e3182750fc3c">TC_driver.h</a>
|
||||
<li>TC_GetCaptureD
|
||||
: <a class="el" href="TC__driver_8h.html#e71f41fdf7aacb64d3b09609781669e5">TC_driver.h</a>
|
||||
<li>TC_GetCCAFlag
|
||||
: <a class="el" href="TC__driver_8h.html#5b1d20f74d1a3083b536f27017f45767">TC_driver.h</a>
|
||||
<li>TC_GetCCBFlag
|
||||
: <a class="el" href="TC__driver_8h.html#e126b7a72512efa058c21dfc1ad6c6e1">TC_driver.h</a>
|
||||
<li>TC_GetCCCFlag
|
||||
: <a class="el" href="TC__driver_8h.html#7497125c7b6c8ef02b8d75ba6b811254">TC_driver.h</a>
|
||||
<li>TC_GetCCDFlag
|
||||
: <a class="el" href="TC__driver_8h.html#444c6e56839302d35cd1fdcdb7c41001">TC_driver.h</a>
|
||||
<li>TC_GetErrorFlag
|
||||
: <a class="el" href="TC__driver_8h.html#35d45f4d1b006672ac430901536347f5">TC_driver.h</a>
|
||||
<li>TC_GetOverflowFlag
|
||||
: <a class="el" href="TC__driver_8h.html#41ba6e4bbe21de7dfcc85146835858e9">TC_driver.h</a>
|
||||
<li>TC_LockCompareUpdate
|
||||
: <a class="el" href="TC__driver_8h.html#73684604998fb3a11524d2d3143bc5bf">TC_driver.h</a>
|
||||
<li>TC_Restart
|
||||
: <a class="el" href="TC__driver_8h.html#0a837eeef0e057214725bfcd57688a7c">TC_driver.h</a>
|
||||
<li>TC_SetCompareA
|
||||
: <a class="el" href="TC__driver_8h.html#11829e0c86eba6c2f20351060fa3c1b2">TC_driver.h</a>
|
||||
<li>TC_SetCompareB
|
||||
: <a class="el" href="TC__driver_8h.html#fdb25320eb2c2d824aee058650b7e9f1">TC_driver.h</a>
|
||||
<li>TC_SetCompareC
|
||||
: <a class="el" href="TC__driver_8h.html#c68c401778ed8dea4c24706c48b1fe3e">TC_driver.h</a>
|
||||
<li>TC_SetCompareD
|
||||
: <a class="el" href="TC__driver_8h.html#eb6a2da8eb30b2e2457a4f4d959cc546">TC_driver.h</a>
|
||||
<li>TC_SetCount
|
||||
: <a class="el" href="TC__driver_8h.html#baac6e289006eefa97dd4c1fe9d39464">TC_driver.h</a>
|
||||
<li>TC_SetPeriod
|
||||
: <a class="el" href="TC__driver_8h.html#4faaf2813b83a03cd6d3720fa884bfe4">TC_driver.h</a>
|
||||
<li>TC_SetPeriodBuffered
|
||||
: <a class="el" href="TC__driver_8h.html#aebcc08be007b67a2d0b001e44d077b7">TC_driver.h</a>
|
||||
<li>TC_UnlockCompareUpdate
|
||||
: <a class="el" href="TC__driver_8h.html#5a969399e96e90ddd97ee94c487dcfe5">TC_driver.h</a>
|
||||
</ul>
|
||||
</div>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
|
||||
<title>@DOC_TITLE@</title>
|
||||
<link href="doxygen.css" rel="stylesheet" type="text/css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<table width="100%" height="10%" bgcolor="#FFFFFF">
|
||||
<tr>
|
||||
<td colspan="6" height="1" background="blue.gif"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="6">
|
||||
<address style="align: right;"><small>
|
||||
Generated on Wed Apr 23 07:45:46 2008 for AVR1306 Using the XMEGA Timer/Counter by <a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border=0></a> 1.5.5</small></address>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
@@ -0,0 +1,136 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
|
||||
<title>@DOC_TITLE@</title>
|
||||
<link href="doxygen.css" rel="stylesheet" type="text/css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<table width="100%" height="10%" bgcolor="#FFFFFF">
|
||||
<tr>
|
||||
<td colspan="2"><p><A href=http://www.atmel.com ><img src="atmel.jpg"/ border=0></A></p><br /></td>
|
||||
<td colspan="2"> <strong><font face="Helvetica" color="#000000" size="+3">Xmega Application Note</font></strong></td>
|
||||
<td colspan="2"><p><A href=http://www.atmel.com/products/AVR><img src="AVR_logo_blue.gif"/ border=0></A></p><br /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="6" height="1" background="blue.gif"></td>
|
||||
</tr>
|
||||
</table>
|
||||
<!-- Generated by Doxygen 1.5.5 -->
|
||||
<div class="tabs">
|
||||
<ul>
|
||||
<li><a href="globals.html"><span>All</span></a></li>
|
||||
<li><a href="globals_func.html"><span>Functions</span></a></li>
|
||||
<li class="current"><a href="globals_defs.html"><span>Defines</span></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="tabs">
|
||||
<ul>
|
||||
<li><a href="#index_a"><span>a</span></a></li>
|
||||
<li><a href="#index_c"><span>c</span></a></li>
|
||||
<li><a href="#index_f"><span>f</span></a></li>
|
||||
<li><a href="#index_t"><span>t</span></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
<div class="contents">
|
||||
|
||||
<p>
|
||||
<h3><a class="anchor" name="index_a">- a -</a></h3><ul>
|
||||
<li>AVR_ENTER_CRITICAL_REGION
|
||||
: <a class="el" href="avr__compiler_8h.html#0a4fb62f9e69209c9c8c8e34ebb3df6f">avr_compiler.h</a>
|
||||
<li>AVR_LEAVE_CRITICAL_REGION
|
||||
: <a class="el" href="avr__compiler_8h.html#770b47b04eec57748be0826a3d23503b">avr_compiler.h</a>
|
||||
</ul>
|
||||
<h3><a class="anchor" name="index_c">- c -</a></h3><ul>
|
||||
<li>CPU_PRESCALER
|
||||
: <a class="el" href="TC__example_8c.html#945ebdbcd5f4e6a81f5ab930fd046cd5">TC_example.c</a>
|
||||
</ul>
|
||||
<h3><a class="anchor" name="index_f">- f -</a></h3><ul>
|
||||
<li>F_CPU
|
||||
: <a class="el" href="avr__compiler_8h.html#43bafb28b29491ec7f871319b5a3b2f8">avr_compiler.h</a>
|
||||
, <a class="el" href="TC__example_8c.html#43bafb28b29491ec7f871319b5a3b2f8">TC_example.c</a>
|
||||
</ul>
|
||||
<h3><a class="anchor" name="index_t">- t -</a></h3><ul>
|
||||
<li>TC_ClearCCAFlag
|
||||
: <a class="el" href="TC__driver_8h.html#0ed6eaa40a0f5b5b3322ce48166bee16">TC_driver.h</a>
|
||||
<li>TC_ClearCCBFlag
|
||||
: <a class="el" href="TC__driver_8h.html#76d044a29d90a5ac7f28204b5eaae65c">TC_driver.h</a>
|
||||
<li>TC_ClearCCCFlag
|
||||
: <a class="el" href="TC__driver_8h.html#548e3d1742703a2ca51a7a957302741b">TC_driver.h</a>
|
||||
<li>TC_ClearCCDFlag
|
||||
: <a class="el" href="TC__driver_8h.html#2e059c95fdd9b233a8d3c99ddf433b5c">TC_driver.h</a>
|
||||
<li>TC_ClearErrorFlag
|
||||
: <a class="el" href="TC__driver_8h.html#da5a426aca38d12a362695f0941e460e">TC_driver.h</a>
|
||||
<li>TC_ClearOverflowFlag
|
||||
: <a class="el" href="TC__driver_8h.html#edc4d516e9f796432730cc7fa61e81d9">TC_driver.h</a>
|
||||
<li>TC_DisableEventDelay
|
||||
: <a class="el" href="TC__driver_8h.html#09a1d9fa80b12d69a5c6c54ac4acb568">TC_driver.h</a>
|
||||
<li>TC_EnableEventDelay
|
||||
: <a class="el" href="TC__driver_8h.html#4b1fa59d76f86ced01740b22278ba23b">TC_driver.h</a>
|
||||
<li>TC_ForceUpdate
|
||||
: <a class="el" href="TC__driver_8h.html#c585f9b311ce57ee16c1cd309e81aae2">TC_driver.h</a>
|
||||
<li>TC_GetCaptureA
|
||||
: <a class="el" href="TC__driver_8h.html#047c98cc70b77b9133143155a575a2db">TC_driver.h</a>
|
||||
<li>TC_GetCaptureB
|
||||
: <a class="el" href="TC__driver_8h.html#3eeb1ab0f3f2d536de4164628780fb78">TC_driver.h</a>
|
||||
<li>TC_GetCaptureC
|
||||
: <a class="el" href="TC__driver_8h.html#72ef542e1bce10b16d89e3182750fc3c">TC_driver.h</a>
|
||||
<li>TC_GetCaptureD
|
||||
: <a class="el" href="TC__driver_8h.html#e71f41fdf7aacb64d3b09609781669e5">TC_driver.h</a>
|
||||
<li>TC_GetCCAFlag
|
||||
: <a class="el" href="TC__driver_8h.html#5b1d20f74d1a3083b536f27017f45767">TC_driver.h</a>
|
||||
<li>TC_GetCCBFlag
|
||||
: <a class="el" href="TC__driver_8h.html#e126b7a72512efa058c21dfc1ad6c6e1">TC_driver.h</a>
|
||||
<li>TC_GetCCCFlag
|
||||
: <a class="el" href="TC__driver_8h.html#7497125c7b6c8ef02b8d75ba6b811254">TC_driver.h</a>
|
||||
<li>TC_GetCCDFlag
|
||||
: <a class="el" href="TC__driver_8h.html#444c6e56839302d35cd1fdcdb7c41001">TC_driver.h</a>
|
||||
<li>TC_GetErrorFlag
|
||||
: <a class="el" href="TC__driver_8h.html#35d45f4d1b006672ac430901536347f5">TC_driver.h</a>
|
||||
<li>TC_GetOverflowFlag
|
||||
: <a class="el" href="TC__driver_8h.html#41ba6e4bbe21de7dfcc85146835858e9">TC_driver.h</a>
|
||||
<li>TC_LockCompareUpdate
|
||||
: <a class="el" href="TC__driver_8h.html#73684604998fb3a11524d2d3143bc5bf">TC_driver.h</a>
|
||||
<li>TC_Restart
|
||||
: <a class="el" href="TC__driver_8h.html#0a837eeef0e057214725bfcd57688a7c">TC_driver.h</a>
|
||||
<li>TC_SetCompareA
|
||||
: <a class="el" href="TC__driver_8h.html#11829e0c86eba6c2f20351060fa3c1b2">TC_driver.h</a>
|
||||
<li>TC_SetCompareB
|
||||
: <a class="el" href="TC__driver_8h.html#fdb25320eb2c2d824aee058650b7e9f1">TC_driver.h</a>
|
||||
<li>TC_SetCompareC
|
||||
: <a class="el" href="TC__driver_8h.html#c68c401778ed8dea4c24706c48b1fe3e">TC_driver.h</a>
|
||||
<li>TC_SetCompareD
|
||||
: <a class="el" href="TC__driver_8h.html#eb6a2da8eb30b2e2457a4f4d959cc546">TC_driver.h</a>
|
||||
<li>TC_SetCount
|
||||
: <a class="el" href="TC__driver_8h.html#baac6e289006eefa97dd4c1fe9d39464">TC_driver.h</a>
|
||||
<li>TC_SetPeriod
|
||||
: <a class="el" href="TC__driver_8h.html#4faaf2813b83a03cd6d3720fa884bfe4">TC_driver.h</a>
|
||||
<li>TC_SetPeriodBuffered
|
||||
: <a class="el" href="TC__driver_8h.html#aebcc08be007b67a2d0b001e44d077b7">TC_driver.h</a>
|
||||
<li>TC_UnlockCompareUpdate
|
||||
: <a class="el" href="TC__driver_8h.html#5a969399e96e90ddd97ee94c487dcfe5">TC_driver.h</a>
|
||||
</ul>
|
||||
</div>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
|
||||
<title>@DOC_TITLE@</title>
|
||||
<link href="doxygen.css" rel="stylesheet" type="text/css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<table width="100%" height="10%" bgcolor="#FFFFFF">
|
||||
<tr>
|
||||
<td colspan="6" height="1" background="blue.gif"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="6">
|
||||
<address style="align: right;"><small>
|
||||
Generated on Wed Apr 23 07:45:46 2008 for AVR1306 Using the XMEGA Timer/Counter by <a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border=0></a> 1.5.5</small></address>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
@@ -0,0 +1,155 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
|
||||
<title>@DOC_TITLE@</title>
|
||||
<link href="doxygen.css" rel="stylesheet" type="text/css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<table width="100%" height="10%" bgcolor="#FFFFFF">
|
||||
<tr>
|
||||
<td colspan="2"><p><A href=http://www.atmel.com ><img src="atmel.jpg"/ border=0></A></p><br /></td>
|
||||
<td colspan="2"> <strong><font face="Helvetica" color="#000000" size="+3">Xmega Application Note</font></strong></td>
|
||||
<td colspan="2"><p><A href=http://www.atmel.com/products/AVR><img src="AVR_logo_blue.gif"/ border=0></A></p><br /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="6" height="1" background="blue.gif"></td>
|
||||
</tr>
|
||||
</table>
|
||||
<!-- Generated by Doxygen 1.5.5 -->
|
||||
<div class="tabs">
|
||||
<ul>
|
||||
<li><a href="globals.html"><span>All</span></a></li>
|
||||
<li class="current"><a href="globals_func.html"><span>Functions</span></a></li>
|
||||
<li><a href="globals_defs.html"><span>Defines</span></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="tabs">
|
||||
<ul>
|
||||
<li><a href="#index_e"><span>e</span></a></li>
|
||||
<li><a href="#index_i"><span>i</span></a></li>
|
||||
<li><a href="#index_m"><span>m</span></a></li>
|
||||
<li><a href="#index_t"><span>t</span></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
<div class="contents">
|
||||
|
||||
<p>
|
||||
<h3><a class="anchor" name="index_e">- e -</a></h3><ul>
|
||||
<li>Example1()
|
||||
: <a class="el" href="TC__example_8c.html#b899c7aa870825aec068df494bbfd714">TC_example.c</a>
|
||||
<li>Example2()
|
||||
: <a class="el" href="TC__example_8c.html#7d5465d0142c58a86789deec41d3436a">TC_example.c</a>
|
||||
<li>Example3()
|
||||
: <a class="el" href="TC__example_8c.html#1678698677906bbe98f830ba470905a3">TC_example.c</a>
|
||||
<li>Example4()
|
||||
: <a class="el" href="TC__example_8c.html#6efa69f5cda8cc01efb9cb61701e5f54">TC_example.c</a>
|
||||
<li>Example5()
|
||||
: <a class="el" href="TC__example_8c.html#bda6c77ac6c320173195b6371eba5a5b">TC_example.c</a>
|
||||
<li>Example6()
|
||||
: <a class="el" href="TC__example_8c.html#f66b2c4ef70a32b9596a9442439a4dc2">TC_example.c</a>
|
||||
</ul>
|
||||
<h3><a class="anchor" name="index_i">- i -</a></h3><ul>
|
||||
<li>ISR()
|
||||
: <a class="el" href="TC__example_8c.html#0763252836531eeb42258e71bf9710be">TC_example.c</a>
|
||||
</ul>
|
||||
<h3><a class="anchor" name="index_m">- m -</a></h3><ul>
|
||||
<li>main()
|
||||
: <a class="el" href="TC__example_8c.html#840291bc02cba5474a4cb46a9b9566fe">TC_example.c</a>
|
||||
</ul>
|
||||
<h3><a class="anchor" name="index_t">- t -</a></h3><ul>
|
||||
<li>TC0_ConfigClockSource()
|
||||
: <a class="el" href="TC__driver_8c.html#1a5b3ccf2b872dcdf8f4162e5cdc6e81">TC_driver.c</a>
|
||||
, <a class="el" href="TC__driver_8h.html#1a5b3ccf2b872dcdf8f4162e5cdc6e81">TC_driver.h</a>
|
||||
<li>TC0_ConfigInputCapture()
|
||||
: <a class="el" href="TC__driver_8h.html#309a2ca4eaf39437b57ca13edb23b70b">TC_driver.h</a>
|
||||
, <a class="el" href="TC__driver_8c.html#309a2ca4eaf39437b57ca13edb23b70b">TC_driver.c</a>
|
||||
<li>TC0_ConfigWGM()
|
||||
: <a class="el" href="TC__driver_8c.html#45e98ab822bfcd2e284c13fddac90f32">TC_driver.c</a>
|
||||
, <a class="el" href="TC__driver_8h.html#45e98ab822bfcd2e284c13fddac90f32">TC_driver.h</a>
|
||||
<li>TC0_DisableCCChannels()
|
||||
: <a class="el" href="TC__driver_8h.html#ec887336e135fc7f2c95532b7b2bee3f">TC_driver.h</a>
|
||||
, <a class="el" href="TC__driver_8c.html#ec887336e135fc7f2c95532b7b2bee3f">TC_driver.c</a>
|
||||
<li>TC0_EnableCCChannels()
|
||||
: <a class="el" href="TC__driver_8c.html#e6b05576247ef4109e9249ea4f8e6b28">TC_driver.c</a>
|
||||
, <a class="el" href="TC__driver_8h.html#e6b05576247ef4109e9249ea4f8e6b28">TC_driver.h</a>
|
||||
<li>TC0_Reset()
|
||||
: <a class="el" href="TC__driver_8c.html#d7b63210eec1da33632c95d26fe3fd02">TC_driver.c</a>
|
||||
, <a class="el" href="TC__driver_8h.html#d7b63210eec1da33632c95d26fe3fd02">TC_driver.h</a>
|
||||
<li>TC0_SetCCAIntLevel()
|
||||
: <a class="el" href="TC__driver_8c.html#9dc297c8345a7b55099ab0b63454e109">TC_driver.c</a>
|
||||
, <a class="el" href="TC__driver_8h.html#9dc297c8345a7b55099ab0b63454e109">TC_driver.h</a>
|
||||
<li>TC0_SetCCBIntLevel()
|
||||
: <a class="el" href="TC__driver_8h.html#0eb6006987f0c6c1227ae21303840380">TC_driver.h</a>
|
||||
, <a class="el" href="TC__driver_8c.html#0eb6006987f0c6c1227ae21303840380">TC_driver.c</a>
|
||||
<li>TC0_SetCCCIntLevel()
|
||||
: <a class="el" href="TC__driver_8c.html#1c1cbcd5f0dff77d207d95754ce9ff1f">TC_driver.c</a>
|
||||
, <a class="el" href="TC__driver_8h.html#1c1cbcd5f0dff77d207d95754ce9ff1f">TC_driver.h</a>
|
||||
<li>TC0_SetCCDIntLevel()
|
||||
: <a class="el" href="TC__driver_8c.html#764c59955faaa6cd1463848330c6ea34">TC_driver.c</a>
|
||||
, <a class="el" href="TC__driver_8h.html#764c59955faaa6cd1463848330c6ea34">TC_driver.h</a>
|
||||
<li>TC0_SetErrorIntLevel()
|
||||
: <a class="el" href="TC__driver_8c.html#7932285622e0f6f66821a24aa18d8892">TC_driver.c</a>
|
||||
, <a class="el" href="TC__driver_8h.html#7932285622e0f6f66821a24aa18d8892">TC_driver.h</a>
|
||||
<li>TC0_SetOverflowIntLevel()
|
||||
: <a class="el" href="TC__driver_8c.html#5630e34078d4a93db2a655703c13c71a">TC_driver.c</a>
|
||||
, <a class="el" href="TC__driver_8h.html#5630e34078d4a93db2a655703c13c71a">TC_driver.h</a>
|
||||
<li>TC1_ConfigClockSource()
|
||||
: <a class="el" href="TC__driver_8c.html#ef27c3126f89d13b02732de352bff21f">TC_driver.c</a>
|
||||
, <a class="el" href="TC__driver_8h.html#ef27c3126f89d13b02732de352bff21f">TC_driver.h</a>
|
||||
<li>TC1_ConfigInputCapture()
|
||||
: <a class="el" href="TC__driver_8c.html#8d41d6b130f6fd3928e8198e9bf9512b">TC_driver.c</a>
|
||||
, <a class="el" href="TC__driver_8h.html#8d41d6b130f6fd3928e8198e9bf9512b">TC_driver.h</a>
|
||||
<li>TC1_ConfigWGM()
|
||||
: <a class="el" href="TC__driver_8c.html#ea811f24d3ebc34c561eb648f2952314">TC_driver.c</a>
|
||||
, <a class="el" href="TC__driver_8h.html#ea811f24d3ebc34c561eb648f2952314">TC_driver.h</a>
|
||||
<li>TC1_DisableCCChannels()
|
||||
: <a class="el" href="TC__driver_8h.html#0573753afe3df7200cd686d84e1fded6">TC_driver.h</a>
|
||||
, <a class="el" href="TC__driver_8c.html#0573753afe3df7200cd686d84e1fded6">TC_driver.c</a>
|
||||
<li>TC1_EnableCCChannels()
|
||||
: <a class="el" href="TC__driver_8h.html#41d8a44ed53255f2bb991a2aab3bf031">TC_driver.h</a>
|
||||
, <a class="el" href="TC__driver_8c.html#41d8a44ed53255f2bb991a2aab3bf031">TC_driver.c</a>
|
||||
<li>TC1_Reset()
|
||||
: <a class="el" href="TC__driver_8c.html#c6857a58e93965b3a74007c5c9952880">TC_driver.c</a>
|
||||
, <a class="el" href="TC__driver_8h.html#c6857a58e93965b3a74007c5c9952880">TC_driver.h</a>
|
||||
<li>TC1_SetCCAIntLevel()
|
||||
: <a class="el" href="TC__driver_8h.html#e26379528dcd7aa2c51407453e81b764">TC_driver.h</a>
|
||||
, <a class="el" href="TC__driver_8c.html#e26379528dcd7aa2c51407453e81b764">TC_driver.c</a>
|
||||
<li>TC1_SetCCBIntLevel()
|
||||
: <a class="el" href="TC__driver_8c.html#8ba5a300c68f0d88e0450aa95be0d76d">TC_driver.c</a>
|
||||
, <a class="el" href="TC__driver_8h.html#8ba5a300c68f0d88e0450aa95be0d76d">TC_driver.h</a>
|
||||
<li>TC1_SetCCCIntLevel()
|
||||
: <a class="el" href="TC__driver_8h.html#cbb8bcb56ffae6f884e49adbafd93128">TC_driver.h</a>
|
||||
<li>TC1_SetCCDIntLevel()
|
||||
: <a class="el" href="TC__driver_8h.html#3db14d65afb9ea1f2cf7131333be9451">TC_driver.h</a>
|
||||
<li>TC1_SetErrorIntLevel()
|
||||
: <a class="el" href="TC__driver_8c.html#a65e4c1ee730d914d555eeee8aee0503">TC_driver.c</a>
|
||||
, <a class="el" href="TC__driver_8h.html#a65e4c1ee730d914d555eeee8aee0503">TC_driver.h</a>
|
||||
<li>TC1_SetOverflowIntLevel()
|
||||
: <a class="el" href="TC__driver_8h.html#a99bc1615bda1604c9ea7a738c1e595f">TC_driver.h</a>
|
||||
, <a class="el" href="TC__driver_8c.html#a99bc1615bda1604c9ea7a738c1e595f">TC_driver.c</a>
|
||||
</ul>
|
||||
</div>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
|
||||
<title>@DOC_TITLE@</title>
|
||||
<link href="doxygen.css" rel="stylesheet" type="text/css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<table width="100%" height="10%" bgcolor="#FFFFFF">
|
||||
<tr>
|
||||
<td colspan="6" height="1" background="blue.gif"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="6">
|
||||
<address style="align: right;"><small>
|
||||
Generated on Wed Apr 23 07:45:46 2008 for AVR1306 Using the XMEGA Timer/Counter by <a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border=0></a> 1.5.5</small></address>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
@@ -0,0 +1,22 @@
|
||||
digraph G
|
||||
{
|
||||
edge [fontname="FreeSans",fontsize=10,labelfontname="FreeSans",labelfontsize=10];
|
||||
node [fontname="FreeSans",fontsize=10,shape=record];
|
||||
Node9 [shape="box",label="Inherited",fontsize=10,height=0.2,width=0.4,fontname="FreeSans",fillcolor="grey75",style="filled" fontcolor="black"];
|
||||
Node10 -> Node9 [dir=back,color="midnightblue",fontsize=10,style="solid",fontname="FreeSans"];
|
||||
Node10 [shape="box",label="PublicBase",fontsize=10,height=0.2,width=0.4,fontname="FreeSans",color="black",URL="$classPublicBase.html"];
|
||||
Node11 -> Node10 [dir=back,color="midnightblue",fontsize=10,style="solid",fontname="FreeSans"];
|
||||
Node11 [shape="box",label="Truncated",fontsize=10,height=0.2,width=0.4,fontname="FreeSans",color="red",URL="$classTruncated.html"];
|
||||
Node13 -> Node9 [dir=back,color="darkgreen",fontsize=10,style="solid",fontname="FreeSans"];
|
||||
Node13 [shape="box",label="ProtectedBase",fontsize=10,height=0.2,width=0.4,fontname="FreeSans",color="black",URL="$classProtectedBase.html"];
|
||||
Node14 -> Node9 [dir=back,color="firebrick4",fontsize=10,style="solid",fontname="FreeSans"];
|
||||
Node14 [shape="box",label="PrivateBase",fontsize=10,height=0.2,width=0.4,fontname="FreeSans",color="black",URL="$classPrivateBase.html"];
|
||||
Node15 -> Node9 [dir=back,color="midnightblue",fontsize=10,style="solid",fontname="FreeSans"];
|
||||
Node15 [shape="box",label="Undocumented",fontsize=10,height=0.2,width=0.4,fontname="FreeSans",color="grey75"];
|
||||
Node16 -> Node9 [dir=back,color="midnightblue",fontsize=10,style="solid",fontname="FreeSans"];
|
||||
Node16 [shape="box",label="Templ< int >",fontsize=10,height=0.2,width=0.4,fontname="FreeSans",color="black",URL="$classTempl.html"];
|
||||
Node17 -> Node16 [dir=back,color="orange",fontsize=10,style="dashed",label="< int >",fontname="FreeSans"];
|
||||
Node17 [shape="box",label="Templ< T >",fontsize=10,height=0.2,width=0.4,fontname="FreeSans",color="black",URL="$classTempl.html"];
|
||||
Node18 -> Node9 [dir=back,color="darkorchid3",fontsize=10,style="dashed",label="m_usedClass",fontname="FreeSans"];
|
||||
Node18 [shape="box",label="Used",fontsize=10,height=0.2,width=0.4,fontname="FreeSans",color="black",URL="$classUsed.html"];
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
|
||||
<title>@DOC_TITLE@</title>
|
||||
<link href="doxygen.css" rel="stylesheet" type="text/css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<table width="100%" height="10%" bgcolor="#FFFFFF">
|
||||
<tr>
|
||||
<td colspan="2"><p><A href=http://www.atmel.com ><img src="atmel.jpg"/ border=0></A></p><br /></td>
|
||||
<td colspan="2"> <strong><font face="Helvetica" color="#000000" size="+3">Xmega Application Note</font></strong></td>
|
||||
<td colspan="2"><p><A href=http://www.atmel.com/products/AVR><img src="AVR_logo_blue.gif"/ border=0></A></p><br /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="6" height="1" background="blue.gif"></td>
|
||||
</tr>
|
||||
</table>
|
||||
<!-- Generated by Doxygen 1.5.5 -->
|
||||
<div class="contents">
|
||||
<h1>Graph Legend</h1>This page explains how to interpret the graphs that are generated by doxygen.<p>
|
||||
Consider the following example: <div class="fragment"><pre class="fragment"><span class="comment">/*! Invisible class because of truncation */</span>
|
||||
<span class="keyword">class </span>Invisible { };
|
||||
<span class="comment"></span>
|
||||
<span class="comment">/*! Truncated class, inheritance relation is hidden */</span>
|
||||
<span class="keyword">class </span>Truncated : <span class="keyword">public</span> Invisible { };
|
||||
|
||||
<span class="comment">/* Class not documented with doxygen comments */</span>
|
||||
<span class="keyword">class </span>Undocumented { };
|
||||
<span class="comment"></span>
|
||||
<span class="comment">/*! Class that is inherited using public inheritance */</span>
|
||||
<span class="keyword">class </span>PublicBase : <span class="keyword">public</span> Truncated { };
|
||||
<span class="comment"></span>
|
||||
<span class="comment">/*! A template class */</span>
|
||||
<span class="keyword">template</span><<span class="keyword">class</span> T> <span class="keyword">class </span>Templ { };
|
||||
<span class="comment"></span>
|
||||
<span class="comment">/*! Class that is inherited using protected inheritance */</span>
|
||||
<span class="keyword">class </span>ProtectedBase { };
|
||||
<span class="comment"></span>
|
||||
<span class="comment">/*! Class that is inherited using private inheritance */</span>
|
||||
<span class="keyword">class </span>PrivateBase { };
|
||||
<span class="comment"></span>
|
||||
<span class="comment">/*! Class that is used by the Inherited class */</span>
|
||||
<span class="keyword">class </span>Used { };
|
||||
<span class="comment"></span>
|
||||
<span class="comment">/*! Super class that inherits a number of other classes */</span>
|
||||
<span class="keyword">class </span>Inherited : <span class="keyword">public</span> PublicBase,
|
||||
<span class="keyword">protected</span> ProtectedBase,
|
||||
<span class="keyword">private</span> PrivateBase,
|
||||
<span class="keyword">public</span> Undocumented,
|
||||
<span class="keyword">public</span> Templ<int>
|
||||
{
|
||||
<span class="keyword">private</span>:
|
||||
Used *m_usedClass;
|
||||
};
|
||||
</pre></div> If the <code>MAX_DOT_GRAPH_HEIGHT</code> tag in the configuration file is set to 240 this will result in the following graph:<p>
|
||||
<center><div align="center">
|
||||
<img src="graph_legend.png" alt="graph_legend.png">
|
||||
</div>
|
||||
</center> <p>
|
||||
The boxes in the above graph have the following meaning: <ul>
|
||||
<li>
|
||||
A filled gray box represents the struct or class for which the graph is generated. </li>
|
||||
<li>
|
||||
A box with a black border denotes a documented struct or class. </li>
|
||||
<li>
|
||||
A box with a grey border denotes an undocumented struct or class. </li>
|
||||
<li>
|
||||
A box with a red border denotes a documented struct or class forwhich not all inheritance/containment relations are shown. A graph is truncated if it does not fit within the specified boundaries. </li>
|
||||
</ul>
|
||||
The arrows have the following meaning: <ul>
|
||||
<li>
|
||||
A dark blue arrow is used to visualize a public inheritance relation between two classes. </li>
|
||||
<li>
|
||||
A dark green arrow is used for protected inheritance. </li>
|
||||
<li>
|
||||
A dark red arrow is used for private inheritance. </li>
|
||||
<li>
|
||||
A purple dashed arrow is used if a class is contained or used by another class. The arrow is labeled with the variable(s) through which the pointed class or struct is accessible. </li>
|
||||
<li>
|
||||
A yellow dashed arrow denotes a relation between a template instance and the template class it was instantiated from. The arrow is labeled with the template parameters of the instance. </li>
|
||||
</ul>
|
||||
</div>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
|
||||
<title>@DOC_TITLE@</title>
|
||||
<link href="doxygen.css" rel="stylesheet" type="text/css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<table width="100%" height="10%" bgcolor="#FFFFFF">
|
||||
<tr>
|
||||
<td colspan="6" height="1" background="blue.gif"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="6">
|
||||
<address style="align: right;"><small>
|
||||
Generated on Wed Apr 23 07:45:46 2008 for AVR1306 Using the XMEGA Timer/Counter by <a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border=0></a> 1.5.5</small></address>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
@@ -0,0 +1,11 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN">
|
||||
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
|
||||
<title>AVR1306 Using the XMEGA Timer/Counter</title></head>
|
||||
<frameset cols="250,*">
|
||||
<frame src="tree.html" name="treefrm">
|
||||
<frame src="main.html" name="basefrm">
|
||||
<noframes>
|
||||
<a href="main.html">Frames are disabled. Click here to go to the main page.</a>
|
||||
</noframes>
|
||||
</frameset>
|
||||
</html>
|
||||
@@ -0,0 +1,72 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
|
||||
<title>@DOC_TITLE@</title>
|
||||
<link href="doxygen.css" rel="stylesheet" type="text/css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<table width="100%" height="10%" bgcolor="#FFFFFF">
|
||||
<tr>
|
||||
<td colspan="2"><p><A href=http://www.atmel.com ><img src="atmel.jpg"/ border=0></A></p><br /></td>
|
||||
<td colspan="2"> <strong><font face="Helvetica" color="#000000" size="+3">Xmega Application Note</font></strong></td>
|
||||
<td colspan="2"><p><A href=http://www.atmel.com/products/AVR><img src="AVR_logo_blue.gif"/ border=0></A></p><br /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="6" height="1" background="blue.gif"></td>
|
||||
</tr>
|
||||
</table>
|
||||
<!-- Generated by Doxygen 1.5.5 -->
|
||||
<div class="contents">
|
||||
<h1>AVR1306 Using the XMEGA Timer/Counter Documentation</h1>
|
||||
<p>
|
||||
<h3 align="center"><a href="http://www.atmel.com/dyn/products/app_notes.asp?family_id=607">Atmel AVR Application Notes</a> </h3><h2><a class="anchor" name="intro">
|
||||
Introduction</a></h2>
|
||||
This documents the firmware for the application note. <br>
|
||||
<h2><a class="anchor" name="compinfo">
|
||||
Compilation Info</a></h2>
|
||||
This firmware was compiled with IAR Embedded Workbench 5.10 and WinAVR 20080411.<br>
|
||||
<p>
|
||||
To make the project in IAR EWAVR:<br>
|
||||
Add the .c files (and .S90 files where applicable) for the given example to your project. Use device ATxmega128A1 and enable bit definitions in I/O include files, optimization low for debug target and high for release, output format: ubrof8 for Debug and intel_extended for Release, select Normal DLIB as library. <br>
|
||||
<p>
|
||||
To make the project in WinAVR:<br>
|
||||
Add the .c files (and .S files where applicable) for the given example to your project. Use device ATxmega128A1, optimization low for debug target and high for release. <br>
|
||||
<h2><a class="anchor" name="deviceinfo">
|
||||
Device Info</a></h2>
|
||||
All XMEGA devices with the targeted module can be used. The example is written for ATxmega128A1.<h2><a class="anchor" name="contactinfo">
|
||||
Contact Info</a></h2>
|
||||
For more info about Atmel AVR visit <a href="http://www.atmel.com/products/AVR/">http://www.atmel.com/products/AVR/</a> <br>
|
||||
For application notes visit <a href="http://www.atmel.com/dyn/products/app_notes.asp?family_id=607">http://www.atmel.com/dyn/products/app_notes.asp?family_id=607</a> <br>
|
||||
Support mail: <a href="mailto:avr@atmel.com">avr@atmel.com</a> <br>
|
||||
<p>
|
||||
<dl class="rcs" compact><dt><b>Revision</b></dt><dd>1251 </dd></dl>
|
||||
<dl class="rcs" compact><dt><b>Date</b></dt><dd>2008-02-18 15:33:18 +0100 (ma, 18 feb 2008) </dd></dl>
|
||||
<p>
|
||||
Copyright (c) 2008, Atmel Corporation All rights reserved.<p>
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:<p>
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.<p>
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.<p>
|
||||
3. The name of ATMEL may not be used to endorse or promote products derived from this software without specific prior written permission.<p>
|
||||
THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. </div>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
|
||||
<title>@DOC_TITLE@</title>
|
||||
<link href="doxygen.css" rel="stylesheet" type="text/css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<table width="100%" height="10%" bgcolor="#FFFFFF">
|
||||
<tr>
|
||||
<td colspan="6" height="1" background="blue.gif"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="6">
|
||||
<address style="align: right;"><small>
|
||||
Generated on Wed Apr 23 07:45:44 2008 for AVR1306 Using the XMEGA Timer/Counter by <a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border=0></a> 1.5.5</small></address>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 35 B |
Binary file not shown.
|
After Width: | Height: | Size: 706 B |
Binary file not shown.
|
After Width: | Height: | Size: 2.5 KiB |
@@ -0,0 +1,102 @@
|
||||
/* tabs styles, based on http://www.alistapart.com/articles/slidingdoors */
|
||||
|
||||
DIV.tabs
|
||||
{
|
||||
float : left;
|
||||
width : 100%;
|
||||
background : url("tab_b.gif") repeat-x bottom;
|
||||
margin-bottom : 4px;
|
||||
}
|
||||
|
||||
DIV.tabs UL
|
||||
{
|
||||
margin : 0px;
|
||||
padding-left : 10px;
|
||||
list-style : none;
|
||||
}
|
||||
|
||||
DIV.tabs LI, DIV.tabs FORM
|
||||
{
|
||||
display : inline;
|
||||
margin : 0px;
|
||||
padding : 0px;
|
||||
}
|
||||
|
||||
DIV.tabs FORM
|
||||
{
|
||||
float : right;
|
||||
}
|
||||
|
||||
DIV.tabs A
|
||||
{
|
||||
float : left;
|
||||
background : url("tab_r.gif") no-repeat right top;
|
||||
border-bottom : 1px solid #84B0C7;
|
||||
font-size : x-small;
|
||||
font-weight : bold;
|
||||
text-decoration : none;
|
||||
}
|
||||
|
||||
DIV.tabs A:hover
|
||||
{
|
||||
background-position: 100% -150px;
|
||||
}
|
||||
|
||||
DIV.tabs A:link, DIV.tabs A:visited,
|
||||
DIV.tabs A:active, DIV.tabs A:hover
|
||||
{
|
||||
color: #1A419D;
|
||||
}
|
||||
|
||||
DIV.tabs SPAN
|
||||
{
|
||||
float : left;
|
||||
display : block;
|
||||
background : url("tab_l.gif") no-repeat left top;
|
||||
padding : 5px 9px;
|
||||
white-space : nowrap;
|
||||
}
|
||||
|
||||
DIV.tabs INPUT
|
||||
{
|
||||
float : right;
|
||||
display : inline;
|
||||
font-size : 1em;
|
||||
}
|
||||
|
||||
DIV.tabs TD
|
||||
{
|
||||
font-size : x-small;
|
||||
font-weight : bold;
|
||||
text-decoration : none;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Commented Backslash Hack hides rule from IE5-Mac \*/
|
||||
DIV.tabs SPAN {float : none;}
|
||||
/* End IE5-Mac hack */
|
||||
|
||||
DIV.tabs A:hover SPAN
|
||||
{
|
||||
background-position: 0% -150px;
|
||||
}
|
||||
|
||||
DIV.tabs LI.current A
|
||||
{
|
||||
background-position: 100% -150px;
|
||||
border-width : 0px;
|
||||
}
|
||||
|
||||
DIV.tabs LI.current SPAN
|
||||
{
|
||||
background-position: 0% -150px;
|
||||
padding-bottom : 6px;
|
||||
}
|
||||
|
||||
DIV.navpath
|
||||
{
|
||||
background : none;
|
||||
border : none;
|
||||
border-bottom : 1px solid #84B0C7;
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8" />
|
||||
<meta http-equiv="Content-Style-Type" content="text/css" />
|
||||
<meta http-equiv="Content-Language" content="en" />
|
||||
<link rel="stylesheet" href="doxygen.css">
|
||||
<title>TreeView</title>
|
||||
<script type="text/javascript">
|
||||
<!-- // Hide script from old browsers
|
||||
|
||||
function toggleFolder(id, imageNode)
|
||||
{
|
||||
var folder = document.getElementById(id);
|
||||
var l = imageNode.src.length;
|
||||
if (imageNode.src.substring(l-20,l)=="ftv2folderclosed.png" ||
|
||||
imageNode.src.substring(l-18,l)=="ftv2folderopen.png")
|
||||
{
|
||||
imageNode = imageNode.previousSibling;
|
||||
l = imageNode.src.length;
|
||||
}
|
||||
if (folder == null)
|
||||
{
|
||||
}
|
||||
else if (folder.style.display == "block")
|
||||
{
|
||||
if (imageNode != null)
|
||||
{
|
||||
imageNode.nextSibling.src = "ftv2folderclosed.png";
|
||||
if (imageNode.src.substring(l-13,l) == "ftv2mnode.png")
|
||||
{
|
||||
imageNode.src = "ftv2pnode.png";
|
||||
}
|
||||
else if (imageNode.src.substring(l-17,l) == "ftv2mlastnode.png")
|
||||
{
|
||||
imageNode.src = "ftv2plastnode.png";
|
||||
}
|
||||
}
|
||||
folder.style.display = "none";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (imageNode != null)
|
||||
{
|
||||
imageNode.nextSibling.src = "ftv2folderopen.png";
|
||||
if (imageNode.src.substring(l-13,l) == "ftv2pnode.png")
|
||||
{
|
||||
imageNode.src = "ftv2mnode.png";
|
||||
}
|
||||
else if (imageNode.src.substring(l-17,l) == "ftv2plastnode.png")
|
||||
{
|
||||
imageNode.src = "ftv2mlastnode.png";
|
||||
}
|
||||
}
|
||||
folder.style.display = "block";
|
||||
}
|
||||
}
|
||||
|
||||
// End script hiding -->
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body class="ftvtree">
|
||||
<div class="directory">
|
||||
<h3>AVR1306 Using the XMEGA Timer/Counter</h3>
|
||||
<div style="display: block;">
|
||||
<p><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="main.html" target="basefrm">Main Page</a></p>
|
||||
<p><img src="ftv2pnode.png" alt="o" width=16 height=22 onclick="toggleFolder('folder1', this)"/><img src="ftv2folderclosed.png" alt="+" width=24 height=22 onclick="toggleFolder('folder1', this)"/><a class="el" href="files.html" target="basefrm">File List</a></p>
|
||||
<div id="folder1">
|
||||
<p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="avr__compiler_8h.html" target="basefrm">avr_compiler.h</a></p>
|
||||
<p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="documentation_8h.html" target="basefrm">documentation.h</a></p>
|
||||
<p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="TC__driver_8c.html" target="basefrm">TC_driver.c</a></p>
|
||||
<p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="TC__driver_8h.html" target="basefrm">TC_driver.h</a></p>
|
||||
<p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2lastnode.png" alt="\" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="TC__example_8c.html" target="basefrm">TC_example.c</a></p>
|
||||
</div>
|
||||
<p><img src="ftv2lastnode.png" alt="\" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="globals.html" target="basefrm">Globals</a></p>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,12 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
||||
"http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>Code Documentation Redirecting</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<meta http-equiv="Refresh" content="0;URL=doxygen/index.html" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
||||
Binary file not shown.
@@ -0,0 +1,154 @@
|
||||
/* This file has been prepared for Doxygen automatic documentation generation.*/
|
||||
/*! \file *********************************************************************
|
||||
*
|
||||
* \brief This file implements some macros that makes the IAR C-compiler and
|
||||
* avr-gcc work with the same code base for the AVR architecture.
|
||||
*
|
||||
* \par Documentation
|
||||
* For comprehensive code documentation, supported compilers, compiler
|
||||
* settings and supported devices see readme.html
|
||||
*
|
||||
* \author
|
||||
* Atmel Corporation: http://www.atmel.com \n
|
||||
* Support email: avr@atmel.com
|
||||
*
|
||||
* $Revision: 1694 $
|
||||
* $Date: 2008-07-29 14:21:58 +0200 (ti, 29 jul 2008) $ \n
|
||||
*
|
||||
* Copyright (c) 2008, Atmel Corporation All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. The name of ATMEL may not be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY AND
|
||||
* SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef COMPILER_AVR_H
|
||||
#define COMPILER_AVR_H
|
||||
|
||||
#ifndef F_CPU
|
||||
/*! \brief Define default CPU frequency, if this is not already defined. */
|
||||
#define F_CPU 2000000UL
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/*! \brief This macro will protect the following code from interrupts. */
|
||||
#define AVR_ENTER_CRITICAL_REGION( ) uint8_t volatile saved_sreg = SREG; \
|
||||
cli();
|
||||
|
||||
/*! \brief This macro must always be used in conjunction with AVR_ENTER_CRITICAL_REGION
|
||||
* so the interrupts are enabled again.
|
||||
*/
|
||||
#define AVR_LEAVE_CRITICAL_REGION( ) SREG = saved_sreg;
|
||||
|
||||
#if defined( __ICCAVR__ )
|
||||
|
||||
#include <inavr.h>
|
||||
#include <ioavr.h>
|
||||
#include <intrinsics.h>
|
||||
#include <pgmspace.h>
|
||||
|
||||
#ifndef __HAS_ELPM__
|
||||
#define _MEMATTR __flash
|
||||
#else /* __HAS_ELPM__ */
|
||||
#define _MEMATTR __farflash
|
||||
#endif /* __HAS_ELPM__ */
|
||||
|
||||
/*! \brief Perform a delay of \c us microseconds.
|
||||
*
|
||||
* The macro F_CPU is supposed to be defined to a constant defining the CPU
|
||||
* clock frequency (in Hertz).
|
||||
*
|
||||
* The maximal possible delay is 262.14 ms / F_CPU in MHz.
|
||||
*
|
||||
* \note For the IAR compiler, currently F_CPU must be a
|
||||
* multiple of 1000000UL (1 MHz).
|
||||
*/
|
||||
#define delay_us( us ) ( __delay_cycles( ( F_CPU / 1000000UL ) * ( us ) ) )
|
||||
|
||||
/*! \brief Preprocessor magic.
|
||||
*
|
||||
* Some preprocessor magic to allow for a header file abstraction of
|
||||
* interrupt service routine declarations for the IAR compiler. This
|
||||
* requires the use of the C99 _Pragma() directive (rather than the
|
||||
* old #pragma one that could not be used as a macro replacement), as
|
||||
* well as two different levels of preprocessor concetanations in
|
||||
* order to do both, assign the correct interrupt vector name, as well
|
||||
* as construct a unique function name for the ISR.
|
||||
*
|
||||
* \note Do *NOT* try to reorder the macros below, as this will only
|
||||
* work in the given order.
|
||||
*/
|
||||
#define PRAGMA(x) _Pragma( #x )
|
||||
#define ISR(vec) PRAGMA( vector=vec ) __interrupt void handler_##vec(void)
|
||||
#define sei( ) (__enable_interrupt( ))
|
||||
#define cli( ) (__disable_interrupt( ))
|
||||
|
||||
/*! \brief Define the no operation macro. */
|
||||
#define nop( ) (__no_operation())
|
||||
|
||||
/*! \brief Define the watchdog reset macro. */
|
||||
#define watchdog_reset( ) (__watchdog_reset( ))
|
||||
|
||||
|
||||
#define INLINE PRAGMA( inline=forced ) static
|
||||
|
||||
#define FLASH_DECLARE(x) _MEMATTR x
|
||||
#define FLASH_STRING(x) ((_MEMATTR const char *)(x))
|
||||
#define FLASH_STRING_T char const _MEMATTR *
|
||||
#define FLASH_BYTE_ARRAY_T uint8_t const _MEMATTR *
|
||||
#define PGM_READ_BYTE(x) *(x)
|
||||
#define PGM_READ_WORD(x) *(x)
|
||||
|
||||
#define SHORTENUM /**/
|
||||
|
||||
#elif defined( __GNUC__ )
|
||||
|
||||
#include <avr/io.h>
|
||||
#include <avr/interrupt.h>
|
||||
#include <avr/pgmspace.h>
|
||||
#include <util/delay.h>
|
||||
|
||||
/*! \brief Define the delay_us macro for GCC. */
|
||||
#define delay_us( us ) (_delay_us( us ))
|
||||
|
||||
#define INLINE static inline
|
||||
|
||||
/*! \brief Define the no operation macro. */
|
||||
#define nop() do { __asm__ __volatile__ ("nop"); } while (0)
|
||||
|
||||
#define MAIN_TASK_PROLOGUE int
|
||||
|
||||
|
||||
#define MAIN_TASK_EPILOGUE() return -1;
|
||||
|
||||
#define SHORTENUM __attribute__ ((packed))
|
||||
|
||||
#else
|
||||
#error Compiler not supported.
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,320 @@
|
||||
/* This file has been prepared for Doxygen automatic documentation generation.*/
|
||||
/*! \file *********************************************************************
|
||||
*
|
||||
* \brief
|
||||
* XMEGA USART driver source file.
|
||||
*
|
||||
* This file contains the function implementations the XMEGA interrupt
|
||||
* and polled USART driver.
|
||||
*
|
||||
* The driver is not intended for size and/or speed critical code, since
|
||||
* most functions are just a few lines of code, and the function call
|
||||
* overhead would decrease code performance. The driver is intended for
|
||||
* rapid prototyping and documentation purposes for getting started with
|
||||
* the XMEGA ADC module.
|
||||
*
|
||||
* For size and/or speed critical code, it is recommended to copy the
|
||||
* function contents directly into your application instead of making
|
||||
* a function call.
|
||||
*
|
||||
* Some functions use the following construct:
|
||||
* "some_register = ... | (some_parameter ? SOME_BIT_bm : 0) | ..."
|
||||
* Although the use of the ternary operator ( if ? then : else ) is discouraged,
|
||||
* in some occasions the operator makes it possible to write pretty clean and
|
||||
* neat code. In this driver, the construct is used to set or not set a
|
||||
* configuration bit based on a boolean input parameter, such as
|
||||
* the "some_parameter" in the example above.
|
||||
*
|
||||
* \par Application note:
|
||||
* AVR1307: Using the XMEGA USART
|
||||
*
|
||||
* \par Documentation
|
||||
* For comprehensive code documentation, supported compilers, compiler
|
||||
* settings and supported devices see readme.html
|
||||
*
|
||||
* \author
|
||||
* Atmel Corporation: http://www.atmel.com \n
|
||||
* Support email: avr@atmel.com
|
||||
*
|
||||
* $Revision: 1694 $
|
||||
* $Date: 2008-07-29 14:21:58 +0200 (ti, 29 jul 2008) $ \n
|
||||
*
|
||||
* Copyright (c) 2008, Atmel Corporation All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. The name of ATMEL may not be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY AND
|
||||
* SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
#include "usart_driver.h"
|
||||
|
||||
|
||||
|
||||
/*! \brief Initializes buffer and selects what USART module to use.
|
||||
*
|
||||
* Initializes receive and transmit buffer and selects what USART module to use,
|
||||
* and stores the data register empty interrupt level.
|
||||
*
|
||||
* \param usart_data The USART_data_t struct instance.
|
||||
* \param usart The USART module.
|
||||
* \param dreIntLevel Data register empty interrupt level.
|
||||
*/
|
||||
void USART_InterruptDriver_Initialize(USART_data_t * usart_data,
|
||||
USART_t * usart,
|
||||
USART_DREINTLVL_t dreIntLevel)
|
||||
{
|
||||
usart_data->usart = usart;
|
||||
usart_data->dreIntLevel = dreIntLevel;
|
||||
|
||||
usart_data->buffer.RX_Tail = 0;
|
||||
usart_data->buffer.RX_Head = 0;
|
||||
usart_data->buffer.TX_Tail = 0;
|
||||
usart_data->buffer.TX_Head = 0;
|
||||
}
|
||||
|
||||
|
||||
/*! \brief Set USART DRE interrupt level.
|
||||
*
|
||||
* Set the interrupt level on Data Register interrupt.
|
||||
*
|
||||
* \note Changing the DRE interrupt level in the interrupt driver while it is
|
||||
* running will not change the DRE interrupt level in the USART before the
|
||||
* DRE interrupt have been disabled and enabled again.
|
||||
*
|
||||
* \param usart_data The USART_data_t struct instance
|
||||
* \param dreIntLevel Interrupt level of the DRE interrupt.
|
||||
*/
|
||||
void USART_InterruptDriver_DreInterruptLevel_Set(USART_data_t * usart_data,
|
||||
USART_DREINTLVL_t dreIntLevel)
|
||||
{
|
||||
usart_data->dreIntLevel = dreIntLevel;
|
||||
}
|
||||
|
||||
|
||||
/*! \brief Test if there is data in the transmitter software buffer.
|
||||
*
|
||||
* This function can be used to test if there is free space in the transmitter
|
||||
* software buffer.
|
||||
*
|
||||
* \param usart_data The USART_data_t struct instance.
|
||||
*
|
||||
* \retval true There is data in the receive buffer.
|
||||
* \retval false The receive buffer is empty.
|
||||
*/
|
||||
bool USART_TXBuffer_FreeSpace(USART_data_t * usart_data)
|
||||
{
|
||||
/* Make copies to make sure that volatile access is specified. */
|
||||
uint8_t tempHead = (usart_data->buffer.TX_Head + 1) & USART_TX_BUFFER_MASK;
|
||||
uint8_t tempTail = usart_data->buffer.TX_Tail;
|
||||
|
||||
/* There are data left in the buffer unless Head and Tail are equal. */
|
||||
return (tempHead != tempTail);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*! \brief Put data (5-8 bit character).
|
||||
*
|
||||
* Stores data byte in TX software buffer and enables DRE interrupt if there
|
||||
* is free space in the TX software buffer.
|
||||
*
|
||||
* \param usart_data The USART_data_t struct instance.
|
||||
* \param data The data to send.
|
||||
*/
|
||||
bool USART_TXBuffer_PutByte(USART_data_t * usart_data, uint8_t data)
|
||||
{
|
||||
uint8_t tempCTRLA;
|
||||
uint8_t tempTX_Head;
|
||||
bool TXBuffer_FreeSpace;
|
||||
USART_Buffer_t * TXbufPtr;
|
||||
|
||||
TXbufPtr = &usart_data->buffer;
|
||||
TXBuffer_FreeSpace = USART_TXBuffer_FreeSpace(usart_data);
|
||||
|
||||
|
||||
if(TXBuffer_FreeSpace)
|
||||
{
|
||||
tempTX_Head = TXbufPtr->TX_Head;
|
||||
TXbufPtr->TX[tempTX_Head]= data;
|
||||
/* Advance buffer head. */
|
||||
TXbufPtr->TX_Head = (tempTX_Head + 1) & USART_TX_BUFFER_MASK;
|
||||
|
||||
/* Enable DRE interrupt. */
|
||||
tempCTRLA = usart_data->usart->CTRLA;
|
||||
tempCTRLA = (tempCTRLA & ~USART_DREINTLVL_gm) | usart_data->dreIntLevel;
|
||||
usart_data->usart->CTRLA = tempCTRLA;
|
||||
}
|
||||
return TXBuffer_FreeSpace;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*! \brief Test if there is data in the receive software buffer.
|
||||
*
|
||||
* This function can be used to test if there is data in the receive software
|
||||
* buffer.
|
||||
*
|
||||
* \param usart_data The USART_data_t struct instance
|
||||
*
|
||||
* \retval true There is data in the receive buffer.
|
||||
* \retval false The receive buffer is empty.
|
||||
*/
|
||||
bool USART_RXBufferData_Available(USART_data_t * usart_data)
|
||||
{
|
||||
/* Make copies to make sure that volatile access is specified. */
|
||||
uint8_t tempHead = usart_data->buffer.RX_Head;
|
||||
uint8_t tempTail = usart_data->buffer.RX_Tail;
|
||||
|
||||
/* There are data left in the buffer unless Head and Tail are equal. */
|
||||
return (tempHead != tempTail);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*! \brief Get received data (5-8 bit character).
|
||||
*
|
||||
* The function USART_RXBufferData_Available should be used before this
|
||||
* function is used to ensure that data is available.
|
||||
*
|
||||
* Returns data from RX software buffer.
|
||||
*
|
||||
* \param usart_data The USART_data_t struct instance.
|
||||
*
|
||||
* \return Received data.
|
||||
*/
|
||||
uint8_t USART_RXBuffer_GetByte(USART_data_t * usart_data)
|
||||
{
|
||||
USART_Buffer_t * bufPtr;
|
||||
uint8_t ans;
|
||||
|
||||
bufPtr = &usart_data->buffer;
|
||||
ans = (bufPtr->RX[bufPtr->RX_Tail]);
|
||||
|
||||
/* Advance buffer tail. */
|
||||
bufPtr->RX_Tail = (bufPtr->RX_Tail + 1) & USART_RX_BUFFER_MASK;
|
||||
|
||||
return ans;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*! \brief RX Complete Interrupt Service Routine.
|
||||
*
|
||||
* RX Complete Interrupt Service Routine.
|
||||
* Stores received data in RX software buffer.
|
||||
*
|
||||
* \param usart_data The USART_data_t struct instance.
|
||||
*/
|
||||
bool USART_RXComplete(USART_data_t * usart_data)
|
||||
{
|
||||
USART_Buffer_t * bufPtr;
|
||||
bool ans;
|
||||
|
||||
bufPtr = &usart_data->buffer;
|
||||
/* Advance buffer head. */
|
||||
uint8_t tempRX_Head = (bufPtr->RX_Head + 1) & USART_RX_BUFFER_MASK;
|
||||
|
||||
/* Check for overflow. */
|
||||
uint8_t tempRX_Tail = bufPtr->RX_Tail;
|
||||
uint8_t data = usart_data->usart->DATA;
|
||||
|
||||
if (tempRX_Head == tempRX_Tail) {
|
||||
ans = false;
|
||||
}else{
|
||||
ans = true;
|
||||
usart_data->buffer.RX[usart_data->buffer.RX_Head] = data;
|
||||
usart_data->buffer.RX_Head = tempRX_Head;
|
||||
}
|
||||
return ans;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*! \brief Data Register Empty Interrupt Service Routine.
|
||||
*
|
||||
* Data Register Empty Interrupt Service Routine.
|
||||
* Transmits one byte from TX software buffer. Disables DRE interrupt if buffer
|
||||
* is empty. Argument is pointer to USART (USART_data_t).
|
||||
*
|
||||
* \param usart_data The USART_data_t struct instance.
|
||||
*/
|
||||
void USART_DataRegEmpty(USART_data_t * usart_data)
|
||||
{
|
||||
USART_Buffer_t * bufPtr;
|
||||
bufPtr = &usart_data->buffer;
|
||||
|
||||
/* Check if all data is transmitted. */
|
||||
uint8_t tempTX_Tail = usart_data->buffer.TX_Tail;
|
||||
if (bufPtr->TX_Head == tempTX_Tail){
|
||||
/* Disable DRE interrupts. */
|
||||
uint8_t tempCTRLA = usart_data->usart->CTRLA;
|
||||
tempCTRLA = (tempCTRLA & ~USART_DREINTLVL_gm) | USART_DREINTLVL_OFF_gc;
|
||||
usart_data->usart->CTRLA = tempCTRLA;
|
||||
|
||||
}else{
|
||||
/* Start transmitting. */
|
||||
uint8_t data = bufPtr->TX[usart_data->buffer.TX_Tail];
|
||||
usart_data->usart->DATA = data;
|
||||
|
||||
/* Advance buffer tail. */
|
||||
bufPtr->TX_Tail = (bufPtr->TX_Tail + 1) & USART_TX_BUFFER_MASK;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*! \brief Put data (9 bit character).
|
||||
*
|
||||
* Use the function USART_IsTXDataRegisterEmpty before using this function to
|
||||
* put 9 bit character to the TX register.
|
||||
*
|
||||
* \param usart The USART module.
|
||||
* \param data The data to send.
|
||||
*/
|
||||
void USART_NineBits_PutChar(USART_t * usart, uint16_t data)
|
||||
{
|
||||
if(data & 0x0100) {
|
||||
usart->CTRLB |= USART_TXB8_bm;
|
||||
}else {
|
||||
usart->CTRLB &= ~USART_TXB8_bm;
|
||||
}
|
||||
|
||||
usart->DATA = (data & 0x00FF);
|
||||
}
|
||||
|
||||
|
||||
/*! \brief Get received data (9 bit character).
|
||||
*
|
||||
* This function reads out the received 9 bit character (uint16_t).
|
||||
* Use the function USART_IsRXComplete to check if anything is received.
|
||||
*
|
||||
* \param usart The USART module.
|
||||
*
|
||||
* \retval Received data.
|
||||
*/
|
||||
uint16_t USART_NineBits_GetChar(USART_t * usart)
|
||||
{
|
||||
if(usart->CTRLB & USART_RXB8_bm) {
|
||||
return(0x0100 | usart->DATA);
|
||||
}else {
|
||||
return(usart->DATA);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,306 @@
|
||||
/* This file has been prepared for Doxygen automatic documentation generation.*/
|
||||
/*! \file *********************************************************************
|
||||
*
|
||||
* \brief XMEGA USART driver header file.
|
||||
*
|
||||
* This file contains the function prototypes and enumerator definitions
|
||||
* for various configuration parameters for the XMEGA USART driver.
|
||||
*
|
||||
* The driver is not intended for size and/or speed critical code, since
|
||||
* most functions are just a few lines of code, and the function call
|
||||
* overhead would decrease code performance. The driver is intended for
|
||||
* rapid prototyping and documentation purposes for getting started with
|
||||
* the XMEGA ADC module.
|
||||
*
|
||||
* For size and/or speed critical code, it is recommended to copy the
|
||||
* function contents directly into your application instead of making
|
||||
* a function call.
|
||||
*
|
||||
* \par Application note:
|
||||
* AVR1307: Using the XMEGA USART
|
||||
*
|
||||
* \par Documentation
|
||||
* For comprehensive code documentation, supported compilers, compiler
|
||||
* settings and supported devices see readme.html
|
||||
*
|
||||
* \author
|
||||
* Atmel Corporation: http://www.atmel.com \n
|
||||
* Support email: avr@atmel.com
|
||||
*
|
||||
* $Revision: 1694 $
|
||||
* $Date: 2008-07-29 14:21:58 +0200 (ti, 29 jul 2008) $ \n
|
||||
*
|
||||
* Copyright (c) 2008, Atmel Corporation All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. The name of ATMEL may not be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY AND
|
||||
* SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
#ifndef USART_DRIVER_H
|
||||
#define USART_DRIVER_H
|
||||
|
||||
#include "avr_compiler.h"
|
||||
|
||||
/* USART buffer defines. */
|
||||
|
||||
/* \brief Receive buffer size: 2,4,8,16,32,64,128 or 256 bytes. */
|
||||
#define USART_RX_BUFFER_SIZE 4
|
||||
/* \brief Transmit buffer size: 2,4,8,16,32,64,128 or 256 bytes */
|
||||
#define USART_TX_BUFFER_SIZE 4
|
||||
/* \brief Receive buffer mask. */
|
||||
#define USART_RX_BUFFER_MASK ( USART_RX_BUFFER_SIZE - 1 )
|
||||
/* \brief Transmit buffer mask. */
|
||||
#define USART_TX_BUFFER_MASK ( USART_TX_BUFFER_SIZE - 1 )
|
||||
|
||||
|
||||
#if ( USART_RX_BUFFER_SIZE & USART_RX_BUFFER_MASK )
|
||||
#error RX buffer size is not a power of 2
|
||||
#endif
|
||||
#if ( USART_TX_BUFFER_SIZE & USART_TX_BUFFER_MASK )
|
||||
#error TX buffer size is not a power of 2
|
||||
#endif
|
||||
|
||||
|
||||
/* \brief USART transmit and receive ring buffer. */
|
||||
typedef struct USART_Buffer
|
||||
{
|
||||
/* \brief Receive buffer. */
|
||||
volatile uint8_t RX[USART_RX_BUFFER_SIZE];
|
||||
/* \brief Transmit buffer. */
|
||||
volatile uint8_t TX[USART_TX_BUFFER_SIZE];
|
||||
/* \brief Receive buffer head. */
|
||||
volatile uint8_t RX_Head;
|
||||
/* \brief Receive buffer tail. */
|
||||
volatile uint8_t RX_Tail;
|
||||
/* \brief Transmit buffer head. */
|
||||
volatile uint8_t TX_Head;
|
||||
/* \brief Transmit buffer tail. */
|
||||
volatile uint8_t TX_Tail;
|
||||
} USART_Buffer_t;
|
||||
|
||||
|
||||
/*! \brief Struct used when interrupt driven driver is used.
|
||||
*
|
||||
* Struct containing pointer to a usart, a buffer and a location to store Data
|
||||
* register interrupt level temporary.
|
||||
*/
|
||||
typedef struct Usart_and_buffer
|
||||
{
|
||||
/* \brief Pointer to USART module to use. */
|
||||
USART_t * usart;
|
||||
/* \brief Data register empty interrupt level. */
|
||||
USART_DREINTLVL_t dreIntLevel;
|
||||
/* \brief Data buffer. */
|
||||
USART_Buffer_t buffer;
|
||||
} USART_data_t;
|
||||
|
||||
|
||||
/* Macros. */
|
||||
|
||||
/*! \brief Macro that sets the USART frame format.
|
||||
*
|
||||
* Sets the frame format, Frame Size, parity mode and number of stop bits.
|
||||
*
|
||||
* \param _usart Pointer to the USART module
|
||||
* \param _charSize The character size. Use USART_CHSIZE_t type.
|
||||
* \param _parityMode The parity Mode. Use USART_PMODE_t type.
|
||||
* \param _twoStopBits Enable two stop bit mode. Use bool type.
|
||||
*/
|
||||
#define USART_Format_Set(_usart, _charSize, _parityMode, _twoStopBits) \
|
||||
(_usart)->CTRLC = (uint8_t) _charSize | _parityMode | \
|
||||
(_twoStopBits ? USART_SBMODE_bm : 0)
|
||||
|
||||
|
||||
/*! \brief Set USART baud rate.
|
||||
*
|
||||
* Sets the USART's baud rate register.
|
||||
*
|
||||
* UBRR_Value : Value written to UBRR
|
||||
* ScaleFactor : Time Base Generator Scale Factor
|
||||
*
|
||||
* Equation for calculation of BSEL value in asynchronous normal speed mode:
|
||||
* If ScaleFactor >= 0
|
||||
* BSEL = ((I/O clock frequency)/(2^(ScaleFactor)*16*Baudrate))-1
|
||||
* If ScaleFactor < 0
|
||||
* BSEL = (1/(2^(ScaleFactor)*16))*(((I/O clock frequency)/Baudrate)-1)
|
||||
*
|
||||
* \note See XMEGA manual for equations for calculation of BSEL value in other
|
||||
* modes.
|
||||
*
|
||||
* \param _usart Pointer to the USART module.
|
||||
* \param _bselValue Value to write to BSEL part of Baud control register.
|
||||
* Use uint16_t type.
|
||||
* \param _bScaleFactor USART baud rate scale factor.
|
||||
* Use uint8_t type
|
||||
*/
|
||||
#define USART_Baudrate_Set(_usart, _bselValue, _bScaleFactor) \
|
||||
(_usart)->BAUDCTRLA =(uint8_t)_bselValue; \
|
||||
(_usart)->BAUDCTRLB =(_bScaleFactor << USART_BSCALE0_bp)|(_bselValue >> 8)
|
||||
|
||||
|
||||
/*! \brief Enable USART receiver.
|
||||
*
|
||||
* \param _usart Pointer to the USART module
|
||||
*/
|
||||
#define USART_Rx_Enable(_usart) ((_usart)->CTRLB |= USART_RXEN_bm)
|
||||
|
||||
|
||||
/*! \brief Disable USART receiver.
|
||||
*
|
||||
* \param _usart Pointer to the USART module.
|
||||
*/
|
||||
#define USART_Rx_Disable(_usart) ((_usart)->CTRLB &= ~USART_RXEN_bm)
|
||||
|
||||
|
||||
/*! \brief Enable USART transmitter.
|
||||
*
|
||||
* \param _usart Pointer to the USART module.
|
||||
*/
|
||||
#define USART_Tx_Enable(_usart) ((_usart)->CTRLB |= USART_TXEN_bm)
|
||||
|
||||
|
||||
/*! \brief Disable USART transmitter.
|
||||
*
|
||||
* \param _usart Pointer to the USART module.
|
||||
*/
|
||||
#define USART_Tx_Disable(_usart) ((_usart)->CTRLB &= ~USART_TXEN_bm)
|
||||
|
||||
|
||||
/*! \brief Set USART RXD interrupt level.
|
||||
*
|
||||
* Sets the interrupt level on RX Complete interrupt.
|
||||
*
|
||||
* \param _usart Pointer to the USART module.
|
||||
* \param _rxdIntLevel Interrupt level of the RXD interrupt.
|
||||
* Use USART_RXCINTLVL_t type.
|
||||
*/
|
||||
#define USART_RxdInterruptLevel_Set(_usart, _rxdIntLevel) \
|
||||
((_usart)->CTRLA = ((_usart)->CTRLA & ~USART_RXCINTLVL_gm) | _rxdIntLevel)
|
||||
|
||||
|
||||
/*! \brief Set USART TXD interrupt level.
|
||||
*
|
||||
* Sets the interrupt level on TX Complete interrupt.
|
||||
*
|
||||
* \param _usart Pointer to the USART module.
|
||||
* \param _txdIntLevel Interrupt level of the TXD interrupt.
|
||||
* Use USART_TXCINTLVL_t type.
|
||||
*/
|
||||
#define USART_TxdInterruptLevel_Set(_usart, _txdIntLevel) \
|
||||
(_usart)->CTRLA = ((_usart)->CTRLA & ~USART_TXCINTLVL_gm) | _txdIntLevel
|
||||
|
||||
|
||||
|
||||
/*! \brief Set USART DRE interrupt level.
|
||||
*
|
||||
* Sets the interrupt level on Data Register interrupt.
|
||||
*
|
||||
* \param _usart Pointer to the USART module.
|
||||
* \param _dreIntLevel Interrupt level of the DRE interrupt.
|
||||
* Use USART_DREINTLVL_t type.
|
||||
*/
|
||||
#define USART_DreInterruptLevel_Set(_usart, _dreIntLevel) \
|
||||
(_usart)->CTRLA = ((_usart)->CTRLA & ~USART_DREINTLVL_gm) | _dreIntLevel
|
||||
|
||||
|
||||
/*! \brief Set the mode the USART run in.
|
||||
*
|
||||
* Set the mode the USART run in. The default mode is asynchronous mode.
|
||||
*
|
||||
* \param _usart Pointer to the USART module register section.
|
||||
* \param _usartMode Selects the USART mode. Use USART_CMODE_t type.
|
||||
*
|
||||
* USART modes:
|
||||
* - 0x0 : Asynchronous mode.
|
||||
* - 0x1 : Synchronous mode.
|
||||
* - 0x2 : IrDA mode.
|
||||
* - 0x3 : Master SPI mode.
|
||||
*/
|
||||
#define USART_SetMode(_usart, _usartMode) \
|
||||
((_usart)->CTRLC = ((_usart)->CTRLC & (~USART_CMODE_gm)) | _usartMode)
|
||||
|
||||
|
||||
|
||||
/*! \brief Check if data register empty flag is set.
|
||||
*
|
||||
* \param _usart The USART module.
|
||||
*/
|
||||
#define USART_IsTXDataRegisterEmpty(_usart) (((_usart)->STATUS & USART_DREIF_bm) != 0)
|
||||
|
||||
|
||||
|
||||
/*! \brief Put data (5-8 bit character).
|
||||
*
|
||||
* Use the macro USART_IsTXDataRegisterEmpty before using this function to
|
||||
* put data to the TX register.
|
||||
*
|
||||
* \param _usart The USART module.
|
||||
* \param _data The data to send.
|
||||
*/
|
||||
#define USART_PutChar(_usart, _data) ((_usart)->DATA = _data)
|
||||
|
||||
|
||||
|
||||
/*! \brief Checks if the RX complete interrupt flag is set.
|
||||
*
|
||||
* Checks if the RX complete interrupt flag is set.
|
||||
*
|
||||
* \param _usart The USART module.
|
||||
*/
|
||||
#define USART_IsRXComplete(_usart) (((_usart)->STATUS & USART_RXCIF_bm) != 0)
|
||||
|
||||
|
||||
|
||||
|
||||
/*! \brief Get received data (5-8 bit character).
|
||||
*
|
||||
* This macro reads out the RX register.
|
||||
* Use the macro USART_RX_Complete to check if anything is received.
|
||||
*
|
||||
* \param _usart The USART module.
|
||||
*
|
||||
* \retval Received data.
|
||||
*/
|
||||
#define USART_GetChar(_usart) ((_usart)->DATA)
|
||||
|
||||
|
||||
/* Functions for interrupt driven driver. */
|
||||
void USART_InterruptDriver_Initialize(USART_data_t * usart_data,
|
||||
USART_t * usart,
|
||||
USART_DREINTLVL_t dreIntLevel );
|
||||
|
||||
void USART_InterruptDriver_DreInterruptLevel_Set(USART_data_t * usart_data,
|
||||
USART_DREINTLVL_t dreIntLevel);
|
||||
|
||||
bool USART_TXBuffer_FreeSpace(USART_data_t * usart_data);
|
||||
bool USART_TXBuffer_PutByte(USART_data_t * usart_data, uint8_t data);
|
||||
bool USART_RXBufferData_Available(USART_data_t * usart_data);
|
||||
uint8_t USART_RXBuffer_GetByte(USART_data_t * usart_data);
|
||||
bool USART_RXComplete(USART_data_t * usart_data);
|
||||
void USART_DataRegEmpty(USART_data_t * usart_data);
|
||||
|
||||
/* Functions for polled driver. */
|
||||
void USART_NineBits_PutChar(USART_t * usart, uint16_t data);
|
||||
uint16_t USART_NineBits_GetChar(USART_t * usart);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,180 @@
|
||||
/* This file has been prepared for Doxygen automatic documentation generation.*/
|
||||
/*! \file *********************************************************************
|
||||
*
|
||||
* \brief XMEGA USART interrupt driven driver example source.
|
||||
*
|
||||
* This file contains an example application that demonstrates the
|
||||
* interrupt driven USART driver. The code example sends three bytes, waits
|
||||
* for three bytes to be received and tests if the received data equals the
|
||||
* sent data.
|
||||
*
|
||||
* \par Application note:
|
||||
* AVR1307: Using the XMEGA USART
|
||||
*
|
||||
* \par Documentation
|
||||
* For comprehensive code documentation, supported compilers, compiler
|
||||
* settings and supported devices see readme.html
|
||||
*
|
||||
* \author
|
||||
* Atmel Corporation: http://www.atmel.com \n
|
||||
* Support email: avr@atmel.com
|
||||
*
|
||||
* $Revision: 1694 $
|
||||
* $Date: 2008-07-29 14:21:58 +0200 (ti, 29 jul 2008) $ \n
|
||||
*
|
||||
* Copyright (c) 2008, Atmel Corporation All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. The name of ATMEL may not be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY AND
|
||||
* SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
#include "usart_driver.h"
|
||||
#include "avr_compiler.h"
|
||||
|
||||
/*! Number of bytes to send in test example. */
|
||||
#define NUM_BYTES 3
|
||||
/*! Define that selects the Usart used in example. */
|
||||
#define USART USARTC0
|
||||
|
||||
/*! USART data struct used in example. */
|
||||
USART_data_t USART_data;
|
||||
/*! Test data to send. */
|
||||
uint8_t sendArray[NUM_BYTES] = {0x55, 0xaa, 0xf0};
|
||||
/*! Array to put received data in. */
|
||||
uint8_t receiveArray[NUM_BYTES];
|
||||
/*! Success variable, used to test driver. */
|
||||
bool success;
|
||||
|
||||
|
||||
/*! \brief Example application.
|
||||
*
|
||||
* Example application. This example configures USARTC0 for with the parameters:
|
||||
* - 8 bit character size
|
||||
* - No parity
|
||||
* - 1 stop bit
|
||||
* - 9600 Baud
|
||||
*
|
||||
* This function then sends three bytes and tests if the received data is
|
||||
* equal to the sent data. The code can be tested by connecting PC3 to PC2. If
|
||||
* the variable 'success' is true at the end of the function, the three bytes
|
||||
* have been successfully sent and received.
|
||||
*/
|
||||
int main(void)
|
||||
{
|
||||
/* counter variable. */
|
||||
uint8_t i;
|
||||
|
||||
/* This PORT setting is only valid to USARTC0 if other USARTs is used a
|
||||
* different PORT and/or pins are used. */
|
||||
/* PC3 (TXD0) as output. */
|
||||
PORTC.DIRSET = PIN3_bm;
|
||||
/* PC2 (RXD0) as input. */
|
||||
PORTC.DIRCLR = PIN2_bm;
|
||||
|
||||
/* Use USARTC0 and initialize buffers. */
|
||||
USART_InterruptDriver_Initialize(&USART_data, &USART, USART_DREINTLVL_LO_gc);
|
||||
|
||||
/* USARTC0, 8 Data bits, No Parity, 1 Stop bit. */
|
||||
USART_Format_Set(USART_data.usart, USART_CHSIZE_8BIT_gc,
|
||||
USART_PMODE_DISABLED_gc, false);
|
||||
|
||||
/* Enable RXC interrupt. */
|
||||
USART_RxdInterruptLevel_Set(USART_data.usart, USART_RXCINTLVL_LO_gc);
|
||||
|
||||
/* Set Baudrate to 9600 bps:
|
||||
* Use the default I/O clock frequency that is 2 MHz.
|
||||
* Do not use the baudrate scale factor
|
||||
*
|
||||
* Baudrate select = (1/(16*(((I/O clock frequency)/Baudrate)-1)
|
||||
* = 12
|
||||
*/
|
||||
USART_Baudrate_Set(&USART, 12 , 0);
|
||||
|
||||
/* Enable both RX and TX. */
|
||||
USART_Rx_Enable(USART_data.usart);
|
||||
USART_Tx_Enable(USART_data.usart);
|
||||
|
||||
/* Enable PMIC interrupt level low. */
|
||||
PMIC.CTRL |= PMIC_LOLVLEX_bm;
|
||||
|
||||
/* Enable global interrupts. */
|
||||
sei();
|
||||
|
||||
/* Send sendArray. */
|
||||
i = 0;
|
||||
while (i < NUM_BYTES) {
|
||||
bool byteToBuffer;
|
||||
byteToBuffer = USART_TXBuffer_PutByte(&USART_data, sendArray[i]);
|
||||
if(byteToBuffer){
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
/* Fetch received data as it is received. */
|
||||
i = 0;
|
||||
while (i < NUM_BYTES) {
|
||||
if (USART_RXBufferData_Available(&USART_data)) {
|
||||
receiveArray[i] = USART_RXBuffer_GetByte(&USART_data);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
/* Test to see if sent data equals received data. */
|
||||
/* Assume success first.*/
|
||||
|
||||
for(i = 0; i < NUM_BYTES; i++) {
|
||||
/* Check that each element is received correctly. */
|
||||
USART_TXBuffer_PutByte(&USART_data, receiveArray[i]);
|
||||
}
|
||||
|
||||
/* If success the program ends up inside the if statement.*/
|
||||
if(success){
|
||||
while(true);
|
||||
}else{
|
||||
while(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*! \brief Receive complete interrupt service routine.
|
||||
*
|
||||
* Receive complete interrupt service routine.
|
||||
* Calls the common receive complete handler with pointer to the correct USART
|
||||
* as argument.
|
||||
*/
|
||||
ISR(USARTC0_RXC_vect)
|
||||
{
|
||||
USART_RXComplete(&USART_data);
|
||||
}
|
||||
|
||||
|
||||
/*! \brief Data register empty interrupt service routine.
|
||||
*
|
||||
* Data register empty interrupt service routine.
|
||||
* Calls the common data register empty complete handler with pointer to the
|
||||
* correct USART as argument.
|
||||
*/
|
||||
ISR(USARTC0_DRE_vect)
|
||||
{
|
||||
USART_DataRegEmpty(&USART_data);
|
||||
}
|
||||
@@ -0,0 +1,146 @@
|
||||
/* This file has been prepared for Doxygen automatic documentation generation.*/
|
||||
/*! \file *********************************************************************
|
||||
*
|
||||
* \brief XMEGA polled USART driver example source.
|
||||
*
|
||||
* This file contains an example application that demonstrates the polled
|
||||
* USART driver. The code example sends all values between 0 and 255 and
|
||||
* checks that the values received are equal to the values sent. It can be
|
||||
* tested, using a loop-back wire between I/O pins PC2 and PC3.
|
||||
*
|
||||
* \par Application note:
|
||||
* AVR1307: Using the XMEGA USART
|
||||
*
|
||||
* \par Documentation
|
||||
* For comprehensive code documentation, supported compilers, compiler
|
||||
* settings and supported devices see readme.html
|
||||
*
|
||||
* \author
|
||||
* Atmel Corporation: http://www.atmel.com \n
|
||||
* Support email: avr@atmel.com
|
||||
*
|
||||
* $Revision: 1694 $
|
||||
* $Date: 2008-07-29 14:21:58 +0200 (ti, 29 jul 2008) $ \n
|
||||
*
|
||||
* Copyright (c) 2008, Atmel Corporation All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. The name of ATMEL may not be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY AND
|
||||
* SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
#include "usart_driver.h"
|
||||
#include "avr_compiler.h"
|
||||
|
||||
|
||||
/*! Define that selects the Usart used in example. */
|
||||
#define USART USARTC0
|
||||
|
||||
|
||||
/*! Success variable, used to test driver. */
|
||||
bool success;
|
||||
|
||||
|
||||
/*! \brief Example application.
|
||||
*
|
||||
* Example applicaton. This example configures USARTC0 for with the parameters:
|
||||
* - 8 bit character size
|
||||
* - No parity
|
||||
* - 1 stop bit
|
||||
* - 9600 Baud
|
||||
*
|
||||
* This function then sends the values 0-255 and tests if the received data is
|
||||
* equal to the sent data. The code can be tested by connecting PC3 to PC2. If
|
||||
* the variable 'success' is true at the end of the function, the values
|
||||
* have been successfully sent and received.
|
||||
*/
|
||||
int main(void)
|
||||
{
|
||||
|
||||
/* Variable used to send and receive data. */
|
||||
uint8_t sendData;
|
||||
uint8_t receivedData;
|
||||
|
||||
/* This PORT setting is only valid to USARTC0 if other USARTs is used a
|
||||
* different PORT and/or pins is used. */
|
||||
/* PIN3 (TXD0) as output. */
|
||||
PORTC.DIRSET = PIN3_bm;
|
||||
|
||||
/* PC2 (RXD0) as input. */
|
||||
PORTC.DIRCLR = PIN2_bm;
|
||||
|
||||
/* USARTC0, 8 Data bits, No Parity, 1 Stop bit. */
|
||||
USART_Format_Set(&USART, USART_CHSIZE_8BIT_gc, USART_PMODE_DISABLED_gc, false);
|
||||
|
||||
/* Set Baudrate to 9600 bps:
|
||||
* Use the default I/O clock fequency that is 2 MHz.
|
||||
* Do not use the baudrate scale factor
|
||||
*
|
||||
* Baudrate select = (1/(16*(((I/O clock frequency)/Baudrate)-1)
|
||||
* = 12
|
||||
*/
|
||||
USART_Baudrate_Set(&USART, 12 , 0);
|
||||
|
||||
/* Enable both RX and TX. */
|
||||
USART_Rx_Enable(&USART);
|
||||
USART_Tx_Enable(&USART);
|
||||
|
||||
|
||||
/* Assume that everything is OK. */
|
||||
success = true;
|
||||
/* Send data from 255 down to 0*/
|
||||
sendData = 255;
|
||||
while(sendData) {
|
||||
/* Send one char. */
|
||||
do{
|
||||
/* Wait until it is possible to put data into TX data register.
|
||||
* NOTE: If TXDataRegister never becomes empty this will be a DEADLOCK. */
|
||||
}while(!USART_IsTXDataRegisterEmpty(&USART));
|
||||
USART_PutChar(&USART, sendData);
|
||||
|
||||
uint16_t timeout = 1000;
|
||||
/* Receive one char. */
|
||||
do{
|
||||
/* Wait until data received or a timeout.*/
|
||||
timeout--;
|
||||
}while(!USART_IsRXComplete(&USART) && timeout!=0);
|
||||
receivedData = USART_GetChar(&USART);
|
||||
|
||||
/* Check the received data. */
|
||||
if (receivedData != sendData){
|
||||
success = false;
|
||||
}
|
||||
sendData--;
|
||||
}
|
||||
|
||||
/* Disable both RX and TX. */
|
||||
USART_Rx_Disable(&USART);
|
||||
USART_Tx_Disable(&USART);
|
||||
|
||||
/* If success the program ends up inside the if statment.*/
|
||||
if(success){
|
||||
while(true);
|
||||
}else{
|
||||
while(true);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user