diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/avr/Makefile | 2 | ||||
-rw-r--r-- | src/avr/serial.c | 6 | ||||
-rw-r--r-- | src/avr/timer.c | 4 |
3 files changed, 7 insertions, 5 deletions
diff --git a/src/avr/Makefile b/src/avr/Makefile index 58d5c846..d07d51f7 100644 --- a/src/avr/Makefile +++ b/src/avr/Makefile @@ -5,7 +5,7 @@ CROSS_PREFIX=avr- dirs-y += src/avr lib/pjrc_usb_serial -CFLAGS-y += -O2 -mmcu=$(CONFIG_MCU) -DF_CPU=$(CONFIG_CLOCK_FREQ) +CFLAGS-y += -mmcu=$(CONFIG_MCU) LDFLAGS-y += -Wl,--relax # Add avr source files diff --git a/src/avr/serial.c b/src/avr/serial.c index 32619ecc..8628b602 100644 --- a/src/avr/serial.c +++ b/src/avr/serial.c @@ -30,10 +30,12 @@ serial_init(void) { if (CONFIG_SERIAL_BAUD_U2X) { UCSR0A = 1<<U2X0; - UBRR0 = DIV_ROUND_CLOSEST(F_CPU, 8UL * CONFIG_SERIAL_BAUD) - 1UL; + UBRR0 = DIV_ROUND_CLOSEST( + CONFIG_CLOCK_FREQ, 8UL * CONFIG_SERIAL_BAUD) - 1UL; } else { UCSR0A = 0; - UBRR0 = DIV_ROUND_CLOSEST(F_CPU, 16UL * CONFIG_SERIAL_BAUD) - 1UL; + UBRR0 = DIV_ROUND_CLOSEST( + CONFIG_CLOCK_FREQ, 16UL * CONFIG_SERIAL_BAUD) - 1UL; } UCSR0C = (1<<UCSZ01) | (1<<UCSZ00); diff --git a/src/avr/timer.c b/src/avr/timer.c index c9c3ccca..588669c1 100644 --- a/src/avr/timer.c +++ b/src/avr/timer.c @@ -16,13 +16,13 @@ * Low level timer code ****************************************************************/ -DECL_CONSTANT(CLOCK_FREQ, F_CPU); +DECL_CONSTANT(CLOCK_FREQ, CONFIG_CLOCK_FREQ); // Return the number of clock ticks for a given number of microseconds uint32_t timer_from_us(uint32_t us) { - return us * (F_CPU / 1000000); + return us * (CONFIG_CLOCK_FREQ / 1000000); } union u32_u { |