From 48bbbddfb383c9c13dadbfb58c7f12bdd426e2ab Mon Sep 17 00:00:00 2001 From: Chris St John Date: Mon, 20 Nov 2023 10:37:16 +0000 Subject: [PATCH] general: cleaner way to deal with processor ports --- soft/.gitignore | 2 +- soft/Makefile | 2 +- soft/lib/task.c | 4 ++-- soft/sample/blinky/pwm.config | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/soft/.gitignore b/soft/.gitignore index cda9d53..dd07bff 100644 --- a/soft/.gitignore +++ b/soft/.gitignore @@ -1 +1 @@ -build-attiny85 +build-* diff --git a/soft/Makefile b/soft/Makefile index f29c834..ddd9111 100644 --- a/soft/Makefile +++ b/soft/Makefile @@ -65,7 +65,7 @@ $(OUTPUT_DIR)/%.o: %.c mkdir -p $(dir $@) $(CC) -iquote inc -iquote $(APPLICATION) -iquote etc \ -x c -funsigned-char -funsigned-bitfields \ - -DTARGET_MCU=$(TARGET_MCU) -DF_CPU=$(CLOCK_FREQUENCY)UL \ + -DTARGET_MCU=$(TARGET_MCU) -DTARGET_MCU_IS_$(TARGET_MCU)=1 -DF_CPU=$(CLOCK_FREQUENCY)UL \ -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -Wall -mmcu=$(TARGET_MCU) \ -c -std=gnu99 -MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -Os -g \ -o "$@" "$<" diff --git a/soft/lib/task.c b/soft/lib/task.c index 7e48f10..301bb89 100644 --- a/soft/lib/task.c +++ b/soft/lib/task.c @@ -107,7 +107,7 @@ void task_main(void) sleep_enable(); /* We use TIMER0 with Counter A and /256 prescaler */ -#if defined(__AVR_ATtiny48__) || defined(__AVR_ATtiny88__) +#if TARGET_MCU_IS_attiny48 || TARGET_MCU_IS_attiny88 TCCR0A = 0x04; /* /256 */ #else TCCR0A = 0x02; /* OCRA */ @@ -119,7 +119,7 @@ void task_main(void) OCR0A = (uint8_t)(TIMER_SYSCLK_256_2ms/2)-1; /* Raise interrupt on Compare Match A */ -#if defined(__AVR_ATtiny48__) || defined(__AVR_ATtiny88__) +#if TARGET_MCU_IS_attiny48 || TARGET_MCU_IS_attiny88 TIMSK0 = 1<