6 #define USE_RTS // comment this out if your circuit does not have RTS/CTS-lines 7 #define UART0_DE_MASK 0x04 8 #define UART0_PORT PORTE 9 #define UART1_DE_MASK 0x02 10 #define UART1_RTS_MASK 0x10 11 #define UART1_CTS_MASK 0x20 12 #define UART1_PORT PORTD 13 #define UART1_PIN PIND 15 #define SENSOR_BAUD 9600 16 #define HOST_BAUD 9600 17 #define SENSOR_UBRR (F_CPU/16/SENSOR_BAUD-1) 18 #define HOST_UBRR (F_CPU/16/HOST_BAUD-1) 21 #define UART0_BUFSIZE 40 22 #define UART1_BUFSIZE 200 26 extern volatile char cksum0;
27 extern volatile char rbuf0[];
34 extern void putc0(
char);
35 extern void putd0(
char);
37 extern int hprintf_P(
const char *fmt, ... );
92 #ifdef USE_RTS // Defined out... bool useRts
Shall the serial communication use RTS/CTS-handshake?
Definition: config.h:72
static void Uart0DisableLineDriver(void)
Disables the RS485 Line Driver on Uart0.
Definition: uart.h:51
static void ReleaseRTS(void)
Releases RTS to the Host Line, i.e. stops the Host from sending Data.
Definition: uart.h:100
#define UART1_PORT
Definition: uart.h:12
Structures and Constants for Configuration Handling.
uint8_t computedChecksum
Definition: uart.c:42
uint8_t charsInRbuf0
Definition: uart.c:41
#define UART1_PIN
Definition: uart.h:13
int putchar_uart1(char, FILE *)
The Putchar-Routine for USART1 (Host-Interface)
Definition: uart.c:160
static void Uart1DisableLineDriver(void)
Disables the RS485 Line Driver on Uart1.
Definition: uart.h:65
static void Uart0EnableLineDriver(void)
Enables the RS485 Line Driver on Uart0.
Definition: uart.h:44
#define UART1_DE_MASK
Definition: uart.h:9
static void UsartTimerCallback(void)
Timer Callback. Checks for CTS from the Host to resume Communication.
Definition: uart.h:75
volatile uint8_t tbuf1_tail
Definition: uart.c:36
#define UART0_DE_MASK
Definition: uart.h:7
static void AssertRTS(void)
Asserts RTS to the Host Line, i.e. allows the Host to send Data.
Definition: uart.h:90
static void Uart1EnableLineDriver(void)
Enables the RS485 Line Driver on Uart1.
Definition: uart.h:58
void usart1FlushRx(void)
Definition: uart.c:364
#define UART1_RTS_MASK
Definition: uart.h:10
volatile uint8_t tbuf1_head
Definition: uart.c:36
volatile uint8_t byteFromHost
Contains the last byte received from the host.
Definition: uart.c:43
void putd0(char)
Sends a Data Char (bit9=0) over USART0.
Definition: uart.c:109
int hprintf_P(const char *fmt,...)
printf_P for Communication with the Host
Definition: uart.c:375
bool Tbub1IsEmpty(void)
Tell if Transmit Buffer 1 is empty.
Definition: uart.c:191
#define UART0_PORT
Definition: uart.h:8
void putc0(char)
Sends a Command Char (bit9=1) over USART0.
Definition: uart.c:98
volatile char cksum0
Keeps track of the Checksum for USART0. It is automatically reset by command bytes.
Definition: uart.c:40
confStruct_t config
The Configuration. It is read on startup from the EEPROM.
Definition: config.c:32
volatile char rbuf0[]
Receive Buffer for UART0.
Definition: uart.c:33
volatile uint8_t hostCommandsLost
Counts the number of commands lost due to buffer overrun.
Definition: uart.c:44
FILE uart1
Definition: uart.c:47
void InitUart(void)
Initialize USART Hardware and Pointers.
Definition: uart.c:57
#define UART1_CTS_MASK
Definition: uart.h:11