You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
733 B
49 lines
733 B
extern "C" {
|
|
#include <avr/pgmspace.h>
|
|
#include <inttypes.h>
|
|
#include "wiring_private.h"
|
|
#include "WConstants.h"
|
|
|
|
#include <HardwareSerial.h>
|
|
}
|
|
|
|
#ifndef staticPrint_H
|
|
#define staticPrint_H
|
|
|
|
#ifndef SPrint
|
|
#define SPrint(str) SPrint_P(PSTR(str))
|
|
#endif
|
|
|
|
#ifndef SPrintln
|
|
#define SPrintln(str) SPrintln_P(PSTR(str))
|
|
#endif
|
|
|
|
static inline void SPrint_P(const char *data)
|
|
{
|
|
char ch;
|
|
|
|
for (;;) {
|
|
ch = pgm_read_byte( data++ );
|
|
if ( !ch ) return;
|
|
#if defined(__AVR_ATmega8__)
|
|
while (!(UCSRA & (1 << UDRE)))
|
|
;
|
|
|
|
UDR = ch;
|
|
#else
|
|
while (!(UCSR0A & (1 << UDRE0)))
|
|
;
|
|
|
|
UDR0 = ch;
|
|
#endif
|
|
}
|
|
}
|
|
|
|
static inline void SPrintln_P(const char *data)
|
|
{
|
|
SPrint_P(data);
|
|
SPrint_P(PSTR("\r\n"));
|
|
}
|
|
|
|
#endif
|