123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164 |
- # Build configuration:
- # Target device. May be one of:
- # t13 => ATTiny13 with reduced feature set.
- # t25 => ATTiny25 with reduced feature set.
- # t45 => ATTiny45 with full feature set for one PWM.
- # t85 => ATTiny85 with full feature set for one PWM.
- # m88p => ATMega88P with full feature set for three PWM (RGB).
- # m328p => ATMega328P with full feature set for three PWM (RGB).
- DEV := t85
- # Limit the maximum PWM duty cycle to this percentage:
- PWM_LIM := 100
- # Invert the PWM output signal?
- PWM_INVERT := 0
- # Invert the ADC input signal?
- ADC_INVERT := 0
- # Interpret the ADC setpoints as HSL instead of RGB, if 3 ADCs are available?
- ADC_HSL := 1
- ##############################################################################
- ##############################################################################
- ##############################################################################
- $(info DEV=$(DEV) PWM_LIM=$(PWM_LIM) PWM_INVERT=$(PWM_INVERT) ADC_INVERT=$(ADC_INVERT) ADC_HSL=$(ADC_HSL))
- # Project name
- NAME := simplepwm
- # Project source files
- SRCS := \
- adc.c \
- battery.c \
- color.c \
- crc.c \
- curve.c \
- debug.c \
- eeprom.c \
- filter.c \
- main.c \
- movingavg.c \
- outputsp.c \
- potentiometer.c \
- pcint.c \
- pwm.c \
- remote.c \
- ring.c \
- standby.c \
- uart.c \
- watchdog.c
- GEN_SRCS :=
- # Bootloader source files
- BOOT_SRCS :=
- BOOT_GEN_SRCS :=
- BOOT_OFFSET :=
- # Project fuse bits
- ifeq ($(DEV),t13)
- # ATTiny 13
- # 9.6 MHz, SUT 4 ms, BOD 2.7 V, WDT on, SPIEN
- F_CPU := 9600000UL
- LFUSE := 0x56
- HFUSE := 0xFB
- EFUSE :=
- endif
- ifeq ($(DEV),t25)
- # ATTiny 25
- # 8 MHz, SUT 4 ms, BOD 2.7 V, WDT off, SPIEN
- F_CPU := 8000000UL
- LFUSE := 0xD2
- HFUSE := 0xDD
- EFUSE := 0xFF
- endif
- ifeq ($(DEV),t45)
- # ATTiny 45
- # 8 MHz, SUT 4 ms, BOD 2.7 V, WDT off, SPIEN
- F_CPU := 8000000UL
- LFUSE := 0xD2
- HFUSE := 0xDD
- EFUSE := 0xFF
- endif
- ifeq ($(DEV),t85)
- # ATTiny 85
- # 8 MHz, SUT 4 ms, BOD 2.7 V, WDT off, SPIEN
- F_CPU := 8000000UL
- LFUSE := 0xD2
- HFUSE := 0xDD
- EFUSE := 0xFF
- endif
- ifeq ($(DEV),m88p)
- # ATMega 88P
- # 8 MHz, SUT 4.1 ms, BOD 2.7 V, WDT off, SPIEN
- F_CPU := 8000000UL
- LFUSE := 0xD2
- HFUSE := 0xDD
- EFUSE := 0xF9
- endif
- ifeq ($(DEV),m328p)
- # ATMega 328P
- # 8 MHz, SUT 4.1 ms, BOD 2.7 V, WDT off, SPIEN
- F_CPU := 8000000UL
- LFUSE := 0xD2
- HFUSE := 0xD9
- EFUSE := 0xFD
- endif
- # Architecture configuration
- GCC_ARCH := $(subst m,atmega,$(subst t,attiny,$(DEV)))
- AVRDUDE_ARCH := $(DEV)
- FUNC_STACK_LIMIT :=
- # Programmer selection.
- # Values can be: avrisp2, mysmartusb
- PROGRAMMER := avrisp2
- AVRDUDE_SPEED := 10
- AVRDUDE_SLOW_SPEED := 200
- # Instrumentation
- INSTRUMENT_FUNC :=
- BOOT_INSTRUMENT_FUNC :=
- # Additional compiler flags
- CFLAGS := -DPWM_LIM="$(PWM_LIM)" \
- -DPWM_INVERT="(!!($(PWM_INVERT)))" \
- -DADC_INVERT="(!!($(ADC_INVERT)))" \
- -DADC_HSL="$(ADC_HSL)"
- LDFLAGS :=
- # Additional "clean" and "distclean" target files
- CLEAN_FILES := pwm0_isr.c pwm1_isr.c pwm2_isr.c
- DISTCLEAN_FILES :=
- streq = $(and $(filter 1,$(words $2)),$(filter $1,$(firstword $2)))
- deveq = $(call streq,$1,$(DEV))
- ifeq ($(strip $(call deveq,t13)\
- $(call deveq,t25)\
- $(call deveq,t45)\
- $(call deveq,t85)\
- $(call deveq,m88p)\
- $(call deveq,m328p)),)
- $(error "DEV=$(DEV) is not supported.")
- endif
- include avrmakelib.mk
- pwm.c: pwm0_isr.c pwm1_isr.c pwm2_isr.c
- pwm0_isr.c: pwm_isr_template.c
- $(QUIET_SED) -e 's/%INDEX%/0/g' -e 's/%HEADER%/THIS IS A GENERATED FILE/g' $< > $@
- pwm1_isr.c: pwm_isr_template.c
- $(QUIET_SED) -e 's/%INDEX%/1/g' -e 's/%HEADER%/THIS IS A GENERATED FILE/g' $< > $@
- pwm2_isr.c: pwm_isr_template.c
- $(QUIET_SED) -e 's/%INDEX%/2/g' -e 's/%HEADER%/THIS IS A GENERATED FILE/g' $< > $@
|