diff --git a/avr/avr.gpr b/avr/avr.gpr index 9eb3bcb..f826bf1 100644 --- a/avr/avr.gpr +++ b/avr/avr.gpr @@ -14,7 +14,7 @@ project AVR is MCU := MCU.MCU; Arch := MCU.Arch; - BOARD := MCU.BOARD; + BOARD : MCU.Board_Type := MCU.BOARD; for Library_Name use "avrada"; for Library_Dir use "avr_lib/" & MCU & "/lib"; @@ -92,9 +92,17 @@ project AVR is ("-freestanding"); -- small binder file end Binder; - - for Source_Dirs use ("avr_lib/" & MCU, -- first look in the MCU specific dir + case BOARD is + when "none" => + for Source_Dirs use ( + "avr_lib/" & MCU, -- then look in the MCU specific dir + "avr_lib"); -- then look in the default dir + when others => + for Source_Dirs use ( + "avr_lib/board-" & BOARD, -- then look in the MCU specific dir + "avr_lib/" & MCU, -- then look in the MCU specific dir "avr_lib"); -- then look in the default dir + end case; type Clock_Type is @@ -273,8 +281,8 @@ project AVR is when "attiny2313" => for Source_Files use Std_Sources & UART_Sources & EEPROM_Sources & WDT_Sources - & Timer0_Sources & Time_No_Clock_Sources & Sleep_Sources - & Time_1ms_Sources; + & Timer0_Sources & Timer1_Sources & Time_No_Clock_Sources + & Sleep_Sources & Time_1ms_Sources; when "attiny25" | "attiny45" | "attiny85" => for Source_Files use Std_Sources & WDT_Sources; diff --git a/avr/avr_lib/avr-timer1.adb b/avr/avr_lib/avr-timer1.adb index 245f58e..171b3c1 100644 --- a/avr/avr_lib/avr-timer1.adb +++ b/avr/avr_lib/avr-timer1.adb @@ -37,20 +37,20 @@ package body AVR.Timer1 is #if MCU = "atmega168" or else MCU = "atmega169" or else MCU = "atmega328p" or else MCU = "atmega644" or else MCU = "atmega644p" or else MCU = "atmega2560" then Interrupt_Mask : Bits_In_Byte renames MCU.TIMSK1_Bits; -#elsif MCU = "atmega32" then +#elsif MCU = "atmega32" or else MCU = "attiny2313" then Interrupt_Mask : Bits_In_Byte renames MCU.TIMSK_Bits; #end if; Output_Compare_Interrupt_Enable : Boolean renames Interrupt_Mask (MCU.OCIE1A_Bit); Overflow_Interrupt_Enable : Boolean renames Interrupt_Mask (MCU.TOIE1_Bit); -#if MCU = "atmega32" or else MCU = "atmega168" or else MCU = "atmega168a" or else MCU = "atmega328p" or else MCU = "atmega644" or else MCU = "atmega644p" or else MCU = "atmega2560" then +#if MCU = "atmega32" or else MCU = "atmega168" or else MCU = "atmega168a" or else MCU = "atmega328p" or else MCU = "atmega644" or else MCU = "atmega644p" or else MCU = "atmega2560" or else MCU = "attiny2313" then WGM0 : Boolean renames MCU.TCCR1A_Bits (MCU.WGM10_Bit); WGM1 : Boolean renames MCU.TCCR1A_Bits (MCU.WGM11_Bit); WGM2 : Boolean renames MCU.TCCR1B_Bits (MCU.WGM12_Bit); WGM3 : Boolean renames MCU.TCCR1B_Bits (MCU.WGM13_Bit); #end if; -#if MCU = "attiny13" or else MCU = "atmega32" or else MCU = "atmega168" or else MCU = "atmega169" or else MCU = "atmega328p" or else MCU = "atmega644" or else MCU = "atmega644p" or else MCU = "atmega2560" then +#if MCU = "attiny13" or else MCU = "atmega32" or else MCU = "atmega168" or else MCU = "atmega169" or else MCU = "atmega328p" or else MCU = "atmega644" or else MCU = "atmega644p" or else MCU = "atmega2560" or else MCU = "attiny2313" then Com0 : Boolean renames Ctrl_Reg (MCU.COM1A0_Bit); Com1 : Boolean renames Ctrl_Reg (MCU.COM1A1_Bit); -- #elsif MCU = "atmega32" then