Defines | Functions

# timer16_drv.h File Reference

This file contains the low level functions (drivers) of 16-bit Timer(s) More...

`#include "config.h"`
Include dependency graph for timer16_drv.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Defines
#define | TIMER16_1 0x01
#define | TIMER16_3 0x03
#define | BOTH_TIMER16 0xFF
#define | Timer16_get_counter() ( timer16_get_counter() )
#define | Timer16_get_capture() ( timer16_get_capture() )
#define | Timer16_set_pwm_a(value) ( Timer16_set_compare_a(value) )
#define | Timer16_set_pwm_b(value) ( Timer16_set_compare_b(value) )
#define | Timer16_set_pwm_c(value) ( Timer16_set_compare_c(value) )
#define | Timer16_get_pwm_a() ( Timer16_get_compare_a() )
#define | Timer16_get_pwm_b() ( Timer16_get_compare_b() )
#define | Timer16_get_pwm_c() ( Timer16_get_compare_c() )
#define | Timer16_off() Timer16_set_clock(TIMER16_NO_CLOCK)
#define | TIMER16_COMP_MODE_NORMAL (0)
#define | TIMER16_COMP_MODE_TOGGLE (1)
#define | TIMER16_COMP_MODE_CLEAR_OC (2)
#define | TIMER16_COMP_MODE_SET_OC (3)
#define | TIMER16_COMP_MODE_MASK_A (3<<COM1A0)
#define | TIMER16_COMP_MODE_MASK_B (3<<COM1B0)
#define | TIMER16_COMP_MODE_MASK_C (3<<COM1C0)
#define | TIMER16_WGM_NORMAL (0)
#define | TIMER16_WGM_CTC_OCR (4)
#define | TIMER16_WGM_CTC_ICR (12)
#define | TIMER16_WGM_PWM_PC8 (1)
#define | TIMER16_WGM_PWM_PC9 (2)
#define | TIMER16_WGM_PWM_PC10 (3)
#define | TIMER16_WGM_PWM_PC_ICR (10)
#define | TIMER16_WGM_PWM_PC_OCR (11)
#define | TIMER16_WGM_PWM_PFC_ICR (8)
#define | TIMER16_WGM_PWM_PFC_OCR (9)
#define | TIMER16_WGM_FAST_PWM8 (5)
#define | TIMER16_WGM_FAST_PWM9 (6)
#define | TIMER16_WGM_FAST_PWM10 (7)
#define | TIMER16_WGM_FAST_PWM_ICR (14)
#define | TIMER16_WGM_FAST_PWM_OCR (15)
#define | TIMER16_WGM_RA_MASK (3<<WGM10)
#define | TIMER16_WGM_RB_MASK (3<<WGM12)
#define | TIMER16_NO_CLOCK (0)
#define | TIMER16_CLKIO_BY_1 (1)
#define | TIMER16_CLKIO_BY_8 (2)
#define | TIMER16_CLKIO_BY_64 (3)
#define | TIMER16_CLKIO_BY_256 (4)
#define | TIMER16_CLKIO_BY_1024 (5)
#define | TIMER16_EXT_CLOCK_FALLING_EDGE (6)
#define | TIMER16_EXT_CLOCK_RISING_EDGE (7)
#define | TIMER16_CLK_MASK (7<<CS10)
## Functions
U16 | timer16_get_counter (void)
| This function READ the 16-bit TIMER counter.
U16 | timer16_get_capture (void)
| This function READ the 16-bit TIMER capture register.

## Detailed Description

This file contains the low level functions (drivers) of 16-bit Timer(s)

- Compiler: IAR EWAVR and GNU GCC for AVR
- Supported devices: ATmega32U4

Author:
  Atmel Corporation: http://www.atmel.com
  Support and FAQ: http://support.atmel.no/

Definition in file timer16_drv.h.

## Define Documentation

#define TIMER16_1 0x01

Definition at line 59 of file timer16_drv.h.

#define TIMER16_3 0x03

Definition at line 62 of file timer16_drv.h.

#define BOTH_TIMER16 0xFF

Definition at line 65 of file timer16_drv.h.

#define Timer16_get_counter | ( | ) | ( timer16_get_counter() )

Definition at line 71 of file timer16_drv.h.

#define Timer16_get_capture | ( | ) | ( timer16_get_capture() )

Definition at line 72 of file timer16_drv.h.

#define Timer16_set_pwm_a | ( |  | value ) | ( Timer16_set_compare_a(value) )

Definition at line 74 of file timer16_drv.h.

#define Timer16_set_pwm_b | ( |  | value ) | ( Timer16_set_compare_b(value) )

Definition at line 75 of file timer16_drv.h.

#define Timer16_set_pwm_c | ( |  | value ) | ( Timer16_set_compare_c(value) )

Definition at line 76 of file timer16_drv.h.

#define Timer16_get_pwm_a | ( | ) | ( Timer16_get_compare_a() )

Definition at line 77 of file timer16_drv.h.

#define Timer16_get_pwm_b | ( | ) | ( Timer16_get_compare_b() )

Definition at line 78 of file timer16_drv.h.

#define Timer16_get_pwm_c | ( | ) | ( Timer16_get_compare_c() )

Definition at line 79 of file timer16_drv.h.

#define Timer16_off | ( | ) | Timer16_set_clock(TIMER16_NO_CLOCK)

Definition at line 81 of file timer16_drv.h.

#define TIMER16_COMP_MODE_NORMAL (0)

Definition at line 446 of file timer16_drv.h.

#define TIMER16_COMP_MODE_TOGGLE (1)

Definition at line 447 of file timer16_drv.h.

#define TIMER16_COMP_MODE_CLEAR_OC (2)

Definition at line 448 of file timer16_drv.h.

#define TIMER16_COMP_MODE_SET_OC (3)

Definition at line 449 of file timer16_drv.h.

#define TIMER16_COMP_MODE_MASK_A (3<<COM1A0)

Definition at line 450 of file timer16_drv.h.

#define TIMER16_COMP_MODE_MASK_B (3<<COM1B0)

Definition at line 451 of file timer16_drv.h.

#define TIMER16_COMP_MODE_MASK_C (3<<COM1C0)

Definition at line 452 of file timer16_drv.h.

#define TIMER16_WGM_NORMAL (0)

Definition at line 454 of file timer16_drv.h.

#define TIMER16_WGM_CTC_OCR (4)

Definition at line 455 of file timer16_drv.h.

#define TIMER16_WGM_CTC_ICR (12)

Definition at line 456 of file timer16_drv.h.

#define TIMER16_WGM_PWM_PC8 (1)

Definition at line 457 of file timer16_drv.h.

#define TIMER16_WGM_PWM_PC9 (2)

Definition at line 458 of file timer16_drv.h.

#define TIMER16_WGM_PWM_PC10 (3)

Definition at line 459 of file timer16_drv.h.

#define TIMER16_WGM_PWM_PC_ICR (10)

Definition at line 460 of file timer16_drv.h.

#define TIMER16_WGM_PWM_PC_OCR (11)

Definition at line 461 of file timer16_drv.h.

#define TIMER16_WGM_PWM_PFC_ICR (8)

Definition at line 462 of file timer16_drv.h.

#define TIMER16_WGM_PWM_PFC_OCR (9)

Definition at line 463 of file timer16_drv.h.

#define TIMER16_WGM_FAST_PWM8 (5)

Definition at line 464 of file timer16_drv.h.

#define TIMER16_WGM_FAST_PWM9 (6)

Definition at line 465 of file timer16_drv.h.

#define TIMER16_WGM_FAST_PWM10 (7)

Definition at line 466 of file timer16_drv.h.

#define TIMER16_WGM_FAST_PWM_ICR (14)

Definition at line 467 of file timer16_drv.h.

#define TIMER16_WGM_FAST_PWM_OCR (15)

Definition at line 468 of file timer16_drv.h.

#define TIMER16_WGM_RA_MASK (3<<WGM10)

Definition at line 469 of file timer16_drv.h.

#define TIMER16_WGM_RB_MASK (3<<WGM12)

Definition at line 470 of file timer16_drv.h.

#define TIMER16_NO_CLOCK (0)

Definition at line 472 of file timer16_drv.h.

#define TIMER16_CLKIO_BY_1 (1)

Definition at line 473 of file timer16_drv.h.

#define TIMER16_CLKIO_BY_8 (2)

Definition at line 474 of file timer16_drv.h.

#define TIMER16_CLKIO_BY_64 (3)

Definition at line 475 of file timer16_drv.h.

#define TIMER16_CLKIO_BY_256 (4)

Definition at line 476 of file timer16_drv.h.

#define TIMER16_CLKIO_BY_1024 (5)

Definition at line 477 of file timer16_drv.h.

#define TIMER16_EXT_CLOCK_FALLING_EDGE (6)

Definition at line 478 of file timer16_drv.h.

#define TIMER16_EXT_CLOCK_RISING_EDGE (7)

Definition at line 479 of file timer16_drv.h.

#define TIMER16_CLK_MASK (7<<CS10)

Definition at line 480 of file timer16_drv.h.

## Function Documentation

U16 timer16_get_counter | ( | void | ) |

This function READ the 16-bit TIMER counter.

Warning:

Parameters:

Returns:
  16-bit counter value

Definition at line 66 of file timer16_drv.c.

    {
        U16 u16_temp;

        u16_temp  =  Timer16_get_counter_low();
        u16_temp |= (Timer16_get_counter_high() << 8 );

        return u16_temp;
    }

U16 timer16_get_capture | ( | void | ) |

This function READ the 16-bit TIMER capture register.

Warning:

Parameters:

Returns:
  16-bit capture value

Definition at line 87 of file timer16_drv.c.

    {
        U16 u16_temp;

        u16_temp  =  Timer16_get_capture_low();
        u16_temp |= (Timer16_get_capture_high() << 8 );

        return u16_temp;
    }