a500kbd

diff src/serial.c @ 2:a4fd9c5a6655

first working version
author John Tsiombikas <nuclear@member.fsf.org>
date Tue, 17 Oct 2017 15:25:33 +0300
parents 8e8e17a0f88e
children
line diff
     1.1 --- a/src/serial.c	Sat Oct 14 07:23:47 2017 +0300
     1.2 +++ b/src/serial.c	Tue Oct 17 15:25:33 2017 +0300
     1.3 @@ -1,11 +1,11 @@
     1.4 +#ifndef F_CPU
     1.5  #ifdef XTAL
     1.6 -#define F_CLK	XTAL
     1.7  #define F_CPU	XTAL
     1.8  #else
     1.9  #warning "compiled for 1mhz internal rc osc. serial comms won't work"
    1.10 -#define F_CLK	1000000
    1.11  #define F_CPU	1000000
    1.12  #endif
    1.13 +#endif
    1.14  
    1.15  #include <stdio.h>
    1.16  #include <avr/io.h>
    1.17 @@ -30,7 +30,7 @@
    1.18  
    1.19  void init_serial(long baud)
    1.20  {
    1.21 -	unsigned int ubrr_val = F_CLK / 16 / baud - 1;
    1.22 +	unsigned int ubrr_val = F_CPU / 16 / baud - 1;
    1.23  
    1.24  	power_usart0_enable();
    1.25