avr
单片?/p>
串口实现
printf
(使用变参函数)
#include
#include
#include
typedef unsigned char uint8;
static void usart_init(void)
{
UCSRA = 0x02;
UCSRB = 0x18;
UCSRC = 0x06;
UBRRH = 0x00;
UBRRL = 103;
}
static void put_char(uint8 data)
{
if (data ==
?r?
put_char(0x09);
while ( !(UCSRA
(1
;
UDR = data;
}
static void myprintf(const char* fmt,...)
{