aboutsummaryrefslogtreecommitdiffstats
path: root/src/avr/serial.c
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2017-03-28 12:11:02 -0400
committerKevin O'Connor <kevin@koconnor.net>2017-03-30 10:56:17 -0400
commit18f4d343f5c90ea241a04819e10708c6f1a4d0cc (patch)
treec895af049a489760d7663551c1a45767b1b01b93 /src/avr/serial.c
parent31e78c90e2f3c267779237e9cfaa3465e1571a87 (diff)
downloadkutter-18f4d343f5c90ea241a04819e10708c6f1a4d0cc.tar.gz
kutter-18f4d343f5c90ea241a04819e10708c6f1a4d0cc.tar.xz
kutter-18f4d343f5c90ea241a04819e10708c6f1a4d0cc.zip
avr: Remove F_CPU compile time definition
Directly use the Kconfig defined CONFIG_CLOCK_FREQ in the code and avoid defining F_CPU. Also, remove the unnecessary O2 option - that is already the default from the main makefile. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src/avr/serial.c')
-rw-r--r--src/avr/serial.c6
1 files changed, 4 insertions, 2 deletions
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);