/*
* main.c
*
* Created on: Sep 28, 2011
* Author: sebastian
*
* This file is part of the RingLock-library for Atmel AVR MCUS.
*
* RingLock is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* RingLock is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with RingLock. If not, see .
*
* Copyright Sebastian Schumb (sebastian_at_sebastians-site_de) 2011
*/
#include
#include
#include "include/ringlock.h"
#define BAUD 9600UL // baudrate
// Some calculations ...
#define UBRR_VAL ((F_CPU+BAUD*8)/(BAUD*16)-1) // rounding magic
#define BAUD_REAL (F_CPU/(16*(UBRR_VAL+1))) // Real baudrate
#define BAUD_ERROR ((BAUD_REAL*1000)/BAUD) // Error in 0,1%
#if ((BAUD_ERROR<990) || (BAUD_ERROR>1010)) // Make sure your UBRR_VAL will work
#error Baudrate error is bigger then 1% !
#endif
int main(void) {
rl_init();
UBRRH = UBRR_VAL >> 8; //Setting baudrate
UBRRL = UBRR_VAL & 0xFF;
UCSRB |= (1<