;*****************************************************************
;* - Description:  Device definition file for RC Calibration
;* - File:         defines.inc
;* - AppNote:      AVR057 - Internal RC oscillator calibration
;*                          for ATtiny4/5/9/10/20/40
;*
;* - Author:       Atmel Corporation: http://www.atmel.com
;*                 Support email: avr@atmel.com
;*****************************************************************

 .if ATTINY == 4
    .include "tn4def.inc"
    .equ TCLK_PIN = 1
    .equ TDATA_PIN = 0
    .equ TPORT = PORTB
    .equ TDIR = DDRB
    .equ TPIN = PINB
    .equ INT_CTRL_BIT = 0
    .equ INT_MASK_BIT = 1
    .equ INT_CTRL_REG = PCICR
    .equ INT_MASK_REG = PCMSK
    .equ TIMER_CTRL_REG = TCCR0B
    .equ TIMER_CTRL_VAL = 0x01
    .equ TIMER_CNT_HI = TCNT0H
    .equ TIMER_CNT_LO = TCNT0L
    .equ INT_VECT = PCI0addr
 
 .elif ATTINY == 5
    .include "tn5def.inc"
    .equ TCLK_PIN = 1
    .equ TDATA_PIN = 0
    .equ TPORT = PORTB
    .equ TDIR = DDRB
    .equ TPIN = PINB
    .equ INT_CTRL_BIT = 0
    .equ INT_MASK_BIT = 1
    .equ INT_CTRL_REG = PCICR
    .equ INT_MASK_REG = PCMSK
    .equ TIMER_CTRL_REG = TCCR0B
    .equ TIMER_CTRL_VAL = 0x01
    .equ TIMER_CNT_HI = TCNT0H
    .equ TIMER_CNT_LO = TCNT0L
    .equ INT_VECT = PCI0addr

 .elif ATTINY == 9
    .include "tn9def.inc"
    .equ TCLK_PIN = 1
    .equ TDATA_PIN = 0
    .equ TPORT = PORTB
    .equ TDIR = DDRB
    .equ TPIN = PINB
    .equ INT_CTRL_BIT = 0
    .equ INT_MASK_BIT = 1
    .equ INT_CTRL_REG = PCICR
    .equ INT_MASK_REG = PCMSK
    .equ TIMER_CTRL_REG = TCCR0B
    .equ TIMER_CTRL_VAL = 0x01
    .equ TIMER_CNT_HI = TCNT0H
    .equ TIMER_CNT_LO = TCNT0L
    .equ INT_VECT = PCI0addr

 .elif ATTINY == 10
    .include "tn10def.inc"
    .equ TCLK_PIN = 1
    .equ TDATA_PIN = 0
    .equ TPORT = PORTB
    .equ TDIR = DDRB
    .equ TPIN = PINB
    .equ INT_CTRL_BIT = 0
    .equ INT_MASK_BIT = 1
    .equ INT_CTRL_REG = PCICR
    .equ INT_MASK_REG = PCMSK
    .equ TIMER_CTRL_REG = TCCR0B
    .equ TIMER_CTRL_VAL = 0x01
    .equ TIMER_CNT_HI = TCNT0H
    .equ TIMER_CNT_LO = TCNT0L
    .equ INT_VECT = PCI0addr

 .elif ATTINY == 20
    .include "tn20def.inc"
    .equ TCLK_PIN = 0
    .equ TDATA_PIN = 1
    .equ TPORT = PORTB
    .equ TDIR = DDRB
    .equ TPIN = PINB
    .equ INT_CTRL_BIT = 5
    .equ INT_MASK_BIT = 0
    .equ INT_CTRL_REG = GIMSK
    .equ INT_MASK_REG = PCMSK1
    .equ TIMER_CTRL_REG = TCCR1B
    .equ TIMER_CTRL_VAL = 0x01
    .equ TIMER_CNT_HI = TCNT1H
    .equ TIMER_CNT_LO = TCNT1L
    .equ INT_VECT = PCI1addr

 .elif ATTINY == 40
    .include "tn40def.inc"
    .equ TCLK_PIN = 5
    .equ TDATA_PIN = 4
    .equ TPORT = PORTC
    .equ TDIR = DDRC
    .equ TPIN = PINC
    .equ INT_CTRL_BIT = 6
    .equ INT_MASK_BIT = 5
    .equ INT_CTRL_REG = GIMSK
    .equ INT_MASK_REG = PCMSK2
    .equ TIMER_CTRL_REG = TCCR1A
    .equ TIMER_CTRL_VAL = 0x81
    .equ TIMER_CNT_HI = TCNT1H
    .equ TIMER_CNT_LO = TCNT1L
    .equ PCI2addr = 0x0004
    .equ INT_VECT = PCI2addr

 .endif