Skip to content

Commit

Permalink
general: cleaner way to deal with processor ports
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisstjohn committed Nov 20, 2023
1 parent 9b2d89a commit 48bbbdd
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion soft/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
build-attiny85
build-*
2 changes: 1 addition & 1 deletion soft/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 "$@" "$<"
Expand Down
4 changes: 2 additions & 2 deletions soft/lib/task.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand All @@ -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<<OCIE0A;
#else
TIMSK = 1<<OCIE0A;
Expand Down
2 changes: 1 addition & 1 deletion soft/sample/blinky/pwm.config
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
* @endcode
*/

#if defined(__AVR_ATtiny48__) || defined(__AVR_ATtiny88__)
#if TARGET_MCU_IS_attiny48 || TARGET_MCU_IS_attiny88
# define PWM_GPIOS(_) _(B, 0) _(B, 1) _(B, 2) _(B, 3) _(B, 4) _(D, 0)
#else
# define PWM_GPIOS(_) _(B, 0) _(B, 1) _(B, 2) _(B, 3) _(B, 4) _(B, 5)
Expand Down

0 comments on commit 48bbbdd

Please sign in to comment.