[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-libc-dev] [patch #6768] Addition to util/setbaud.h
From: |
Frédéric Nadeau |
Subject: |
[avr-libc-dev] [patch #6768] Addition to util/setbaud.h |
Date: |
Thu, 05 Mar 2009 16:21:10 +0000 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/530.1 (KHTML, like Gecko) Chrome/2.0.166.1 Safari/530.1 |
URL:
<http://savannah.nongnu.org/patch/?6768>
Summary: Addition to util/setbaud.h
Project: AVR C Runtime Library
Submitted by: fnadeau
Submitted on: jeu 05 mar 2009 16:21:09 GMT
Category: None
Priority: 5 - Normal
Status: None
Privacy: Public
Assigned to: None
Originator Email:
Open/Closed: Open
Discussion Lock: Any
_______________________________________________________
Details:
I noticed that util/setbaud.h cannot calculate baudrate for sync mode.
I did the following modification to the file. I doubt it will it the
next release, but I do beleive it is a good thing to have.
Basic explanation:
if BAUD_SYNC is define and equal to 1, a modified macro is use to
calculate baud rate.
If BAUD_SYNC is define and equal to 0 or not define, macro works as before.
Modification should not break code that use the current version of
setbaud.h.
Usage could be:
#include <avr/io.h>
#define F_CPU 4000000
static void uart_9600(void)
{
#define BAUD_SYNC 1
#define BAUD 9600
//Device specific declaration
#define XCK_DDR DDRB//For ATmega16A
#define XCK_DDx DDB0
#include <util/setbaud.h>
UBRRH = UBRRH_VALUE;
UBRRL = UBRRL_VALUE;
UCSRC = _BV(1<<UMSEL);
//Configure as clock source
XCK_DDR |= _BV(1<<XCK_DDx);
}
_______________________________________________________
File Attachments:
-------------------------------------------------------
Date: jeu 05 mar 2009 16:21:09 GMT Name: setBaud.diff Size: 1 ko By:
fnadeau
<http://savannah.nongnu.org/patch/download.php?file_id=17593>
_______________________________________________________
Reply to this item at:
<http://savannah.nongnu.org/patch/?6768>
_______________________________________________
Message posté via/par Savannah
http://savannah.nongnu.org/
- [avr-libc-dev] [patch #6768] Addition to util/setbaud.h,
Frédéric Nadeau <=